Using Variable Properties

Learn how to use variable properties in your scripts.

The following tutorial guides you through the development of a simple script to demonstrate the use of variable properties. The scripts function is to add a new row to an Excel data table if the amount of rows is less than 10, using the properties of the dataTable variable.

Using variable properties in your scripts

  1. Log in to the IBM RPA Studio.

  2. Click New > Wal File to create a new script.

  3. From the Toolbox, add the Open Excel file (excelopen) command to the script.

    1. Enter the Excel file path in the File path parameter.
    2. Enable the Save changes option.
    3. Type excelInstance in the Excel instance parameter.
  4. Add the Get Excel Table (excelgettable) command.

    1. In the Excel instance parameter, click the folder icon and select the excelInstance variable.
    2. Enable the Use First Spreadsheet and the Get Entire Table parameters.
    3. In the Table output parameter, enter the variable name dataTable.
    4. Click Save.
  5. Add the If (if) command. Note that the End If (endif) command is automatically inserted right after.

    1. In the Left operand parameter, click the folder icon and click the play button icon on the dataTable variable, then double-click the Rows property.
    2. In the Operator parameter, use the dropdown menu to select the Less than option.
    3. In the Right Operator parameter, type 10.
    4. Click Save.

    The variable properties button

  6. Add the Add row (addrow) command between the If and the End if commands.

    1. Click the folder icon of the Data Table parameter and double-click the dataTable variable.
    2. Click Save.
  7. Add the Close Excel file (excelclose) command.

    1. Enter the excelInstance variable in the File parameter.
    2. Enable the Save? parameter and Save.