Respondents' answers
These functions are used to access respondent answers.
Function | Description | Example |
---|---|---|
answer(question_id, [item_id], [stimulus_id]) | Returns the responses in the question specified by question_id . item_id is an optional input to retrieve answers to an item in the question. | answer(1559253) |
bottom(question_id, limit, [stimulus_id]) | Returns the N items the respondent placed at the bottom of the list in the ranking question specified by question_id . N is determined by limit . | bottom(1549283, 2) |
top(question_id, limit, [stimulus_id]) | Returns the N items the respondent placed at the top of the list in the ranking question specified by question_id . N is determined by limit . | top(1549283, 2) |
count(question_id, [stimulus_id]) | Returns the number of choices selected by respondents in the question specified by question_id . Function only works with multiple choice and dropdown menu questions. | count(1559253) |
npsStatus(question_id, [stimulus_id]) | Returns the net promoter status for Net Promoter Score questions. The returned value is a string that can be only “Detractor”, “Neutral”, or “Promoter”. Specify question using question_id | npsStatus(1557233) |
answerType(question_id, [stimulus_id]) | Returns the answer type of a calculated variable. The returned value is a string that can be only “number”, “string”, “boolean”, or “undefined”. Specify question using question_id | answerType(1557232) |
If the question was not shown to the respondent, then all the functions listed above will return undefined
.
The use of stimulus_id
stimulus_id
is an optional input in the functions listed above. It helps retrieve answers to a particular stimulus in a monadic block.
If you refer to a question that is inside the monadic block but omit the stimulus_id
input, the functions will return results for the “first” stimulus of the block. It could be either the first stimulus shown to the respondent or the first stimulus in the order specified in the experiment’s settings.
If you specify stimulus_id
for a question that is outside of a monadic block, the functions will return undefined
.
If you specify an incorrect value for stimulus_id
for a question that is inside of a monadic block, the functions will return undefined
.
The function answered
This function checks if the respondent answered a particular question. It returns TRUE
or FALSE
. If the question was not shown to the respondent, then the function returns FALSE
.
Usage: answered({question_id}, [stimulus_id])
, where
question_id
is the ID of the question;stimulus_id
is the ID of the stimulus in the monadic block. If a question was inside a monadic block, but the stimulus ID is not specified, then the function returnsTRUE
if it was answered for any stimulus in the block.
The function is applicable to all types of questions. There are some special cases:
- For intro questions, the function returns
TRUE
if the question was shown, andFALSE
if it was not shown. - Some questions where answer is forced (such as Van Westendorp) will generally be answered as long as they were shown.