Panel | ||
---|---|---|
| ||
Average |
...
DateDiff('yesterday', ‘now', 'm')
This calculates the total minutes between yesterdays date and the date and time right now.
If the yesterdays’ date is 07/10/2023 and we are evaluating this function at 07/11/2023 at 4:07pm then the result should be about: -2407.5039294216667
Using DateDiff to change stages:
When do I use DateDiff to change stages?
You can use DateDiff when you want to change to the next stage after a certain amount of time has elapsed since a date question has been answered.
The following scenario can be interpreted as such:
Stage Name | Question Name | Question Type | Question Text | Response |
---|---|---|---|---|
StartStudy | nextstage | Radio | Would you like to start the study? | Yes = 1 |
Baseline | pmpiq23 | Radio | I like that nobody can tell when I am using a mobile phone intervention. | Strongly disagree = 1 |
Baseline | study_startdate | Date | Please select today’s date… | PT enters date on phone: |
The Formula Based “StartStudy” stage contains an assessment that includes a radio question type named “nextstage” and when answered with “yes”, will transition to the “Baseline” stage.
The Formula Based “Baseline” stage contains a baseline assessment that includes a radio question type named “pmpiq23” and when answered (since all responses are greater than 0) will transition to the “FinalStage”. However, if the baseline assessment is not answered within 3 days (as shown in the example below), the stage transition from “Baseline” to “FinalStage” will still occur.
The “FinalStage” stage is Time Based and will only be active for 1 day (24 hours) since the stage does not end at midnight.
...
| |||
---|---|---|---|
Current Date | Question Variable | Result | Interpretation |
today = 04/17/2024 | study_startdate = 04/17/2024 | 0 | False - stays in current stage |
today = 04/17/2024 | study_startdate = 04/12/224 | 5 | True - transitions to next stage |
Panel | ||
---|---|---|
| ||
Contains |
The ‘Contains’ formula is a TRUE/FALSE statement used to check if a particular option was selected in a checkbox question type. In CMS (platform v1), the way to do that is to write something like this: [checkboxq(value)] == 1. This has been changed up in V2. The new formula to check if a checkbox contains a specific value is:
...