This article covers these topics:
Introduction to reminders
Scheduling alerts, or reminders, is as easy as adding questions to your survey. QMob has a user-friendly interface that you can use for this purpose (please refer to setting up alerts). Once you have filled in the required fields, the reminder script is automatically added to the <survey> element of your project and can be further modified through the Code view.
Reminders are first scheduled on the mobile device when the survey is downloaded, and then updated based on currently available information when the respondent arrives at the survey list in the app between entries.
To schedule a reminder based on the respondent's behavior, you can modify the reminder script using global variables, date and time functions and getrespdata().
Examples
Single reminder without any added logic:
<singular date="20.11.2019 12:00"/>
</reminder>
Repeated reminder without any added logic:
<interval from="09:00" to="09:00" frequency="86400"/>
</reminder>
To show a reminder only if the last entry made was not today, you can compare the date of the last entry with the date for the scheduled reminder:
<reminder end_date="15.11.2019" text="Remember to complete today's task" id="1" title="Repeated Alert" start_date="01.11.2019">
<interval from="09:00" to="09:00" frequency="86400" if="datecompare(lastentryms(),reminderms())!=0"/>
</reminder>
Schedule a reminder for 30 minutes after the previous entry:
<reminder end_date="20.11.2019" text="Reminder 30 minutes after previous entry" title="Reminder 30" start_date="20.11.2019">
<singular date="addminutes(currentts(),30)"/>
</reminder>
Control date and time with global varibles that are set inside the survey.
<reminder end_date="$global(enddate,15.11.2019)" text="Repeated alert" id="1" title="Repeated alert" start_date="$global(startdate,01.11.2019)">
<interval from="$global(starttime,09:00)" to="$global(endtime,09:00)" frequency="86400" if="$global(activatealert)==1"/>
</reminder>
In the above example both date and time frame are controlled with global variables. Additionally there is an if-condition controlling if the reminder should be triggered or not:
- start_date="$global(startdate,01.11.2019)", start_date is configured to use a global variable and if the global variable has not been set a default date of 01.11.2019 will be used. A default date should be included when using a global variable for date.
- end_date="$global(enddate,15.11.2019)", end_date is following the same principle as start_date but using a separate global variable and default date.
- from="$global(starttime,09:00)", from-time in the interval is following the same principle as the above but using its own global variable and default time value. A default time should be included when using a global variable for time.
- to="$global(endtime,09:00)", to-time in the interval is following the same principle as the above but using its own global variable and default time value.
- if="$global(activatealert)==1", with this if condition included the reminder will only trigger if the global variable activatealert has been set to 1.