How to show a particular intervention page when a specific amount of time has elapsed

From Lifeguide Wiki
Jump to: navigation, search

To show a particular page after a specific amount of time has elapsed, you will need to use the function currenttime().


will give the current time in seconds and you can use it to compare it with another time, such as the time the baseline questions were completed.

Example 1

A simple example of how to use it is give below:

after login2 if currenttime() >= +(loadvalue(username, "baselinetime"), (600)) goto page1

The above example will show page1 if it has been 10 minutes or more since the baselinetime was saved (>= mean more than or equal to; 600 means 600 seconds which is equivalent to 10 minutes). N.B. baselinetime would have been saved in the logic previously using the function savevalue when the last page of the baseline questions was completed.

Example 2

To show a page 10 minutes after the baseline questions have been completed, but within 60 minutes of them being completed, you can use the following logic:

after login2 if (and(... currenttime() >= +(loadvalue(username, "baselinetime"), (600)),... currenttime() < +(loadvalue(username, "baselinetime"), (3600)),... )) goto page1 .

This example will show page1 if it is has been between 10 minutes (600 seconds) and 60 minutes(3600 seconds) since the baselinetime was saved.

N.B. The ...' simply indicates the end of a line. You do not have to use these, but it makes it easier to read if you do use them. Without them, the line would look like this:

after login2 if (and(currenttime() >= +(loadvalue(username, "baselinetime"), (600)),currenttime() < +(loadvalue(username, "baselinetime"), (3600)))) goto page1