Build a Bot Insight dashboard bot

In this example, you build a bot that retrieves data from a website to create visualizations in Bot Insight.

Prerequisites

Configure an empty string variable named sNull.

Create a variable

Procedure

  1. Create a new bot:
    1. On the left panel, click Automation.
    2. Click Create new > Bot.
    3. In the Create Task Bot window, enter the bot name.
    4. Accept the default folder location: \Bots\
      To change the default bot storage location, click Choose and follow the prompts.
    5. Click Create and edit.
  2. Open a browser window to the web page from which you want to extract the table.
    1. Double-click or drag the Browser > Launch website action.
    2. In the URL field, enter https://www.statista.com/statistics/183483/ranking-of-languages-spoken-at-home-in-the-us-in-2008/.
    3. Select the Internet Explorer browser.
      Note: Use Microsoft Internet Explorer because it reliably launches the website in a new window, even if another window is already open. Other browsers might launch the website in a new tab if there is an open window.
    4. Click Save.
    5. Click Run.
      The bot opens the window.
  3. Select the table for extraction.
    1. Double-click or drag the Recorder > Capture action.
    2. Click the Window tab and select the Languages spoken in the United States 2018 | Statista window from the drop-down list.
      If the window title does not appear in the list, click Refresh.
    3. Click Capture object.
      The Languages spoken in the United States 2018 | Statista window is activated.
    4. Hover over the table until an orange box that surrounds the entire table appears.
    5. Click the table.
    6. Return to the Control Room.
    7. In the Object properties table, verify the Control Type is TABLE.
      If it is not, click Recapture object.
    8. From the Action drop-down list, select Get table.
    9. In the Assign output to variable field, create the tLanguages table variable.
  4. Specify the file in which to save the data.
    1. Double-click or drag the Data Table > Write to file action.
    2. From the Data table name list, select tLanguages.
    3. Provide a file path to create a CSV file.
      For example, C:\Users\<username>\Desktop\LanguagesTable.csv.
    4. Select the Create folders/files if it doesn't exist option.
    5. Select to overwrite the existing file.
  5. Specify the file that holds the extracted data.
    1. Double-click or drag the CSV/TXT > Open action.
    2. Provide the file path to the file specified in step 4.
    3. Select the Contains header option to exclude the first row.
  6. Iterate though each row of the file.
    1. Double-click or drag the Loop action.
    2. Select the For each row in CSV/TXT iterator.
    3. In the Assign the current row to this variable field, create the variable rCurrentRow.
  7. Specify the data to populate the Bot Insight dashboard.
    1. Double-click or drag the Analyze > Open action.
    2. Double-click or drag the String > Assign action.
    3. Enter $rCurrentRow[0]$ as the source string.
      Press F2 to open the variables menu.
    4. In the Select destination string variable field, create the variable sLanguage.
    5. Double-click or drag the String > Replace action.
      The extracted data uses commas to separate digits. You must remove the commas before you can convert the string to a number data type to use in Bot Insight.
    6. Enter $rCurrentRow[1]$ as the source string.
      Press F2 to open the variables menu.
    7. Enter , in the Find string field.
    8. Select the Not a regular expression option.
    9. In the Replace with field, enter $sNull$.
    10. In the Assign the output row to variable field, create the variable sPopulation.
    11. Double-click or drag the String > To number action.
    12. Enter the $sPopulation$ variable.
    13. In the Assign the output row to variable field, create the variable nPopulation.
    14. Double-click or drag the Analyze > Close action.
    15. Select the following variables:
      • sLanguage
      • nPopulation
  8. Click Save and then Run.
  9. Click Analyze.
    The Bot Insight window appears.

Next steps

Learn more about dashboards.

Bot Insight dashboards