How to re-show information that users have told you

From Lifeguide Wiki
Jump to navigation Jump to search

An example of this would be to re-show a goal that an end-user has entered in a previous session so that they can say whether they achieved it.

Free-entry text boxes

First you will need to create a text box on a page and give it a unique name. Then in the intervention.lgil file write the logic to save the goal that end-users will enter:

show session1page1

savevalue(username, "goal1", session1page1.interaction1)

The logic above is saving interaction1 on page1 as a variable called goal1

To show the goal on a page in a different session, you will need to create a new page, insert a text box and set the text as a variable. Click here for instructions on how to set a text as a variable

Once you have set the text as a variable, you will need to add the following logic to the intervention.lgil file,:

show page2 set session2page1.s1goalto loadvalue(username,"goal1")

The above logic will load the goal that was saved as goal1 previously in the logic, into the text box with the variable name s1goal on page10.

If you are displaying this goal with other goals as feedback, please note there are a few extra steps: 1) You will need to use a container on page10. Click here for information on how to use containers on pages. 2) The text that you have just set as a variable will need to be set to feedback. First, click on the text box. Under Textbox properties scroll down to the end and select Feedback. Enter a unique name (e.g. goal_one) 3) You will need an extra line of logic telling the goal to show only if a goal has been previously entered by an end-user:

show page10.goal_one if (not(isempty (loadvalue(username,"goal1"))))

This logic will show the feedback item called goal_one on page10 if goal1 is not empty (i.e. if an end-user entered a goal which was saved as goal1)