Array variable with Loop command
- Zuletzt aktualisiert2020/04/17
Array variable with Loop command
After array type variables are created, you can process them in automated tasks using the Loop command.
Using the direct assignment array variable
- Open the Workbench.
- Create an array variable, for example $Student_Data$, using the Direct Assignment option from the Variable Manager.
- Drag the Loop command and select the Times option.
- Press F2 to insert the $ArrayRow$ variable and select the Array Variable as $Student_Data$.
- Create a value variable using the Variable Manager, for example $row$, to iterate through the number of rows.
- In the Loop command, perform these steps:
- Drag the Variable Operation command, select $row$ in the Specify Variable drop-down list, and press F2 to select the $Counter$ variable in Specify value.
- Drag another Loop command and select the Times option.
- Press F2 to insert the $ArrayColumn$ variable and select $Student_Data$ as the Array Variable.
- Drag the Message Box command and press F2 to insert the $Student_Data$ variable.
- In the Array variable dialog box, press F2 to select the $row$ variable in Row Value and the $Counter$ variable in Column Value.
- Click OK to save the values and click Save to save the message.
- Click Run to run the Task Bot.
Using the read from text file array variable
- Open the Workbench.
- Create an array variable, for example $Sports_team$, using the Text File Assignment option from the Variable Manager.
- Drag the Loop command and select the Times option.
- Press F2 to insert the $ArrayRow$ variable and select the Array Variable as $Sports_team$.
- Create a value variable using the Variable Manager, for example $row$, to iterate through the number of rows.
- In the Loop command, perform these steps:
- Drag the Variable Operation command, select $row$ in the Specify Variable drop-down list, and press F2 to select the $Counter$ variable in Specify value.
- Drag another Loop command and select the Times option.
- Press F2 to insert the $ArrayColumn$ variable and select $Sports_team$ as the Array Variable.
- Drag the Message Box command and press F2 to insert the $Sports_team$ variable.
- In the Array variable dialog box, press F2 to select the $row$ variable in Row Value and the $Counter$ variable in Column Value.
- Click OK to save the values and click Save to save the message.
- Click Run to run the Task Bot.
Using the read from CSV/Excel array variable
- Open the Workbench.
- Create an array variable, for example $Employee_Data$, using the Excel or CSV File Assignment option from the Variable Manager.
- Drag the Loop command and select the Times option.
- Press F2 to insert the $ArrayRow$ variable and select the Array Variable as $Employee_Data$.
- Create a value variable using the Variable Manager, for example $row$, to iterate through the number of rows.
- In the Loop command, perform these steps:
- Drag the Variable Operation command, select $row$ in the Specify Variable drop-down list, and press F2 to select the $Counter$ variable in Specify value.
- Drag another Loop command and select the Times option.
- Press F2 to insert the $ArrayColumn$ variable and select $Employee_Data$ as the Array Variable.
- Drag the Message Box command and press F2 to insert $Employee_Data$ variable.
- In the Array variable dialog box, press F2 to select the $row$ variable in Row Value and the $Counter$ variable in Column Value.
- Click OK to save the values and click Save to save the message.
- Click Run to run the Task Bot.
Using the read from database array variable
- Open the Workbench.
- Create an array variable, for example $Employee_Data$, using the Database Assignment option from the Variable Manager.
- Drag the Loop command and select the Times option.
- Press F2 to insert the $ArrayRow$ variable and select the Array Variable as $Employee_Data$.
- Create a value variable using the Variable Manager, for example $row$, to iterate through the number of rows.
- In the Loop command, perform these steps:
- Drag the Variable Operation command, select $row$ in the Specify Variable drop-down list, and press F2 to select the $Counter$ variable in Specify value.
- Drag another Loop command and select the Times option.
- Press F2 to insert the $ArrayColumn$ variable and select $Employee_Data$ as the Array Variable.
- Drag the Message Box command and press F2 to insert the $Employee_Data$ variable.
- In the Array variable dialog box, press F2 to select the $row$ variable in Row Value and the $Counter$ variable in Column Value.
- Click OK to save the values and click Save to save the message.
- Click Run to run the Task Bot.