Variables

Robert Brown shared this question 3 years ago
Answered

Incrementing a Variable.


I know how to do this however I cannot save the expression I have built. Basically I want to increment a usage counter and then randomly show a pop-up.


I have created an interaction (on load) which set's the value of a variable + 1. I cannot save it because it displays an error saying I need an element that contains values.


Does this mean I have to store the value of variable to a hidden text box or label? I don't want to show the value. It will be used behind the scenes.


Any ideas please?

Comments (3)

photo
1

Hello Robert,


You can store the variable in a label and have the label hidden so it does not show during simulation. To do so, simply select the label and enable the hidden component option in the properties panel. If the variable will always have the same start value, you can set the default value by double clicking on the variable in the variables panel instead of using a hidden label.


Best,


Luisa

photo
1

Hi Lusia


I have the label which is hidden


I have create a page load event and setvalue on a variable:


usagecount + 1


I have tried usagecount = usagecount + 1 but this doesn't work.


I want to count the number of times the page is used.

photo
1

It doesn't seem to retain the value moving to different pages.