Global variable in numeric format
-
I would like an explanation of how I can define a global variable in numeric format.
Scenario 1:
- Create a global variable in Expressions > Add Expression > variable name > set initial value = 0 (number zero)
- When entering Rule Sets > Triggers > Variable Value, the variable created appears to be selected and used in the rule
- However, in Set Reaction > Set Variable, this variable that was created with a numeric value does not appear, so we cannot change the value.
Scenario 2:
- Create a global variable in Expressions > Add Expression > variable name > DO NOT SET VALUE, leave as null
- When to go into Rule Sets > Triggers > Variable Value, the variable created appears to be selected and used in the rule, of course, because it has no value yet it is set to zero
- In Set Reaction > Set Variable, this variable appears, and we can define a content, that even if it is a number, it will be stored as a character
To summarize, for scenario 1, I can't find a way to handle the value. For scenario 2, it works, but I can't use it if I want to use the variable for mathematical operations.
A little help from the community.
I use MSR 21153.
Thanks
-
Scenario 1 if you delete the varset rule and tehn the global varible disappears from the drop down list, If you delete the global var and then re-add it it appears back in list for set variable.. This seems to be a bug
I can not see the issue in scenario 2 as i can make calculations and get them as integers.
-
I would like an explanation of how I can define a global variable in numeric format.
Scenario 1:
- Create a global variable in Expressions > Add Expression > variable name > set initial value = 0 (number zero)
- When entering Rule Sets > Triggers > Variable Value, the variable created appears to be selected and used in the rule
- However, in Set Reaction > Set Variable, this variable that was created with a numeric value does not appear, so we cannot change the value.
Scenario 2:
- Create a global variable in Expressions > Add Expression > variable name > DO NOT SET VALUE, leave as null
- When to go into Rule Sets > Triggers > Variable Value, the variable created appears to be selected and used in the rule, of course, because it has no value yet it is set to zero
- In Set Reaction > Set Variable, this variable appears, and we can define a content, that even if it is a number, it will be stored as a character
To summarize, for scenario 1, I can't find a way to handle the value. For scenario 2, it works, but I can't use it if I want to use the variable for mathematical operations.
A little help from the community.
I use MSR 21153.
Thanks
@wmarcolin said in Global variable in numeric format:
However, in Set Reaction > Set Variable, this variable that was created with a numeric value does not appear, so we cannot change the value.
You cannot Set Variable on a variable that has an expression. Expression-driven variables can only have expression results.
@wmarcolin said in Global variable in numeric format:
In Set Reaction > Set Variable, this variable appears, and we can define a content, that even if it is a number, it will be stored as a character
If you supply a constant as the value for Set Variable, it will always be a string. To assign a number or any other type, use an expression:
- Set Variable
testval
=${{ 0 }}
— results in assignment of the number zero to the variable. - Set Variable
testval
=${{ null }}
— set the special value null on the variable. - Set Variable
testval
=${{ ["fish","dog","cat"] }}
— the variable gets an array
Whatever the result datatype of the expression in
${{ }}
will be the data type assigned to the variable. -
Teacher @toggledbits , thanks for the lesson, problem solved.
-
T toggledbits locked this topic on