Skip to end of metadata
Go to start of metadata


RPA Recorder variables are used to store initial or runtime values that a Bot can:

  • enter from keyboard
  • copy to/from clipboard
  • set from a variable defined in Actions
  • get as an operation result (image found or not – true or false)
  • compare in conditions (if ${my_variable} > 5 )
  • get as current list/table item in For Each loop
  • export as results and pass them to next process steps in WorkFusion Server

Defining Variables

All the variables are defined in the Recorder Variables panel by clicking the  icon. To add a variable, enter the following values: Name, Type, and Default Value.

  • Name – use alphabetic characters in lower case, numeric symbols and the underscore only. All other characters, such as letters in upper case and special symbols, are not supported.

    Attention

    On entering the characters that are not supported, they are highlighted with red.

    The are some specific words that cannot be used as recorder variables names. To view them, refer to List of Reserved Words.

  • Type – define the value format that is needed for correct comparison (e.g. in the If-Else action) and parsing (e.g. parse clipboard content to a table).

    Simple Types

    Simple variable types consist of one value with a special format:

    TypeExample ValueNotes
    StringJohn DoeText should conform to the following patterns: string length, alpha, numeric, alpha-numeric.
    Number100402.55Number should conform to the following patterns: range, integer, decimal.
    Boolean

    true, false

    Selection is made in Default Value.

    DateTime2019-Jan-09 02:34:57 (Europe/Minsk)

    The value is populated with the current date and time automatically. To manually set up, click on Default Value, select the date and time you need, and click OK.

    Attention

    The date and time formats for DateTime variables are defined in the regional settings of the operating system.

    Secret?.?

    A variable of Secret type is either selected from the list of Secret Entries previously added in Secrets Vault or created directly in the Default Value field via Add Secret Entry.

    Complex Types

    Complex variable types consist of multiple values, each of String type. These are List and Table.

    Lists and tables are needed when you want to do the same set of actions for all their items (rows or columns), e.g., send email for each person in the email list, input account number and amount for each transaction in a table, etc.

    TypeExample ValuesString RepresentationNotes
    List

    ['Hydrogen', 'Helium', 'Lithium']

    List should conform to the following patterns: length, character set: content of table.

    A List variable can have up to 2,147,483,647 elements.

    Table

    [['Afghanistan', 'Afghani', 'AFN'], ['Albania', 'Lek', 'ALL'], ['Algeria', 'Algerian Dinar', 'DZD']]

    Table should conform to the following patterns: rows, columns, character set: content of table.

    A Table variable can have any number of elements but is restricted to the memory that you allocate to WorkFusion Studio.

  • Default Value – the variable value.

    Comparing and assigning values of different types may result in exceptions or false results. For example, comparing String with Number.

List of Reserved Words

The following reserved words cannot be used as recorder variable names, and thus turn red if entered into the Name field.

  • __botExecutionConfig__
  • __sys_execution_finish_listeners__
  • applicationContextPath
  • applicationHost
  • assignment
  • automationAppUrl
  • automationPassword
  • applicationResourceUrl
  • automationUser
  • dataStoreProperties
  • exportResult
  • formBasedAuthSessionTtl
  • hit_submission_data_item
  • includedConfigs
  • item
  • machineConfigText
  • machineWorkerPrefix
  • ocrProperties
  • pluginsExecutionRecords
  • poolableObject
  • prevData
  • recorder_
  • recorder_.
  • recorderImagesBucket
  • releaseDate
  • restFormAuthEnable
  • s3AccessKey
  • s3EndpointUrl
  • s3KeyMap
  • s3SecretKey
  • s3SignerType
  • securityProviderMap
  • seleniumServer
  • sysOcrApiUrl
  • source
  • tableauDbPassword
  • tableauDbUrl
  • tableauDbUser
  • title
  • TOWER_BOT_
  • userInternalCredentials
  • wfbiPassword
  • wfbiUrl
  • wfbiUser
  • workfusionAccessKey
  • workfusionSecretKey

The words below are Groovy language keywords that also cannot be used as names for recorder variables.

Even if you are able to define Groovy keywords as names in WorkFusion Studio, a script will fail in case you publish it to Control Tower.

  • as
  • assert
  • break
  • case
  • catch
  • class
  • const
  • continue
  • def
  • default
  • do
  • else
  • enum
  • eturn
  • extends
  • false
  • finally
  • for
  • goto
  • if
  • implements
  • import
  • in
  • instanceof
  • interface
  • log
  • new
  • null
  • package
  • super
  • switch
  • this
  • throw
  • throws
  • trait
  • true
  • try
  • while

Using Variables

Setting Action Parameters

After you've created and defined variables, you can use them in action parameters (Enter KeystrokesClipboardIf-ElseLaunch Application and others). 

Start typing a variable name and select an appropriate item or click Enter.

RPA Recorder automatically wraps the variable name with ${} symbols.

If you delete any of the wrapping symbols or modify the variable name to a non-existing one, the whole expression will be treated as a string.

You can use the Recorder variables in the free text fields such as:

  • path to an application
  • path to a file
  • web element

Attention!

The autocomplete function is not available for free text fields, so you should take care to enter the variable name correctly in the defined format.

Variable syntax in action parameters
${variable_name}

When running a recording, Bot substitutes all variables with their respective values and performs comparisons, calculations, parsing, and other operations defined in Actions Flow.

Parsing Lists and Tables

When using variables in actions that require types conversion (e.g. Clipboard – from List or Table to String and vice versa), you need to perform the following actions.

  1. Enter Row Separator.
  2. Enter Column Separator.
  3. Enter Surrounding symbols for column data.
  4. Enable/disable Trimming that refers to removing leading and trailing spaces.
  5. To test the conversion, click Test settings and paste your list or table content there.
  6. Enter other separators if needed.

