Toggle menu
862
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Question getQuestionByIndex: Difference between revisions

From Catglobe Wiki
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)
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
[[Category:Questionnaire_Functions]]
{{HelpFiles}}  
{{HelpFiles}}
 
==== Question_getQuestionByIndex  ====


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


Get a question object by its label
'''Syntax'''


'''Syntax'''
Question_getQuestionByIndex(''index[, questionnaireResourceId [, isoCode''])


Question_getQuestion(''qualifiedLabel, 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


Question_getQuestion(''qualifiedLabel'')
'''Return value'''  


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


* ''qualifiedLabel '': is a ''string ''expression. It is the label of the question, it might contain the questionnaire's qualified name
{| width="875" cellpadding="2" border="1" class="tableintopic" style="border-collapse: collapse; border: 1px solid #010101"
* ''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
|- align="left" valign="top"
| width="292" bgcolor="#C0C0C0" style="border: 1px solid #010101" |
'''Index'''  


'''Return value'''
| width="104" bgcolor="#C0C0C0" style="border: 1px solid #010101" |
'''Data type'''  


An ''array'', it is the question object, which contains the following items:
| width="479" bgcolor="#C0C0C0" style="border: 1px solid #010101" |
'''Value'''  


{| class="tableintopic" style="border-collapse: collapse; border: 1px solid #010101" width="875" border="1" cellpadding="2"
|- align="left" valign="top"
|- align="left" valign="top"
| style="border: 1px solid #010101" width="292" bgcolor="#C0C0C0" |
| width="292" style="border: 1px solid #010101" |
'''Index'''
QUESTION_ID
| style="border: 1px solid #010101" width="104" bgcolor="#C0C0C0" |
 
'''Data type'''
| width="104" style="border: 1px solid #010101" |
| style="border: 1px solid #010101" width="479" bgcolor="#C0C0C0" |
number
'''Value'''
 
| width="479" style="border: 1px solid #010101" |  
Id
 
|- align="left" valign="top"
|- align="left" valign="top"
| style="border: 1px solid #010101" width="292" |
| width="292" style="border: 1px solid #010101" |
QUESTION_ID
QUESTION_TYPE
| style="border: 1px solid #010101" width="104" |
 
number
| width="104" style="border: 1px solid #010101" |  
| style="border: 1px solid #010101" width="479" |
number  
Id
 
| 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"
| style="border: 1px solid #010101" width="292" |
| width="292" style="border: 1px solid #010101" |  
QUESTION_TYPE
QUESTION_LABEL
| style="border: 1px solid #010101" width="104" |
number
| style="border: 1px solid #010101" width="479" |
Type of question


<br>NotSet = 0,
| width="104" style="border: 1px solid #010101" |
<br>Single = 1,
string
<br>Multi = 2,
 
<br>Number = 3,
| width="479" style="border: 1px solid #010101" |
<br>Text = 4,
Label
<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"
| style="border: 1px solid #010101" width="292" |
| width="292" style="border: 1px solid #010101" |
QUESTION_LABEL
QUESTION_TEXT
| style="border: 1px solid #010101" width="104" |
 
string
| width="104" style="border: 1px solid #010101" |  
| style="border: 1px solid #010101" width="479" |
string  
Label
 
| 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="292" |
| width="292" style="border: 1px solid #010101" |
QUESTION_TEXT
QUESTION_ANSWER_OPTIONS
| style="border: 1px solid #010101" width="104" |
 
string
| width="104" style="border: 1px solid #010101" |
| style="border: 1px solid #010101" width="479" |
array
Question's text (in the specified language)
 
| width="479" style="border: 1px solid #010101" |  
Answer options
 
|- align="left" valign="top"
|- align="left" valign="top"
| style="border: 1px solid #010101" width="292" |
| width="292" style="border: 1px solid #010101" |  
QUESTION_ANSWER_OPTIONS
QUESTION_SUB_QUESTIONS
| style="border: 1px solid #010101" width="104" |
 
array
| width="104" style="border: 1px solid #010101" |  
| style="border: 1px solid #010101" width="479" |
array
Answer options
 
|- align="left" valign="top"
| width="479" style="border: 1px solid #010101" |  
| style="border: 1px solid #010101" width="292" |
Sub questions  
QUESTION_SUB_QUESTIONS
 
| style="border: 1px solid #010101" width="104" |
array
| style="border: 1px solid #010101" width="479" |
Sub questions
|}
|}


'''Example'''
'''Example'''  


<source lang="javascript">
<source lang="javascript">


array q1 = Question_getQuestion("5312BMW\\5312bmw_SALES_CATI_2008\\Gender");
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 q2 = Question_getQuestion("Gender", "en-GB");
array q = Question_getQuestionByIndex(questionIndex, 33596949);//8386cat - CEM Bank Intelligence


//output : {12,364872,1,Gender,<p> Your sex : </p>,{{13,1,Male},{13,2,Female},{13,3,Don't want to tell}},{}}
//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}},{}}


</source>
</source>  


'''Availability'''
'''Availability'''  


Version 5.6
Version 5.801 __NOTOC__ <!-- imported from file: 6272.htm-->  
__NOTOC__
 
<!-- imported from file: 6272.htm-->
[[Category:Questionnaire_Functions]]

Latest revision as of 09:18, 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


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