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
Can you share the sample input excel file? and elaborate your query
You can chain conditions inside an If Activity/Statement like so:
String.IsNullOrEmpty(CurrentRow.ToString) OrElse Condition2 OrElse Condition3...
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
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
Similarly, we have one for the
And Operator as well, and its call AndAlso.
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)
Here is a short sequence which uses a For Each Row in DataTable.
IsNothing(CurrentRow("Column 1")) OrElse
String.IsNullOrEmpty(CurrentRow("Column 1").ToString) OrElse
MultipleConditions.xaml (6.9 KB)
@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
The Switch activity enables you to select one choice out of multiple, based on the value of a specified expression. By default, the Switch activity uses the integer argument, but you can change it from the Properties panel, from the TypeArgument...
Also, use below link to write the conditions using switch
I’m trying to use the switch activity to do different activities if a variable I scraped contains specific words.
For example, if contains “hello” do an activity, and if contains “bye” another one…
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.