Difference between revisions of "TopAnswers"
Cg huyphong (talk | contribs) |
|||
Line 2: | Line 2: | ||
{{HelpFiles}} | {{HelpFiles}} | ||
− | ==== | + | ====Question_getTopSelectedAnswers==== |
Returns an array of answers using an existing multi question, where the returned array will be a subset of the original question values filtered using a position and length parameter. | Returns an array of answers using an existing multi question, where the returned array will be a subset of the original question values filtered using a position and length parameter. | ||
Line 8: | Line 8: | ||
'''Syntax''' | '''Syntax''' | ||
− | + | Question_getTopSelectedAnswers(''questionName,position,length[,index]'') | |
'''Arguments''' | '''Arguments''' | ||
− | ''questionName'': String - An existing multi question in the context questionnaire. | + | ''questionName'': String - An existing multi question label or multi grid question label in the context questionnaire. |
''position'': Number from 0 and up. Defines the first answer that will be included in the new array from the original data. | ''position'': Number from 0 and up. Defines the first answer that will be included in the new array from the original data. | ||
Line 26: | Line 26: | ||
'''Examples''' | '''Examples''' | ||
− | + | Question_getTopSelectedAnswers(originalmulti,1,1) | |
− | // given that the ''originalmulti'' question is | + | // given that the ''originalmulti'' question is Multi question |
... [1,2,3,4,5] then returned array becomes [2] | ... [1,2,3,4,5] then returned array becomes [2] |
Latest revision as of 05:58, 4 January 2012
Question_getTopSelectedAnswers
Returns an array of answers using an existing multi question, where the returned array will be a subset of the original question values filtered using a position and length parameter.
Syntax
Question_getTopSelectedAnswers(questionName,position,length[,index])
Arguments
questionName: String - An existing multi question label or multi grid question label in the context questionnaire.
position: Number from 0 and up. Defines the first answer that will be included in the new array from the original data.
length: Number from 1 and up. Defines the number of answers to be included in the new array as starting from the position in the original data.
index: A sub question index to be used for multi grid questions. If omitted, we will get array returned from all sub questions of the multi grid question.
Return type
array
Examples
Question_getTopSelectedAnswers(originalmulti,1,1)
// given that the originalmulti question is Multi question
... [1,2,3,4,5] then returned array becomes [2]
... [5,4,3,2,1] then returned array becomes [4]
... [1,2,3] then returned array becomes [2]
... [5,4,3] then returned array becomes [4]
... [1,2] then returned array becomes [2]
... [2] then returned array becomes []
Availability
Version 5.6