Example of using Split action

In this example, you will build a bot to read a CSV file, split a specified string into multiple strings.

Prerequisites

Before you start building the bot, create a file in .CSV format using the data in the following table and save it as String_datatable.csv
Name Location Joining date
Savio Bangalore 26-Jun-21
Rene Bangalore 15-Oct-21

Procedure

  1. Create a bot.
    1. On the left panel, click Automation.

      A list of available bots and forms is displayed.

    2. Click Create a bot.
    3. Enter the bot name: String_split.
    4. Click Create and Edit.
  2. Open and read data from the CSV file.
    1. Double-click or drag the Excel advanced > Open action.
    2. From the File option, in the Desktop file field, click Browse to select your file.
    3. Select the Sheet contains a header checkbox.
    4. Open the file in Read-write mode.
    5. In the Create Excel session field, select Local session.
    6. Double-click or drag the Excel advanced > Read row action.
    7. From the Cell option tab, select From specific cell and enter C2 in the Cell address field.
    8. From the Read option tab, select Read visible text in cell option.
    9. In the Session name field, enter the session that you used to open the file.
    10. In the Assign value to the variable field, click the Create variable icon to create a variable.
    11. On the Create variable window, enter list_outputdata in the Name field.
    12. Click Create and select.
    13. Double-click or drag the Excel advanced > Close action to close the .txt file.
    14. In the Session name field, enter the session name that you used in the Open action to open the file.
  3. To print the values of the specified row, double-click or drag the Message box action. In the Enter the message to display field, enter $list_outputdata[0]$.

    When you run the bot, the bot displays the string in row C2 as 26-Jun-21.Read the data from the specific row

  4. To split the specified string into multiple strings, double-click or drag the String > Split action.
    1. In the Source string field, enter $list_outputdata[0]$
    2. In the Delimiter field, enter -.
    3. From the Delimiter is tab, select Not case sensitive.
    4. From the Split into substrings tab, select All possible
    5. In the Assign value to the variable field, click the Create variable icon to create a variable.
    6. On the Create variable window, enter substrings_split in the Name field.
    7. Click Create and select.
  5. To print the values, double-click or drag the Message box action. In the Enter the message to display field, enter the following data:

    Date is $substrings_split[0]$

    Month is $substrings_split[1]$

    Year is $substrings_split[2]$

  6. Click Save and then Run.

    The bot splits the specified string into multiple substrings and displays the output as follows:

    Split the specified string into substrings