Difference between revisions of "Question getTopSelectedAnswers"
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
− | |||
====Question_getTopSelectedAnswers==== | ====Question_getTopSelectedAnswers==== | ||
− | Return top selected answers of a multi question | + | Return top selected answers of a multi or multi grid question. This function run in question context |
'''Syntax''' | '''Syntax''' | ||
− | Question_getTopSelectedAnswers( | + | Question_getTopSelectedAnswers(questionLabel, position, length) |
− | + | or | |
− | + | Question_getTopSelectedAnswers(questionPath, position, length) | |
− | |||
− | |||
− | ''' | + | '''Arguments''' |
− | + | questionLabel: a string expression. It is the label of multi or multi grid question | |
− | + | questionLabel: a string expression. It is the path of multi or multi grid question | |
− | + | position: is a number. | |
− | + | length: is a number. | |
− | + | '''Return type''' | |
− | + | array | |
− | + | '''Examples''' | |
+ | <source lang="javascript"> | ||
+ | //Q1 is a multi question with 5 options | ||
− | + | //Example1: position 0, lenght 3 | |
+ | array a = Question_getTopSelectedAnswers("Q1",0,3); | ||
+ | array a = Question_getTopSelectedAnswers(Q1.QuestionLabel,0,3); | ||
+ | array a = Question_getTopSelectedAnswers(Resource_getResourceName(qnaireRId) + "\\Q1",0,3); | ||
+ | //If respondent select option in order: 4 then 3 then 2 then 1 then 5. Result return {4,3,2} | ||
+ | //If respondent select option in order: 4 then 1, it will return {4,1} | ||
− | 2. | + | //Example2: position 2, lenght 3 |
+ | array a = Question_getTopSelectedAnswers("Q1",2,3); | ||
+ | array a = Question_getTopSelectedAnswers(Q1.QuestionLabel,2,3); | ||
+ | array a = Question_getTopSelectedAnswers(Resource_getResourceName(qnaireRId) + "\\Q1",2,3); | ||
+ | //If respondent select option in order: 4 then 3 then 2 then 1 then 5. Result return {2,1,5} | ||
+ | //If respondent select option in order: 4 then 1, it will return {} | ||
+ | </source> | ||
'''Availability''' | '''Availability''' | ||
Version 5.7 | Version 5.7 | ||
− | + | ||
− | + | [[Category:Questionnaire_Functions]] |
Latest revision as of 07:58, 23 August 2019
Question_getTopSelectedAnswers
Return top selected answers of a multi or multi grid question. This function run in question context
Syntax
Question_getTopSelectedAnswers(questionLabel, position, length)
or
Question_getTopSelectedAnswers(questionPath, position, length)
Arguments
questionLabel: a string expression. It is the label of multi or multi grid question
questionLabel: a string expression. It is the path of multi or multi grid question
position: is a number.
length: is a number.
Return type
array
Examples
//Q1 is a multi question with 5 options
//Example1: position 0, lenght 3
array a = Question_getTopSelectedAnswers("Q1",0,3);
array a = Question_getTopSelectedAnswers(Q1.QuestionLabel,0,3);
array a = Question_getTopSelectedAnswers(Resource_getResourceName(qnaireRId) + "\\Q1",0,3);
//If respondent select option in order: 4 then 3 then 2 then 1 then 5. Result return {4,3,2}
//If respondent select option in order: 4 then 1, it will return {4,1}
//Example2: position 2, lenght 3
array a = Question_getTopSelectedAnswers("Q1",2,3);
array a = Question_getTopSelectedAnswers(Q1.QuestionLabel,2,3);
array a = Question_getTopSelectedAnswers(Resource_getResourceName(qnaireRId) + "\\Q1",2,3);
//If respondent select option in order: 4 then 3 then 2 then 1 then 5. Result return {2,1,5}
//If respondent select option in order: 4 then 1, it will return {}
Availability
Version 5.7