I am a reasonably novice user but getting more and more adventurous with my rules. I have come across a requirement today that I am certain you should be able to do but I can't seem to make it work.
What I am trying to achieve is to set a value of a variable to the value of another variable for comparison later in the rule. I have put local and global in parentheses in the subject for context to my particular solution but I am working on the basis that it probably shouldn't matter.
How do I set a variable to the value of another variable (in this case booleans) without using conditional logic of 'if variable 1 is true then set variable 2 to true else set variable 2 to false'? I want to do a simple 'Set variable 1 equal to variable 2'
Then pick the variable you want to set. Then under “Select operation”, you pick “Variable”, and then pick the variable you want to set the first one to.
Thanks for the response. I can create variables but what I am struggling with is setting the value of variable 1 to be the value of variable 2. The variable in question is a boolean and I have the option to set it to true, false, comparison or logical. I can't see anywhere to set it to the equivalent of another variable. Having done some testing it is clear that the different variable types elicit different options so maybe this is because it is a boolean variable.
Yes, there is no direct assignment of one Boolean variable to another. You could get that result by setting one to a logical expression of the other OR the other. That's a kludge for sure. I will look into adding direct set as an option.
This has been implemented, and will be in an upcoming release:
Not sure if this changed recently.
I need to set the local variable I created oldState to the value of state another local variable.
To be able to do this with the new Rule Machine I have to do this:
Oh sorry, I may misunderstood this in the previous responses.
Then select "Set Variable
Then pick the variable you want to set. Then under “Select operation”, you pick “Variable”, and then pick the variable you want to set the first one to.