How to avoid the use of multiple "if" activities?


I have to sort some Excel datas depending of a string value of one column.
Each cell of this column can be 14 differents string values.

I’m looking for a technique to avoid to use 14 “if” activities to check what is the current cell value. Any ideas ?

Hello @hubert_leleu ,

You can use switch activity. In this activity you can create multiple case. Based on the case which you are passing the particular sequence will work.

But here in your case you are getting value from one excel and using that for sorting of an another excel ryt. Then you can use for each row in datatable to loop through the strings and use sort activity.

can you illustrate your case a little bit more as

the quoted part is unclear.

When the question is about to check if in a datatable is to check if a particular value is present under a particular column, we can do

dtDataVar.AsEnumerable.Any(Function (x) x(YourColNameOrIndex).toString.Trim.Equals("YourSearchString")) 

and will return true or false

other wise we can use a switch or since newer time the else if as well

thanks, it was exactly what I needed

1 Like

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