Difference between revisions of "Question getTopSelectedAnswers"

From Catglobe Wiki
Jump to: navigation, search
(Question_getTopSelectedAnswers)
 
Line 1: Line 1:
[[Category:Questionnaire_Functions]]
 
{{HelpFiles}}
 
 
 
====Question_getTopSelectedAnswers====
 
====Question_getTopSelectedAnswers====
  
Return top selected answers of a multi or multi grid question
+
Return top selected answers of a multi or multi grid question. This function run in question context
  
 
'''Syntax'''
 
'''Syntax'''
  
Question_getTopSelectedAnswers(question,position,length)
+
Question_getTopSelectedAnswers(questionLabel, position, length)
  
'''Arguments'''
+
or
  
* question: is an question array. It must be a multi question or multi grid question
+
Question_getTopSelectedAnswers(questionPath, position, length)
* position: is a number
 
* length: is a number
 
  
'''Return type'''
+
'''Arguments'''
  
array
+
questionLabel: a string expression. It is the label of multi or multi grid question
  
'''Examples'''
+
questionLabel: a string expression. It is the path of multi or multi grid question
  
setRPQId(123456);
+
position: is a number.
  
print(Question_getTopSelectedAnswers(questionA,0,3));
+
length: is a number.
  
//or print(topAnswer(questionA,2,3));
+
'''Return type'''
  
Result:
+
array
  
Suppose Multi question have 5 AO 1,2,3,4,5.
+
'''Examples'''
 +
<source lang="javascript">
 +
//Q1 is a multi question with 5 options
  
1.Example 1 : If user chose 3 then 4 then 2 then 1 then 5, it would return {3,4,2}. If user chose 3 then 1, it will return {3,1}
+
//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.Example 2 : If user chose 3 then 4 then 2 then 1 then 5, it would return {2,1,5}. If user chose 3 then 1, it will return {}
+
//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
__NOTOC__
+
 
<!-- imported from file: 7583.htm-->
+
[[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