How to re-show information that users have told you

From Lifeguide Wiki
Revision as of 12:53, 19 August 2015 by Judy (talk | contribs)
Jump to navigation Jump to search

Showing users' responses on the same page

The saveandload key command can be used after a page that includes interactions so that if an end-user moves away from that page and then comes back to it, the page will automatically show them what they entered the last time they were on that page. This line of logic would be written as:

show page1

saveandload page1 for username

Any interaction on page1 would then be saved and loaded each time the end-user comes back to that page.

Showing users' responses on a new page

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

First you will need to create a single/multiple-choice/numeric interaction or a text-entry box on a page and give it a unique name. Then in the intervention.lgil file, write the logic to save the goal the response that 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 printed variable. Click here for instructions on how to set text as a printed 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.s1goal to 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 may 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)