PostponeInterview
PostponeInterview('description', removeOnSync)This function can be used to postpone a survey automatically when an interviewer reaches a specific point in the survey path and the interview is to be considered as postponed. In CAPI App this function is equivalent to the interviewer going to the in-survey menu and selecting Postpone Interview.
The description parameter is required. If an empty string or null is supplied, the following default text will be recorded – "Interview postponed via script".
The removeOnSync parameter is an optional boolean value (default false). If it is supplied, the description parameter is required. The removeOnSync parameter will result in the survey being removed on the next sync that is performed. This provides a way to allow respondents to be completed across many different CAPI devices or even web. For example, in the situation where a survey needs to be started on Device A, postponed, re-assigned to Device B, postponed, re-assigned back to Device A, the latest respondent will not be downloaded on Device A in normal situations as the respondent on Device A is retained after being uploaded. By setting removeOnSync to true, this will allow the respondent on Device A to be removed allowing a new/updated respondent to be downloaded at a later time.
GetCapiInterviewerName
GetCapiInterviewerName()GetCapiInterviewerName returns the username of the currently logged on interviewer.
GetCapiDeviceOs
GetCapiDeviceOs()GetCapiDeviceOs() returns the operating system used by the device. The returned string values can be:
Windows
Android
iOS
If the device is not set up for CAPI, then nothing is returned.
Alernatively, see GetOfflineInfo() for related information.
GetCapiBatteryLevel
GetCapiBatteryLevel()GetCapiBatteryLevel() returns the current percentage level for the CAPI device battery as a numeric value. This function only applies to Android and iOS CAPI apps; the Windows CAPI console, and any other modes such as a CATI or web survey, will always return a value of 100.
Alernatively, see GetOfflineInfo() for related information.
CapiAssignRespondent
This function is intended to be initiated while running in CAWI to facilitate transition of an online survey to an offline survey in CAPI.
CapiAssignRespondent('interviewername')This function can be used to allow CAPI assignments to be added to the current respondent, meaning this interview will then be available for the CAPI interviewer to work on in the CAPI channel.
If the CAPI channel is not enabled for the survey, or if an invalid CAPI interviewer name is provided, the survey will continue and the survey author will receive an error email.
If the record is already assigned to another interviewer, calling this function will replace the existing assignment with the new assignment.
Note: This function is intended to be initiated while running in CAWI to facilitate transition of an online survey to an offline survey in CAPI.
CapiUnassignRespondent
This function is intended to be initiated while running in CAWI to facilitate transition of an online survey to an offline survey in CAPI.
CapiUnassignRespondent()This function can be used to remove an interviewer assignment from this respondent.
If the CAPI channel is not enabled for the survey, the survey will continue and the survey author will receive an error email.
Note: This function is intended to be initiated while running in CAWI to facilitate transition of an online survey to an offline survey in CAPI.
GetOfflineInfo().IsConnected
CAPI App now supports the ability to detect if the device has an active internet connection.
Use GetOfflineInfo().IsConnected in situations where online-only APIs need to be called during a survey.
window.open()
You can use the JavaScript function window.open() to open the browser or other apps from within a Survey (Android and iOS only).
When used within a survey, window.open() shows external web content within the built-in browser.
For example:
<button onclick="window.open('https://forsta.com'); return true;">Forsta</button>
You can open other apps, such as Google Maps or OsmAnd (an offline map app), via deeplinking.
For example, to open an offline map app on an Android device:
<button onclick="window.open('geo:49.275085,-123.1247132?z=4'); return true;">Show Map</button>