Understanding variables and their functions in ScenarioBuilder

Variables in ScenarioBuilder can store various data types: strings, numbers, dates and times. They can also get their values from external data sources, such as Excel and CSV files. Variables can change their values using the appropriate functions. 

With variables, data input can be varied to emulate real world application usage. Below is detailed information on working with the variables and their functions.

Variables actions

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_58

Set String Variable

Add a string variable to your scenario.

Properties:

Variable Name - Provide a meaningful name to the variable. 

Variable Value - Simply type in your value/text entry or use the pull-down menu to select your pre-defined variable. 

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_6

Note: The value of a variable is set when the set variable action is executed.

Variable Scope - Specify the level at which you want to access your variable. To learn more about variable scope, please refer to this article.

Encrypted - Checking this box will encrypt the variable value for security purposes. This is useful if your variables contain passwords or other sensitive information.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_4

........................................................................................................................................ 

Set Date Variable

Add a date variable to your scenario.

Properties:

Variable Name - Provide a meaningful name to the variable.

Variable Scope - Specify a level at which you want to access your variable. To learn more about variable scope, please refer to this article.

Date Format - Select a Date format.

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_3

Below lists the syntaxes associated with Date format:

 Syntax

 Description

syntax

Variable Value - Provide a value for the variable based on the Date format or your own format using the syntaxes associated with it.

The default value is always based on current date.

Note: The value of a variable is set when the set variable action is executed.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_2

.........................................................................................................................................

Set Time Variable

Add a time variable to your scenario.

Properties:

Variable Name - Provide a meaningful name to the variable.

Variable Scope - Specify a level at which you want to access your variable. To learn more about variable scope, please refer to this article.

Time Format - Select a Time format.

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_4 - 1

Below lists the syntaxes associated with Time format:

syntax_h

Variable Value - Provide a value for the variable based on the Time format or your own format using the syntaxes associated with it.

The default value is always based on current time.

Note: The value of a variable is set when the set variable action is executed.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_5

.........................................................................................................................................

Set Number Variable

Add a number variable to your scenario.

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_6

Properties:

Variable Name - Provide a meaningful name to the variable.

Variable Scope - Specify a level at which you want to access your variable. To learn more about variable scope, please refer to this article.

Variable Value - Enter your variable value or use the pull-down menu to select a random number range [Low-High].

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_14

Note: The value of a variable is set when the set variable action is executed.

Number of Decimals - Specify a number of decimal places that you want to use.

Decimals Separator - Enter a character to separate the integer part from the fractional part of a number written in decimal form. (comma, period, space, etc.) 

By default, ScenarioBuilder uses period (.) character.

Thousands Separator - Enter a character to separate the integer part from the fractional part of a number written in decimal form. (comma, period, space, etc.)

Currency Symbol - Enter a symbol if you want to display numbers as monetary values. The currency symbol appears right next to the first digit. ($)

Negative Symbol - Enter a symbol you want to use for negative numbers. The number can be displayed with parentheses, braces, brackets around it.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_35

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_7

Result:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_36

Functions

ScenarioBuilder offers various functions for variables to help you process information. 

String Functions

ScenarioBuilder has strong text handling capabilities. Read below to understand the string functions that are available for manipulating text strings.

Properties:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_15

Variable Name - Enter the name of the variable you wish to manipulate (the "Set String Variable" action must precede this step, establishing the variable to be used).

Functions

Select a function.

FirstCapital Function: Returns text with the first letter of each word capitalized.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_137

Result:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_21

Split Function: Splits text into a list of values by separating the text at specified delimiter. 

You can get the values out of the list by below syntax:

variable name[index]

The list values' indices start at 1 and increment by 1, so the first value's index is 1, the second value's index is 2, etc.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_144

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_31

Result:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_32

ToLowerCase Function: Returns an expression converted to all lowercase (non-capital) letters.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_139

Result:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_23

ToUpperCase Function: Return an expression converted to all uppercase (capital) letters.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_140

Result:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_25

Trim Function: Removes whitespace or tab character from the beginning and end of the source text value.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_141

Result:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_27

Split Delimiter - Enter an arbitrary delimiter (comma, period, space, pipe, etc.) 

Reg Expression - Use a regular expression to read the execution results. For example, for ping www.automai.com, expression #output# will place what the command returns in the variable output, and expression sent = #sent# will place what is between =space and comma in the SENT variable.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

.........................................................................................................................................

Date Functions

Read below to understand how to use and manipulate values representing dates.

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_16

Variable Name - Enter the name of the variable you wish to manipulate (the "Set Date Variable" action must precede this step, establishing the variable to be used).

Functions

Select a function.

AddDays Function: To add a number of days to a date.

AddMonths Function: To add a number of months to a date.

AddYears Function: To add a number of years to a date.

Format Function: Returns a formatted value as defined by Date format.

LastDayOfTheMonth Function: Returns the last day of a month, considering leap years too.

Example:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_142

Result:

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_143

SubtractDays Function: To subtract a number of days from a date.

SubtractMonths Function: To subtract a number of months from a date.

SubtractYears Function: To subtract a number of years from a date.

Add/Subtract Value -  Enter a value you want to add to or subtract from the variable value.

Date Format - Select a Date format.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

........................................................................................................................................ 

Time Functions

Read below to understand how to use and manipulate values representing times.

Understanding variables and their functions in ScenarioBuilder (360006752873)_Screenshot_30

Variable Name - Enter the name of the variable you wish to manipulate (the "Set Time Variable" action must precede this step, establishing the variable to be used).

Functions

Select a function.

AddHours Function: To add a number of hours to a time.

AddMinutes Function: To add a number of minutes to a time. 

AddSeconds Function: To add a number of seconds to a time.

Format Function: Returns a formatted value as defined by Time format.

SubtractHours Function: To subtract a number of hours from a time.

SubtractMinutes Function: To subtract a number of minutes from a time.

SubtractSeconds Function: To subtract a number of seconds from a time.

Add/Subtract Value - Enter a value you want to add to or subtract from the variable value.

Time Format - Select a Time format.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

------------------------------

Increment A Variable

Use this action when you want to increases a variable value by a specified amount. 

Variable Name: Enter the name of the variable you wish to increment (the “Set A Variable” action must precede this step, establishing the variable to be incremented).

Increment Value: Enter the value that you wish to increment the entered variable by.

-----------------------------

Load An Image Into A Variable

This action is used when setting a previously image within an area as a variable.

Variable Name: This is the variable where the text is stored.

Use Anchor: If enabled, mouse location is relative to the parent Image or Window Action (property is only relevant if the “Mouse Move” Action is a child of either an Image or Window Action).

Image Area: Click the ellipses  to use your mouse to select the area from which to capture text.  Capture only the desired text.  Capturing extraneous data, even pixels from surrounding area, can cause OCR to fail.  Note: the “Start” and “End” Text Area “X” and “Y” property fields will automatically populate after you make your selection.

Start Image Area X: Image search area coordinates upper left corner X

Start Image Area Y: Image search area coordinates upper left corner Y

End Image Area X: Image search area coordinates lower right corner X

End Image Area Y: Image search area coordinates lower right corner Y

Click the 'X' to remove the “Image Area”.

Scenario Section - This is for Global scenarios only. Specify the section name that can be called from other scenarios.

For more about Load An Image Into A Variable action, please check out “Load Image As Variable” in our Video Tutorials series.