Modify a basic bot to process dynamic data

You can modify a Task Bot so it can dynamically process data from a CSV file to complete a web page automation. Reading a CSV file is an example of processing dynamic data. Bots can read files from CSV, text, Microsoft Excel, PDF, SQL database, web pages, and more.

Prerequisites

Open Notepad and enter at least three names with comma-separating values and save it as a .CSV file. Save the file as names.csv.
John,Doe,Example LLC,john.doe@example.com,123-123-1234,john.doe,sample0domain
Karen,Smith,Example LLC,ksmith@example.com,123-321-7654,ksmith,domain123
Mike,Lee,Example LLC,mike-lee@example.com,123-456-7890,mike-lee,domainsample

This task is to understanding the basic bot design. Regardless of which recorder was used, a recorded task is not a complete process. Recorders are a great first step, but bot developers must add business logic and edit recorded commands to ensure proper playback by the Bot Runner.

Complete these tasks to make this Task Bot read data from a file and save the data in a web form. In this task, bot developers perform the following:
  • Create a loop for processing each row in a CSV file.
  • Make each step accept input from a CSV file and write output to the web form.

Procedure

To make the basic Task Bot accept data from a CSV file, perform these steps:

  1. Open the Automation Anywhere Enterprise Client.
  2. Open MyFirstTaskBot.atmx.
    Double-click the task to open it in the Workbench, or right-click and select Edit.
    The Task Bot opens in the Workbench. Each line in the Actions List represents one step that was captured by the Web Recorder.
  3. Click on line 2 in the Actions List and select it.
  4. In the Commands tab on the left, drag the Read From CSV/Text command and drag in the top of line 2 in the Actions List.
  5. In the Read From CSV/Text window, click the ellipsis button at the end of the Select File field.
  6. Locate and select the names.csv file that you created as part of the prerequisites.
  7. Click Open.
  8. Click Save.
    The system also adds the Start Loop and End Loop commands in the Actions List. The green line is a comment added by Automation Anywhere. The comment in the Actions List indicates which system variable gets the information from the file.
  9. Drag the End Loop command to the bottom of the Actions List.
  10. Modify each of the Set text $Filedata Colums$ steps to assign a variable to $Filedata Colums$.
    1. Double-click line 6 after the Comment.
    2. In the Web Recorder window, click Advanced View.
    3. Clear the Text to set field.
    4. Press the F2 key to open the Insert Variable dialog box.
    5. Scroll down to the Filedata Column, select it, and click Insert.
    6. In the window that opens, clear the Column Number / Select Variable field and type 1.
    7. Click OK.
    8. Click Save.
      Repeat steps a through h for lines 7 to line 12. Ensure that you enter the appropriate column number for each line.
      Note: Each line in the names.csv file is equivalent to a step or row. Each step has seven columns, for example:
      • Column 1 = John
      • Column 2 = Doe
      • Column 3 = My company
      • Column 4 = john.doe@mycompany.com
      • Column 5 = 212-555-1212
      • Column 6 = jdoe
      • Column 7 = Developer
  11. At the top of the Workbench window, click Save.
  12. Click Run to test the bot.

Next steps

Build a basic MetaBot to automate input to a web page using the Enterprise Client: In this next task of the series, learn how to create and use a MetaBot to add data to a web form.