Getting Value from Lists and Tables

A value of each list or table element can be retrieved using the element's index.

The indexes can be defined explicitly, as an Integer:

  • ${list_variable[1]}
  • ${table_variable.get(1,2)}

or declared as a Recorder variable of Number type:

  • ${list_variable[index]}
  • ${table_variable.get(row_index,column_index)}, where indexrow_index and column_index are Recorder variables of Number type.

Note

Numbering of elements in the List variables starts with 1.

Numbering of rows and columns in the Table variables starts with 1.

Using Indexes with Lists

Recorder VariablesExpression

product_list – List variable

5 – numeric constant (5th element in the List)

${product_list[5]}

my_list – List variable

counter – Number variable

${my_list[counter]}

list_input – List variable

iteration – Number variable

${list_input[iteration as Integer]}


 Sample recording

The sample recording below demonstrates how to get values from elements in a List variable. We will create a short recording to go through the whole list, get values from all elements, and populate them in Notepad (except the last one).

#StepActions
1

Create Recorder variables.

  • counter – a Number variable to iterate through the elements by indexes
  • my_list – a List variable
  • list_element – a String variable to receive a value from a List element
  • list_size – a Number variable to receive a number of elements from the list
  • elements_to_type – a Number variable to receive the number of list elements to populate in Notepad

2

Open Notepad.

Open Notepad with the Launch Application action to paste values from the list.
3

Get Size of the list.

Use the Expression Value action to get the number of elements in the list.

  1. Select the List variable (my_list) to get the number of elements.
  2. Use the Get size option in the Expression.
  3. Select the Number variable (list_size) to save the result.

4

Define the number of elements to print (all except the last one).


In the Expression Value action, define the number of elements to be printed to Notepad all elements minus 1.

  1. Define the expression as ${list_size} - 1, to prevent printing the last element.
  2. Select the Number variable (elements_to_type) to save the result.

5

Create a loop to iterate through the list.

Use the While loop until the counter is less than size of the list:

${counter} < ${list_size}

Important note

Iteration starts from 1 as for any other array.

6

Get value from element.

Create a Constant Value action.

  1. Use the following construct to get value from a list element: ${my_list[counter]}, where
    1. my_list[1] – an element from the list with index 1
    2. counter – Recorder variable defining the index of the element
  2. Select the String variable (list_element) to save the result.

7Paste the value to Notepad.

Use the Enter Keystrokes action to paste the value from the String variable (list_element_value) to Notepad.

8

Condition to insert the linefeed character.

Use the If-Else condition to perform the nested action.

9

Insert the linefeed character.

If the condition is true , insert the Enter character to Notepad with the Enter Keystrokes action.
10

Increment the counter.

Use the Expression Value action to increment the counter to 1.

  1. Define the expression as ${counter}+1.
  2. Select the Number variable (counter) to save the incremented value.

The recording was made with RPA Express 2.0.1.

You can download sample recording for further tests.

Using Indexes with Tables

WorkFusion RPA API has several methods that allow retrieving values from rows, columns, and cells in a Table variable using indexes.

It helps to avoid using multiple For Each Loop actions to iterate through the whole table. Users can access the values in the required elements in the Table directly, thus making the script easier and faster.

Recorder VariablesExpression

product_table – Table variable

3,4 – numeric constants (4th element in the 3rd row in the Table)

${product_table.get(3,4)}

Output: String

my_table – Table variable

row_counter, column_counter – Number variables

${my_table.get(row_counter,column_counter)}

Output: String

table_input – Table variable

row_number – Number variable

${table_input.getRow(row_number)}

Output: List

table_values – Table variable

column_number – Number variable

${table_values.getColumn(column_number)}

Output: List


 Sample recording

A recording below shows how to get two values from a Table and type text with them in Notepad.

#StepActions
1

Create Recorder variables.

  • my_table – a Table variable
  • row_index, column_index – Number variables used to define the coordinates of the value in the Table
  • fruit, day – String variables to receive a value from Table elements

2

Open Notepad.

Open Notepad with the Launch Application action.
3

Get element's value from the Table.

Use the Constant Value action to get the value of an element in the Table.

  1. Select the String variable (fruit) to save the value of the target element.
  2. Use the get() method to get the value of the element.
  3. Define the row and column of the element using Integer values:
    1. (1,2)– row 1, column 2
  4. Write the expression to get the element value in the Set value field: ${my_table(1,2)}.

4

Get another element's value from the Table.


Use the Constant Value action to get the value of another element in the Table.

  1. Select the String variable (day) to save the value of the target element.
  2. Use the get() method to get the value of the element.
  3. Define the row and column of the element using recorder variables of type Number (row_index,column_index).
  4. Write the expression to get the element value in the Set value field: ${my_table(row_index,column_index)}.

5

Type text that contains both values to Notepad

Use the Enter Keystrokes action to type text containing values in variables ${fruit} and ${day} to Notepad.


It is possible to use expressions directly in the Enter Keystrokes action.

The recording was made with RPA Express 2.1.3.

You can download sample recording for further tests.

Variables Log

Upon execution of a recording or several steps of the recording, a log file is created in the Recording folder.

The log file contains the values of all Recorder variables after the last step.

Importing / Exporting Variables

When importing a bot step from a business process to RPA Recorder, all its input data is accessible in Recorder Variables view.

All RPA Recorder variables are exported together with the recording and are available in the Control Tower business process.

  • No labels