If-Statement for multiple conditions

Hello everybody,
is there a way to get a if-statement with multiple conditions for one datable row? I need one condition for empty rows, which I solved with string.isnullorempty. The second condition is for values in the row where there is no hours(eg 14h) in the row given.

Thanks a lot :slight_smile:

HI @Agnetha

Can you share the sample input excel file? and elaborate your query


Hi @Agnetha ,

You can chain conditions inside an If Activity/Statement like so:

String.IsNullOrEmpty(CurrentRow.ToString) OrElse Condition2 OrElse Condition3...

The OrElse is what we call a Shortcircuiting Operator, which works faster than an Or Operator.

Usually, when you compare values, there is a LHS and an RHS, and both segments are evaluated before the bot decides to output a Boolean Value.

If the branches of logic are long i.e., when you chain one condition after another, the Or will force the software to evaluate the all branches, which can lead to performance issues.

Since the Or should only check if one or more conditions have to be satisfied, it will break out of the evaluation stage the moment it comes a condition which evaluates to True.

Similarly, we have one for the And Operator as well, and its call AndAlso.

Kind Regards,
Ashwin A.K

Of course!
I hope this small example will help. I need to get the product in column B if there is no value or a written text in column A (highlighted in yellow) as you can see in the excel. The hour values should not be focused on in the workflow
Example.xlsx (8.7 KB)

Hi @Agnetha ,

Here is a short sequence which uses a For Each Row in DataTable.

Condition →

IsNothing(CurrentRow("Column 1")) OrElse 
String.IsNullOrEmpty(CurrentRow("Column 1").ToString) OrElse 
System.Text.RegularExpressions.Regex.IsMatch(CurrentRow("Column 1").ToString.ToLower.Trim,"^\d+h$")

MultipleConditions.xaml (6.9 KB)

Kind Regards,
Ashwin A.K

1 Like

@Agnetha if you have multiple condition to check then it would be better to go for switch activity. Use the below link for more info on switch

Also, use below link to write the conditions using switch

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