Example of using multiple analyze actions in a task

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

  1. Create a bot.
    1. Log in to the Control Room as a Bot Creator.
    2. On the left pane, click Automation.
      A list of available bots and forms is displayed.
    3. Click Create new > Bot.
    4. Click Create and edit.
  2. Open the XYZ sales data.csv file that you created.
    1. Double-click or drag the CSV/TXT > Open action.
    2. In the Session name field, enter Session 1.
    3. Provide the file path to XYZ company sales data.csv.
    4. Select the Contains header option to exclude the first row.
  3. 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.
  4. To retrieve the values in the cells from each row in the XYZ company sales data.csv file, use a Loop action.
    1. Select For each row in CSV/TXT iterator.
    2. In the Session name field, enter Session 1.
    3. In the Assign the current row to this variable field, select the Row variable that you created.
  5. 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
  6. Specify the data to populate on the Bot Insight business dashboard.
    1. 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.
    2. Double-click or drag the String > Assign action.
      Press F2 to open the variables menu.
    3. Choose the Row variable from the drop-down list.
    4. Enter PRODUCTCODE and click Yes, insert.
    5. In the Select destination string variable field, choose the PRODUCTCODE variable.
      To assign string variables for PRODUCTLINE and COUNTRY, repeat Step 6b through Step 6e.
    6. Double-click or drag the Number > Assign action.
      Press F2 to open the variables menu.
    7. Choose the row variable from the drop-down list.
    8. Enter QUANTITYORDERED_QTR1 and click Yes, insert.
    9. In the Select destination string variable field, choose the QUANTITYORDERED_QTR1 variable.
      To assign number variables for SALES_QTR1, QUANTITYORDERED_QTR2, SALES_QTR2, QUANTITYORDERED_QTR3, SALES_QTR3, QUANTITYORDERED_QTR4, and SALES_QTR4, repeat Step 6f through Step 6i.
    10. Double-click or drag the Analyze > Close action.
    11. Enter the Transaction name as Quarters 1 and 2.
    12. Select the following transactional variables in the Close action:
      • PRODUCTCODE
      • PRODUCTLINE
      • COUNTRY
      • QUANTITYORDERED_QTR1
      • SALES_QTR1
      • QUANTITYORDERED_QTR2
      • SALES_QTR2
    13. Double-click or drag the Analyze > Open action.
    14. Double-click or drag the Analyze > Close action.
    15. Enter the Transaction name as Quarters 3 and 4.
    16. Select the following transactional variables in the Close action:
      • PRODUCTCODE
      • PRODUCTLINE
      • COUNTRY
      • QUANTITYORDERED_QTR3
      • SALES_QTR3
      • QUANTITYORDERED_QTR4
      • SALES_QTR4
  7. Click Save and then Run.
  8. Click Analyze Task Bot.

    The Bot Insight business dashboard appears.

  9. Select the Preview option.
    The sales data is displayed as follows:

    Data for quarters 1 and 2

    Data for quarters 3 and 4