Difference between revisions of "Question getQuestionByIndex"
Dangthanhloc (talk | contribs) (Created page with "Category:Questionnaire_Functions {{HelpFiles}} ====Question_getQuestion==== Get a question object by its label '''Syntax''' Question_getQuestion(''qualifiedLabel, i...") |
Dangthanhloc (talk | contribs) |
||
Line 1: | Line 1: | ||
− | + | {{HelpFiles}} | |
− | {{HelpFiles}} | + | |
+ | ==== 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''' | |
− | or | + | *''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: |
− | + | {| width="875" cellpadding="2" border="1" style="border-collapse: collapse; border: 1px solid #010101" class="tableintopic" | |
− | + | |- align="left" valign="top" | |
+ | | width="292" bgcolor="#C0C0C0" style="border: 1px solid #010101" | | ||
+ | '''Index''' | ||
− | ''' | + | | width="104" bgcolor="#C0C0C0" style="border: 1px solid #010101" | |
+ | '''Data type''' | ||
− | + | | width="479" bgcolor="#C0C0C0" style="border: 1px solid #010101" | | |
+ | '''Value''' | ||
− | |||
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | | + | | width="292" style="border: 1px solid #010101" | |
− | + | QUESTION_ID | |
− | + | ||
− | + | | width="104" style="border: 1px solid #010101" | | |
− | + | number | |
− | + | ||
+ | | width="479" style="border: 1px solid #010101" | | ||
+ | Id | ||
+ | |||
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | style="border: 1px solid #010101" width=" | + | | width="292" style="border: 1px solid #010101" | |
− | + | QUESTION_TYPE | |
− | + | ||
− | number | + | | width="104" style="border: 1px solid #010101" | |
− | | style="border: 1px solid #010101" | + | number |
− | + | ||
+ | | width="479" style="border: 1px solid #010101" | | ||
+ | Type of question | ||
+ | |||
+ | <br>NotSet = 0, <br>Single = 1, <br>Multi = 2, <br>Number = 3, <br>Text = 4, <br>Open = 5, <br>SingleGrid = 6, <br>MultiGrid = 7, <br>TextGrid = 8, <br>Page = 9, <br>Multimedia = 10, <br>Scale = 11, <br>ScaleGrid = 12 | ||
+ | |||
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | | + | | width="292" style="border: 1px solid #010101" | |
− | + | QUESTION_LABEL | |
− | |||
− | |||
− | |||
− | |||
− | + | | width="104" style="border: 1px solid #010101" | | |
− | + | string | |
− | + | ||
− | + | | width="479" style="border: 1px solid #010101" | | |
− | + | Label | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | style="border: 1px solid #010101" width=" | + | | width="292" style="border: 1px solid #010101" | |
− | + | QUESTION_TEXT | |
− | + | ||
− | string | + | | width="104" style="border: 1px solid #010101" | |
− | | style="border: 1px solid #010101 | + | string |
− | + | ||
+ | | width="479" style="border: 1px solid #010101" | | ||
+ | Question's text (in the specified language) | ||
+ | |||
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | style="border: 1px solid #010101" width=" | + | | width="292" style="border: 1px solid #010101" | |
− | + | QUESTION_ANSWER_OPTIONS | |
− | + | ||
− | + | | width="104" style="border: 1px solid #010101" | | |
− | + | array | |
− | + | ||
+ | | width="479" style="border: 1px solid #010101" | | ||
+ | Answer options | ||
+ | |||
|- align="left" valign="top" | |- align="left" valign="top" | ||
− | | | + | | width="292" style="border: 1px solid #010101" | |
− | + | QUESTION_SUB_QUESTIONS | |
− | + | ||
− | + | | width="104" style="border: 1px solid #010101" | | |
− | | | + | array |
− | + | ||
− | + | | width="479" style="border: 1px solid #010101" | | |
− | + | Sub questions | |
− | + | ||
− | | | ||
− | |||
− | |||
− | Sub questions | ||
|} | |} | ||
− | '''Example''' | + | '''Example''' |
<source lang="javascript"> | <source lang="javascript"> | ||
Line 100: | Line 104: | ||
//output : {12,364872,1,Gender,<p> Your sex : </p>,{{13,1,Male},{13,2,Female},{13,3,Don't want to tell}},{}} | //output : {12,364872,1,Gender,<p> Your sex : </p>,{{13,1,Male},{13,2,Female},{13,3,Don't want to tell}},{}} | ||
− | </source> | + | </source> |
− | '''Availability''' | + | '''Availability''' |
− | Version 5. | + | Version 5.801 __NOTOC__ <!-- imported from file: 6272.htm--> |
− | __NOTOC__ | + | |
− | <!-- imported from file: 6272.htm--> | + | [[Category:Questionnaire_Functions]] |
Revision as of 10:06, 15 July 2013
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
|
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
array q1 = Question_getQuestion("5312BMW\\5312bmw_SALES_CATI_2008\\Gender");
array q2 = Question_getQuestion("Gender", "en-GB");
//output : {12,364872,1,Gender,<p> Your sex : </p>,{{13,1,Male},{13,2,Female},{13,3,Don't want to tell}},{}}
Availability
Version 5.801