If condition with collection doubt

I am having list of states like ( tamilnadu, Mumbai, Kerala, Kolkata , Punjab, Delhi)

I am having excel sheet column name state with multiple state names.

In IF CONDITION I have to put above mentioned 6 state in one list and compare in excel state values of it is present then only do further otherwise nothing to do.

How to put (tamilnadu, Mumbai, Kerala, Kolkata , Punjab, Delhi) this six state in collection to check if condition any one help

You can use Arrays OR List for the same.

Recommended is list bacause list has more utility functions exposed.

Thanks.

Hi @BHUVAN

You can use an Array varaiable for this let say arrStates

Now you can use Assign and write as arrStates = {“tamilnadu”, “Mumbai”, “Kerala”, “Kolkata”, “Punjab”, “Delhi”}

For Each activity to loop an inside that you can place If condition

Hope this may help you

Thanks,
Srini

1 Like

Then in If you can use:

List.contains(“Value to Search”)

1 Like

Hi @BHUVAN

Read the excel sheet and store it in a datatable. Use for each row in datatable activity to loop the State column name. In the loop use the for each activity to loop through the List collection of states. Then use the If condition to compare the Excel sheet column state with the collection of states. If it matches develop the further that you want in then bloclk, if it doesn’t match it will go to else block

Hope it helps!!

1 Like

If you have a fixed list of items, then go for an array variable.
You can initialize the array and add values to it using assign activity.
arrayVar= = {“tamilnadu”, “Mumbai”, “Kerala”, “Kolkata”, “Punjab”, “Delhi”}

1 Like

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