Question getQuestionByIndex

From Catglobe Wiki
Revision as of 10:18, 15 July 2013 by Dangthanhloc (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search



Question_getQuestionByIndex

Get a question object by its index in the current or specified questionnaire (use with QuestionIndex column in DCS)

Syntax

Question_getQuestionByIndex(index[, questionnaireResourceId [, isoCode])

Arguments

  • index: is a number. It is the index in the current or specified questionnaire
  • questionnaireResourceId: is a number. It is the resource Id of specified questionnaire
  • isoCode : is a string expression. It is the ISO code of a language, if it is not specified, the current user's language (if it is defined in the questionnaire template) or the question's default language will be used

Return value

An array, it is the question object, which contains the following items:

Index

Data type

Value

QUESTION_ID

number

Id

QUESTION_TYPE

number

Type of question


NotSet = 0,
Single = 1,
Multi = 2,
Number = 3,
Text = 4,
Open = 5,
SingleGrid = 6,
MultiGrid = 7,
TextGrid = 8,
Page = 9,
Multimedia = 10,
Scale = 11,
ScaleGrid = 12

QUESTION_LABEL

string

Label

QUESTION_TEXT

string

Question's text (in the specified language)

QUESTION_ANSWER_OPTIONS

array

Answer options

QUESTION_SUB_QUESTIONS

array

Sub questions

Example

DCS_use(37312832);//8386cat - CEM BANK Test Question Index
string getQuestionIndex = "selectMultiColumn(QuestionIndex) where(Id == [19971147]);";
array questionIndexs = DCS_evaluateWhereExpression(getQuestionIndex);
number questionIndex = questionIndexs[0][0];

array q = Question_getQuestionByIndex(questionIndex, 33596949);//8386cat - CEM Bank Intelligence

//output : {12,295235,2,CG_CJ_Q50,<p> <b>Hvad er afgørende for, at du skifter bank?</b> </p>,{{13,1,Hvis nuværende lukker\går konkurs\ikke findes i nærheden},{13,2,Bedre renter\service\rådgivning\lavere\ingen gebyrer},{13,3,Dårlig behandling i nuværende\dårlig\manglende rådgivning},{13,4,Ny rådgiver\mister rådgiver\flinkere rådgiver\bedre rådgivning},{13,5,Afslag på lån\dårlige lånebetingelser},{13,6,Vil ikke skifte},{13,7,Hvis jeg føler mig snydt\mister gensidig tillid},{13,8,andet},{13,9,ved ikke},{13,10,Manglende forståelse for behov},{13,11,Hvis jeg flytter},{13,12,Træt af nuværende\prøve noget nyt\få taget sig sammen}},{}}

Availability

Version 5.801