Examples

 

Single Value Field (Dropdown, Radio, Slider, etc)

formula example:

The Last Response option is used to pull a participant’s last response to a particular question. This enables researchers to use data from previous surveys to inform algorithms and formulas. See example below.

The example below referencing question “sex” there are two (2) values being shown: 0 = Female, 1 = Male. In this case, the participant has answered this question multiple times. Using the formula “last([sex])” will pull the last response which is one (1) in this case.

last([sex])

Variable: sex

values: [0 = Female, 1 = Male]

Multi Value Field (checkbox)

Not currently supported for last(), will currently match on any prior matching values

 

Instructions:

Click the Assessment tab, select desired assessment, then open the question that needs to be shown or hidden based upon data from a previous survey. In the “Formula” area, add the desired logic, examples are below.

Single Value Field (Dropdown, Radio, Slider, etc)

formula example:
[variablename] == 1

values: [1,3,2]

result: 1

The question will only be asked if the response to this prior question = 1.

Multi Value Field (Checkbox)

formula example:
[variablename(2)] == 1

Instructions:

Select an event, then add a setting and choose branching logic. In the “Formula” area, add the desired logic. This will trigger if any stored data meet the formula conditions.

Instructions:

Click the Events tab, then select a stage, under “type” choose the formula. In the “End Date Formula” field, add the desired logic. This can be simple (e.g., [startstudy]== 1; when the Start Study question is answered yes (1), the app will move to the next stage). This will trigger if any stored data meet the formula conditions, and missing values will default to false (thus not triggering a stage change on those variables).

formula example:
explanation:

This logic will move to the next stage if the participant has been in the study a number of days is > 0.

use the datediff() method to today’s (Note: the today is a variable that is created by the responder or the variable named skip next steps =1) date to the study start date with params set to honor negatives and use local time set to ‘true’, and advance the stage if the days (“d” param) are greater than 1, or if the “skip_to_next_stage” variable is set to 1.

 

Instructions:

To create a circular stage (a stage that can loop back to a previous stage (e.g., Pre-Quit, Post-Quit), add logic to trigger that transition to the “End Date Formula” in Stage. In addition, add a stage setting of “branching logic” type, and add the matching criteria and stage to loop back. The tricky bit is that it will loop directly back if you do not add some logic to the looped stage to prevent that immediate loop.

For a simple example, we’ll have stage A and B.

End Date Formula example for stage A:
explanation:

Check the user selected to advance, then check to make sure that either the user has never selected to go back to stage yet or if they have, that the date they selected for returning is not greater than the selection to advance. This second part will prevent an immediate loop back.

End Date Formula example for stage B:
explanation:

check that the user selected to return, then check to make sure the date of the return selection is greater than the last time the user selected to advance . This second part will prevent an immediate loop back.

Branching logic example for stage B:
explanation:

this will use the exact same logic in this simplistic instance for branching back to stage A, but if there were multiple stages to loop to you would only use the specific logic for looping to that stage. If no branching logic matches, then the next stage in order will start or the study will end.

note:

always add last() for stage change formulas if you are not concerned about checking all prior instances. The default is to check all collected data and this may become slow as the user accumulates more data.