Example of using multiple analyze actions in a task
- Updated: 2023/01/31
Build a bot that uses multiple Open and Close Analyze actions in a task to analyze and compare the sales data for each quarter of XYZ Company, and create visualizations in Bot Insight.
Prerequisites
Before you start building the bot, create the following data set on
your desktop in the .csv file format.
PRODUCTCODE | PRODUCTLINE | COUNTRY | QUANTITY ORDERED QTR1 | SALES_QTR1 | QUANTITY ORDERED QTR2 | SALES_QTR2 | QUANTITY ORDERED QTR3 | SALES_QTR3 | QUANTITY ORDERED QTR4 | SALES_QTR4 |
---|---|---|---|---|---|---|---|---|---|---|
S18_1367 | Vintage Cars | USA | 39 | 4808.31 | 21 | 2856 | 50 | 5907.5 | 48 | 4389.12 |
S18_1367 | Vintage Cars | Germany | 33 | 3288.78 | 42 | 2262.96 | 30 | 1746.6 | 25 | 2183.25 |
S18_1367 | Vintage Cars | France | 41 | 2055.74 | 42 | 4431.84 | 34 | 5375.4 | 45 | 2304.45 |
S18_1367 | Vintage Cars | Australia | 48 | 2354.88 | 33 | 3423.75 | 24 | 1496.64 | 32 | 1742.4 |
S18_1367 | Vintage Cars | UK | 30 | 5151 | 36 | 3081.24 | 33 | 4950.33 | 29 | 5176.5 |
S18_1367 | Vintage Cars | India | 50 | 3390 | 45 | 1702.8 | 23 | 4230.62 | 44 | 7554.8 |
S18_1367 | Vintage Cars | Japan | 28 | 1801.24 | 22 | 995.5 | 47 | 6034.33 | 33 | 5890.5 |
S18_1367 | Vintage Cars | New Zealand | 43 | 4818.15 | 29 | 1716.22 | 42 | 3958.5 | 27 | 1879.74 |
S18_1367 | Vintage Cars | Norway | 39 | 4178.85 | 46 | 1528.58 | 34 | 3455.76 | 38 | 2323.7 |
S18_1367 | Vintage Cars | Sweden | 22 | 1903.22 | - | - | 24 | 1685.28 | 23 | 1643.12 |
S18_1367 | Vintage Cars | Spain | 50 | 2490.5 | - | - | 29 | 1254.83 | 38 | 4299.7 |
S18_1367 | Vintage Cars | Canada | 49 | 1689.03 | - | - | 36 | 1194.84 | 20 | 2212 |
S18_1367 | Vintage Cars | Austria | 26 | 2253.68 | - | - | 49 | 2414.72 | 26 | 3206.32 |
Procedure
-
Create a bot.
- Log in to the Control Room as a Bot Creator.
-
On the left pane, click Automation.
A list of available bots and forms is displayed.
- Click Create new > Bot.
- Click Create and edit.
-
Open the XYZ sales data.csv file that you created.
- Double-click or drag the CSV/TXT > Open action.
- In the Session name field, enter Session 1.
- Provide the file path to XYZ company sales data.csv.
- Select the Contains header option to exclude the first row.
-
Create a Record variable as
Row
by using the Create variable icon.The Record variable holds all the values for one row. With each iteration of the loop, the bot retrieves the values of the next row and stores them in the Record variable, overwriting the values from the previous row. -
To retrieve the values in the cells from each row in the XYZ company
sales data.csv file, use a Loop
action.
- Select For each row in CSV/TXT iterator.
- In the Session name field, enter Session 1.
-
In the Assign the current row to this variable
field, select the
Row
variable that you created.
-
Create the following variables for four quarters by using the Create
variable icon at the top of the Variables
menu.
-
PRODUCTCODE
-
PRODUCTLINE
-
COUNTRY
-
QUANTITYORDERED_QTR1
-
SALES_QTR1
-
QUANTITYORDERED_QTR2
-
SALES_QTR2
-
QUANTITYORDERED_QTR3
-
SALES_QTR3
-
QUANTITYORDERED_QTR4
-
SALES_QTR4
-
-
Specify the data to populate on the Bot Insight business
dashboard.
-
Double-click or drag the Analyze > Open
action.
Note: Ensure that you insert the Analyze Open and Close actions inside the Loop action to analyze and capture the data from each row in the Bot Insight dashboard.
-
Double-click or drag the String > Assign
action.
Press F2 to open the variables menu.
-
Choose the
Row
variable from the drop-down list. - Enter PRODUCTCODE and click Yes, insert.
-
In the Select destination string variable field,
choose the
PRODUCTCODE
variable. -
Double-click or drag the Number > Assign
action.
Press F2 to open the variables menu.
-
Choose the
row
variable from the drop-down list. - Enter QUANTITYORDERED_QTR1 and click Yes, insert.
-
In the Select destination string variable field,
choose the
QUANTITYORDERED_QTR1
variable. - Double-click or drag the Analyze > Close action.
- Enter the Transaction name as Quarters 1 and 2.
-
Select the following transactional variables in the
Close
action:
-
PRODUCTCODE
-
PRODUCTLINE
-
COUNTRY
-
QUANTITYORDERED_QTR1
-
SALES_QTR1
-
QUANTITYORDERED_QTR2
-
SALES_QTR2
-
- Double-click or drag the Analyze > Open action.
- Double-click or drag the Analyze > Close action.
- Enter the Transaction name as Quarters 3 and 4.
-
Select the following transactional variables in the
Close
action:
-
PRODUCTCODE
-
PRODUCTLINE
-
COUNTRY
-
QUANTITYORDERED_QTR3
-
SALES_QTR3
-
QUANTITYORDERED_QTR4
-
SALES_QTR4
-
-
Double-click or drag the Analyze > Open
action.
- Click Save and then Run.
-
Click Analyze Task Bot.
The Bot Insight business dashboard appears.
-
Select the Preview option.
The sales data is displayed as follows: