For each row in Data Table write "Processed" or "Error" string to furthest column after condition is met

I have built a workflow within a for each row in a Data Table. I am wanting to write a specific string (“Processed” or “Error: Need to research”) to each row in a new column based on certain conditions. I have already added a new column after the join data table activity. See attached picture:
image

Inside the for each row workflow:

What I want to do is pass a string to the data table if the first flow is true (i.e. “Error”) and at the end I want to pass the string “Processed” if it goes to the end of the last two decision flows. I know I need a counter + 1 of sorts. I Just dont know where to insert the counter +1 assign activity and the “Value” to update data table.

Hi @re123

In the foreach activity, there’s an option to keep track of the index, then depending the output of your second flow you can modify the datatable.

First. Try you best to not put a flowchart into a for each row (not a good practise)

To solve it. I am not sur. But try to add a variable “count” into the “For each row” activity’s properties called ’ Index". Then use this index to know exactly where you are in the loop and assign what you want into the previous or next row. Like

Assign: processed_OrgAA = JoinedDt.row(index+1)…

After the (Index):
image

Is the next parenthesis (“ColumnName”)?

Right. But I do not also want to do nested if statements. Which is also not good practice.

Use an Assign Activity for the IF

Which if statement?

@re123 Yes, it is the column name. :slight_smile:

1 Like

Yes, you can use this:

Assing Activity

Variable = If (Condition, TrueValue, FalseValue)
If condition is TRUE, the variable takes the True Value, if not takes the False value

NOTE: in the False section you can add another IF

With Boolean:

Variable = If (5 > 2, True, False)
Variable = True

With String:

String1 = “Hi, how are you?”
String2 = If (String1.contains(“how”), “Contains HOW”, “NOT Contains HOW” )
String2= “Contains HOW”

OR

You can use If-nested

Integer = 9
Variable = IF (Integer <= 5, “Failde”,
If(Integer <=7, “Regular” ,
if(integer<=9, “Godd”, “Excellent” ) ) )

Let me know if you have any question

Your assign suggestion worked! Thank you. I put an assign at the end of the two process flows.

1 Like

@re123 Good to know that! You might want to mark my reply as the solution.

Have a good day!

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