Use Case #
The “Compare Variables” condition is a very powerful feature in RTILA , it lets you create a condition case with the RTILA variables , and preform many commands based on whether the conditions is met or not. With the use of this feature you can compare between two variables and check if the a value in variable_1 contains a value on variable_2 or even preform all kinds of possible comparison between variables . It is used to make decisions in the automation and to execute different parts of commands based on the result of the condition .
How To Add & Configure The Compare Variables Condition #
Add #
To use the “Compare Variables Condition” you can add the condition from the condition option of the new command interface . Once you add the condition you can choose what kind of comparison action you would like to preform between the variables
Configure #
- Edit the name of the compare variables condition referring to what variables is compared
- Select the first operand variable that would be compared with
- Choose the condition of the comparison > select on from the 14 possible conditions
- Select the second operand variable that would be compared with
- You can add the automation commands you want to preform in case the condition is met in here
- You can add the automation commands you would like preform in case the condition is NOT met
Condition Types #
- Exists : checks if the first variable exists , then execute commands
- Not Exists : executes commands if the variable doesn’t exist
- Equals (=) : if the first variable value equals the second variable value
- Not equals ( <> or != ) : if the first variable value is not equal to the second variable value
- Greater than ( > ) : if the first variable value is greater than the second variable value
- Greater or equal to ( ≥ ) : if the first variable value is greater than or equals the second variable value
- Smaller than ( < ) : if the first variable value is smaller than the second variable value
- Smaller than or equals( ≤ ) : if the first variable value is smaller than or equals the second variable value
- Contains : if the first variable value contains the second variable value
- Does not contain : if the first variable value doesn’t contain the second variable value
- Starts with : if the first variable value starts with the value of the second variable
- Doesn’t start with : if the first variable value doesn’t start with the value of the second variable
- Ends with : if the first variable value ends with the value of the second variable
- Doesn’t end with : if the first variable value doesn’t end with the value of the second variable
Note : When using the “Exist” and “Not Exist” condition type , you will only need one variable. This variable would be checked whether is exists or not , if it does , then the condition is met and the commands under the “IF CONDITION IS MET ” will run. If not , then you can also run the commands in the “IF CONDITION IS NOT MET ” section . This type works best with the selector variable DOM to check if certain elements exist on a page or not.
Compare Variables Condition In Action #
Two Variable Condition Case Example #
Here is an example of using the compare variables condition in an automation project that has a list variable with list of some of the “URLs in the RTILA website” named (RTILA_URLs_List) and a static variable that has the URL of the ” Docs section ” named (Docs_var) . In this example we used the compare variables condition to check whether the “RTILA_URLs_List” contains the ” Docs_var” .
If the condition is met then > show an alert message that says the condition is met > Go to the docs section using the “Docs var” variable > show another alert message informing that we are currently in the docs section .
If the condition is NOT met then > show an alert message that says the condition is Not met
One Variable Condition Case Example #
Here is another example that uses compare variable condition with the “Exist” condition that only takes one variable .
In this example we are using the “exist” condition to check if an ” H1″ element exist and show an alert message with the content of that H1 element .In case the condition isn’t met and the H1 doesn’t exist then it shows an alert message that says that the H1 is not found in the page.