Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 21

 How to use the last response to a question or a previous survey to direct the current survey

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

 How to only show a question if previous response is a given value

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

Check all that apply:

Dog = 1

Cat = 2

Frog = 3

When the second option is closer, this question will be asked

 How to only trigger an event if a response is a given value

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.

 How to trigger a stage change on multiple 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:
Complex logic: datediff("today",[study_startdate], "d", true,true) >= 1 or [skip_to_next_stage]==1
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.

 How to create a "circular stage" path

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:
last([advance_to_stage_b]) == 1 and 
  (last([return_to_stage_a:0])==0 or 
  datediff(last([advance_to_stage_b_date]),last([return_to_stage_a_date]),"d",true) > 0)
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:
last([return_to_stage_a]) == 1 and 
  datediff(last([return_to_stage_a_date]),last([advance_to_stage_b_date]),"d",true) > 0
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:
last([return_to_stage_a]) == 1 and 
  datediff(last([return_to_stage_a_date]),last([advance_to_stage_b_date]),"d",true) > 0
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.

 Setting and checking the Value for Dropdown and Radio questions

When a question type is Dropdown or Radio, the responder should input a series of Responses. Clicking the Add+ button will add an additional row for a Response and its Value.

The image below shows a Dropdown item that has four Responses, with the assigned values 0, 1, 2, and 12.

The numeric Values of each Response should be carefully set because this data is what will be downloaded in the dataset.

Forth, Values for each Response must be assigned in order for the Responses to be used in Formulas.

The image below shows conditional logic that can be used to skip or ask specific questions based on previous answers in a survey may be presented to the participant, based on the answer provided for the Dropdown Question, Test_Dropdown.

If no formula is added to a question, it will always be asked during that survey.

Adding a Formula for a Question conditions for when that question should be shown.

In this example, the Question Test_Dropdown is shown every time the Assessment is taken. The Question Test_Radio will only be presented during the Assessment if the Response to Test_Dropdown = 12.

Equality operators (>, >=, <, <=) can be used to allow multiple answers to a question to trigger a later question.

Changing [Test_Dropdown]==1 to [Test_Dropdown] >= 1 will trigger the question when the answer to Test_Dropdown = 1, 2, or 12.

 Creating and Using the Random Number Generator

The Random Number Generator Question, requires a minimum and maximum value (Note: the user can also select decimal places for the random number). An example is shown below for a Random Number Generator Question with Minimum value 0, Maximum value 2, and 0 decimal places. This will generate a number that is 0, 1, or 2.

The randomly generated number can be used to drive intervention content.

The Random Number Generator can be added to the Assessment in order. It is possible to have multiple Random Number Generator Questions within a single assessment.

 Checkbox item type

The Checkbox item type is very similar to Dropdown and Radio questions, but more than one answer can be selected. This makes Formula logic slightly different.

Creation of Checkbox questions is similar to Radio and Dropdown Questions (e.g., adding Responses and the associated Values). Formulas that depend on specific answers to check box questions have an additional component. The (N) in the example below represents the Value assigned to a specific response.

[Checkbox_Question_Name(N)] == 1

Example below shows favorite animals.

1 = dog

2 = cat

3 = turtle

If select dog(1)[favorite(1)]=1 then ask text type Follow Up of breed. The “==1” the item was checked; “==0” means unchecked.

  • No labels