Skip to main content

I have a table with one input column and one output column. I would like to loop through each row in the table, feed the input column value (pre-populated) into an external bot (Task Bot: Run), and map the output into the output column for the row associated with the input. I’d like to loop through until completed.

I’ve tried using ‘Loop - Data Table - For each row in table’. This works fine and the loop runs through each row. However, I need to keep track of which row to write into. I’ve assigned the current row a Record variable (‘CurrentRow’), however I can’t later refer to this as a number. Is there a ‘key’ I can use for ‘Multiple variables’ mapping? How else can I keep track of the row the loop is on? Is there a more elegant way than creating a variable that is increased by one every time the loop runs?

I then use the ‘Data Table: Set value of a single cell’ action to write the Task Bot output into the table output column. Column by Name/Index works fine. I can also set the value of table cell as the Task Bot output fine. What I’m struggling with is what do I input as Row by index? It suggests ‘$CurrentRowb0]$’ (the Record variable I created), but how can I keep track of the row number using this? Surely this will just keep recording into row 0?

I have a table with one input column and one output column. I would like to loop through each row in the table, feed the input column value (pre-populated) into an external bot (Task Bot: Run), and map the output into the output column for the row associated with the input. I’d like to loop through until completed.

Okay, so far so good. Two tables. Have you considered using List variables?

I’ve tried using ‘Loop - Data Table - For each row in table’. This works fine and the loop runs through each row. However, I need to keep track of which row to write into.

For that, you will need to make your own counter variable and increment it manually.

I’ve assigned the current row a Record variable (‘CurrentRow’), however I can’t later refer to this as a number.

I’m assuming you mean the value contained in the Record variable. You can use a String: To number action to convert it.

Is there a ‘key’ I can use for ‘Multiple variables’ mapping? How else can I keep track of the row the loop is on? Is there a more elegant way than creating a variable that is increased by one every time the loop runs?

You can use a numeric index for a table. $tTablec0]n0]$ or similarly $tTable[$nCount$] 0]$.

I then use the ‘Data Table: Set value of a single cell’ action to write the Task Bot output into the table output column. Column by Name/Index works fine. I can also set the value of table cell as the Task Bot output fine. What I’m struggling with is what do I input as Row by index? It suggests ‘$CurrentRoww0]$’ (the Record variable I created), but how can I keep track of the row number using this? Surely this will just keep recording into row 0?

Same problem and solution as above. You can use numeric indices. The UI implies it is not possible, but if you manually edit the variable and its parameters, you will find that you can use numeric variables for the indices.

List variables might be a better choice since you’re only working with one column.

https://docs.automationanywhere.com/bundle/enterprise-v2019/page/enterprise-cloud/topics/aae-client/bot-creator/commands/cloud-list-command.html


Reply