Skip to main content
Version: 10.2.9

Split data between Bot Tasks

info

The information in the article relates to the low-code approach of creating AI Agents using Work.AI Developer.

Sometimes, you need to split data in the middle of a Business Process (BP).

  • One of the Bot Tasks in a BP generates data stored in the list (table), and the next Bot Task needs to be executed for each record in the list (table). Users cannot provide the data records as a CSV input data file as they are received during the BP execution and are not available before the BP starts.
  • One or several Bot Tasks must be executed only once in a BP, while other tasks must run for each data record. Users cannot provide several records in a CSV input data file, as some tasks need to be executed only once.

The solution is to split data in the middle of BP using a special Bot Form (ETL task) "Test split bot etl". It allows to:

  • Execute certain steps for each data record without using the For Each loop in the recording.
  • Run these steps in parallel on several nodes (desktops) without providing records in the input file.

Thus, you combine the benefits of the two approaches of implementing loops in Control Tower.

The diagram below shows a BP sample workflow using a task to split data in the middle of the BP so that the last step can be executed by several bots in parallel.

The guide below demonstrates how to use a Bot Task in a BP based on two simple use cases:

Split list variable

Description

There is a list of emails stored in an Excel file. The bot must retrieve the emails and send the same message to all recipients.

Downloadable materials

You can download the archive with the source materials to see how the Data split Bot Task works in practice.

The archive contains:

  • Two recordings made
  • A BP package
  • A CSV input data file for the BP
note

You need to provide the Excel file with email addresses and specify the file path in the input data file for the BP to work correctly.

The BP consists of two Bot Tasks implemented in Recorder:

  • Bot Task 1 gets the emails from the Excel file and saves them in a List variable.

  • Bot Task 2 sends a message to the email address received in the Bot Task.

Implementation

To implement the workflow, split the data stored in the emails variable after Bot Task 1 into several records before the second step is performed, so that it can be executed in parallel on all available nodes.

After publishing both Bot Tasks (recordings) to Control Tower, do as follows:

  1. Create a new BP and add both Bot Tasks to the workflow.

  2. Find the Test split data etl task on the right panel on the Workflow tab. Click Copy.

  3. Rename and save the task.

  4. Add the task to the workflow before the Sending-emails step.

  5. Double-click the ETL task, specify the variable to split, select the List type, and specify the variable to save the split data to.

  6. Save the task.

Result

There are 14 email addresses in the Excel file. Thus, Bot Task 1 is executed once, while Bot Task 2 is executed 14 times (once for each email address) in parallel, significantly speeding up the BP execution.

Split table variable

Description

A table with new employees' details is stored in an Excel file. The bot must retrieve the contact details and fill in an online form for each employee.

Downloadable materials

You can download the archive with the source materials to see how the Data split Bot Task works in practice.

The archive contains:

  • Two recordings made
  • A BP package
  • A CSV input data file for the BP
  • An Excel file with sample data
note

You need to specify the file path in the input data file for the BP to work correctly.

The BP consists of two Bot Tasks implemented in Recorder.

  • Bot Task 1 gets the employee details from an Excel file and saves them in a Table variable.

  • Bot Task 2 fills in a web form with information about each employee (each row in the table).

Implementation

To implement the workflow, split the data stored in the employees table after Bot Task 1 into separate lists (rows containing the employee information) before the second step is performed so that it can be executed in parallel on all available nodes.

To do it, add the ETL task to the workflow as described above.

Configure the Data split task as follows:

  1. Specify the variables to split and save the data to.

  2. Set the Table type.

  3. Select whether to split data by rows or by columns. The information about each employee is contained in a separate row in the file, so select the Row option.

Result

There are 50 rows in the Excel file. Thus, Bot Task 1 is executed once, while Bot Task 2 is executed 50 times (once for each row) in parallel.