Var analysis
The Variable Analysis block provides a mechanism for comparing any variable with any parameters.
The properties of the Variable Analysis block contain fields in which you need to specify the name of the variable, specify possible options for values and/or answers, or a nested object that this variable can accept.
Nested object
The “Nested object” field is used in cases when the analyzed variable contains a data structure from which it is necessary to analyze the value of a specific object (For more information about the nested object, see Variable).
To extract from an array that comes, for example, from an HTTP request (recorded and stored. for example, in the variable var2):
[
{
"name":"Ford",
"val":"John",
"price":"1000",
"cars":[ "Ford", "BMW", "Fiat" ]
},
{
"name": "BMW",
"val":"Jack",
"price":"2000",
"cars":[ "Ford", "BMW", "Fiat" ]
},
{
"name": "Fiat",
"val":"Nik",
"price":"3000",
"cars":[ "Ford", "BMW", "Fiat" ]
}
]
To get cars “BMW”, you need to specify the following in the scenario fields:
var2[0].cars[1]
To do this, you need to specify in the fields:
- Set the variable: var2
- Nested object: [0].cars[1]
Thus, the array element var2[0].cars[1] will be formed.
The value of the variable and the Answer options
In this process, the value of the variable is compared with each of the possible values or answers, for example, such as “1”, “2”, or “3”. These options are set manually by the user, depending on the specifics of the scenario. If the value of the variable matches one of the specified options, the system selects the appropriate branch of the scenario development. For example, if the value of the variable is “1”, the system proceeds to perform the actions provided for this case. Similarly, if the value of the variable is “2” or “3”, the system selects the appropriate branch.
There are also “Default” and “isempty” options, which are also added manually by the user, necessarily in the same form as in the example.
If the value of the variable does not match any of the specified options, the system proceeds to perform the actions provided by the “Default” branch. This allows for reliable handling of cases where the value of a variable differs from the intended options.
You can handle the case when the variable has the value “isempty”, which means that it is empty. In this case, the system checks whether the passed variable is empty, and if so, it proceeds to perform the actions defined for this branch. This allows you to take into account the possibility of getting an empty variable value and process it accordingly.
At the same time, circles (outputs) will appear on the block itself with options for variable values and answer options that you specified in the values. From each of them you will be able to lay a separate branch of the scenario development.