justinmind-logo
 
Upvote 2

How to set a variable

Answered Victor Conesa 12 years ago

What is the proper way to set a variable to "blank", if it already contains text, so the following condition will work?


this condition is only working when the variable is initially blank but once I add text and then try to set it to blank, it does not work


2652a21c894170a6d52d19c4dd903fe2

Best Answer
photo

To set a variable's value to blank:

1) Create an event with your trigger (On Click, On Change, etc) and a "Set Value" action, and choose the Variable as the target of the "Set Value" action.

2) For the value of "Set Value" action, leave the field at the bottom of the dialog blank.

474e23ad3162c615daeacf9fb78d31c2


Learn more about variables here.

Replies (6)
photo
1

Create a set value action that changes the variable and leave the value as it is by default. If that doesn't work define a calculated value and drag the 'Aaa' constant as the value for the expression.

photo
1

So I have tried both suggestions and they do not work


It seems that I cannot change the value of the variable while the simulation is running, no matter what I do?


I have also tried running a test by creating an on click event to change the value of a variable and then display the value in a input on the screen but this does not work either while the simulation is running


Any suggestions?

photo
1

That's even weirder. Could you send your prototype to us so we can take a look at it?

photo
1

ok

photo
1

We checked and you defined the wrong expression. To set a value in a variable you have to define this event: on[something] --> set value --> variable --> value is --> 'the value you want in your variable'. So in your case it would be a set value --> variable 'varShowFile' --> value is --> 'no'. But instead of 'no' you have set 'varShowFile = no'. So change that by just 'no'

photo
1

To set a variable's value to blank:

1) Create an event with your trigger (On Click, On Change, etc) and a "Set Value" action, and choose the Variable as the target of the "Set Value" action.

2) For the value of "Set Value" action, leave the field at the bottom of the dialog blank.

474e23ad3162c615daeacf9fb78d31c2


Learn more about variables here.

Leave a Comment
 
Attach a file