TopAnswers

From Catglobe Wiki
Revision as of 12:05, 22 March 2011 by Cg pham (talk | contribs)
Jump to: navigation, search



topAnswers

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

topAnswers(questionName,position,length[,index])

Arguments

questionName: String - An existing multi question 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

topAnswers(originalmulti,1,1)

// given that the originalmulti question is ...

... [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