Forum Discussion
Keep variable changes
Hi, can a variable change be kept in another variable after changing it? For example, we have:
Text variable "a", Text variable "b". Now, variable a will change (newly added text). The action is to assign variable "b" with "a", so variable "b" contains the variable's contents. I clear variable "a" - value empty. Is it possible to keep the text in variable "b" when a changes? When var. "a" changes, "b" also changes the content.
I appreciate your help.
- MathNotermans-9Community Member
For sure, yes. As all triggers act sequentially, use that. Set var b to the value of a. Only then change A.
- PiotrBurchart-dCommunity Member
Hi,
No, it is not working. When the first original variable changes, then 2nd will also change.
For example, Variable A is connected to the text entry box; we can type "abcd" and press the submit button to assign a text entry to variable A. From now value of variable A is "abcd",
Next, I assigned variable B with A when variable A change. Everything is ok.
The problem started when I assigned variable A to the value "blank", and then variable B is also blank.
PS: I have to assign A with a blank value. - AndrewHanleyCommunity Member
Hi Piotr,
The problem here is that you are using the WHEN VARIABLE CHANGES trigger. That means every single time Var A updates to a new value, Var B automatically will.
If you remove this WHEN VARIABLE CHANGES then you can control when Var B will take the value of Var A.
In other words, you can change Var A as many times as you like, and it will only change Var B when you use a trigger to tell it to change.
Does that help at all?
- PiotrBurchart-dCommunity Member
- AndrewHanleyCommunity Member
Im not sure I understand Piotr, sorry.
What you have written above is a little unclear, but sounds like it should work ok.
The trigger in your screenshot is perfect...
if Count=1 when that slide is first loaded, then the variable RESPOND1 will be set to whatever value the variable AI_RESPONSE holds at that time.
That sounds fine.And the client request to clear both variables needs just two triggers:
ADJUST VARIABLE "Respond1" TO VALUE <blank> WHEN USER CLICKS "clear button"
ADJUST VARIABLE "AI_Response" TO VALUE <blank> WHEN USER CLICKS "clear button" - PiotrBurchart-dCommunity Member