Operator

can we use “in” operator in uipath.
like python we use “in” operator to check the values are present in the string or list.
How we can use this in the uipath.
Because I need to check the value is present in the array of string.

HI @agathiyanv

You can use loop here.

For each value in ARRAY
IF Actvity

strVariable.contains(“value”)

You can create reusable xaml and pass the strVariable

Regards
Gokul

The actual problem is I already have for loop which is loop through the values from an excel sheet.
I need to check the values from the excel sheet is present in the array of strings or not.

Hey!

Once you read the excel inside the for loop take one more for each row activity inside the for each row and take one if condition mention the expression like this

Item.Equals(CurrentRow("ColumnName").ToString.Trim)

The above expression will checks the Array(First) item with excel First row. If both matches The Then block will executes… else the else block will executes

Reference:

Try this and let me know

Regards,
NaNi

You can use contains on the array variable too.

strArray.Contains(CurrentRow(“Column1”).ToString.Trim)

If you need to make it case insensitive:
strArray.Contains(CurrentRow(“Column1”).ToString.Trim, StringComparer.CurrentCultureIgnoreCase)

1 Like

Hello @agathiyanv Take a if activity inside loop and the condition should be

ArrayofStringVariable.Contains(Your excel value)
2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.