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.

GetQuestionProperties: Difference between revisions

From Catglobe Wiki
Hovietluu (talk | contribs)
No edit summary
 
(8 intermediate revisions by 4 users not shown)
Line 1: Line 1:
==== getQuestionProperties<br/> ====
[[Category:Questionnaire_Functions]]
{{HelpFiles}}
 
__NOTOC__
 
=getQuestionProperties=


Return value property of question.
Return value property of question.


'''Syntax'''
===Syntax===
 
getQuestionProperties(questionName) required questionnaire context
 
getQuestionProperties(questionName, qnaireRId) not required questionnaire context
 
===Arguments===


getQuestionProperties(question_name);
questionName: Is a name of question.


'''Arguments'''
qnaireRId: is resource Id of questionnaire, this is an optional param


question_name: Is a name of question.
===Return type===


'''Return type'''
array of '''[[QuestionProperty_class|QuestionProperty]]'''


array of&nbsp;QuestionProperty object.
===Examples===
<source lang="javascript">
setRPQId(370222122);
array listOfQuestionProperty = getQuestionProperties("Q6_Awareness");
for(number i = 0; i < listOfQuestionProperty.Count; i++) {
        QuestionProperty qp = listOfQuestionProperty[i];
      print("------" + i.ToString() + "-----");
      print("Id: " + qp.Id);
      print("QuestionID: " + qp.QuestionID);
      print("QuestionPropertyType: " + qp.QuestionPropertyType);
      print("QuestionPropertyTypeAsString: " + qp.QuestionPropertyTypeAsString);
      print("Value: " + qp.Value);
}


'''Examples:'''
///////////
<div>Code:</div><div><br/></div><div>setRPQId(370222122);</div><div>array listOfQuestionProperty = getQuestionProperties("Q6_Awareness");</div><div><br/></div><div>for(number i = 0; i < listOfQuestionProperty.Count; i++)</div><div>{</div><div>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;QuestionProperty qp = listOfQuestionProperty[i];</div><div>&nbsp; &nbsp; &nbsp; &nbsp;print("------" + i.ToString() + "-----");</div><div>&nbsp; &nbsp; &nbsp; &nbsp;//</div><div><br/></div><div>&nbsp; &nbsp; &nbsp; &nbsp;print("Id: " + qp.Id);</div><div>&nbsp; &nbsp; &nbsp; &nbsp;print("QuestionID: " + qp.QuestionID);</div><div>&nbsp; &nbsp; &nbsp; &nbsp;print("QuestionPropertyType: " + qp.QuestionPropertyType);</div><div>&nbsp; &nbsp; &nbsp; &nbsp;print("QuestionPropertyTypeAsString: " + qp.QuestionPropertyTypeAsString);</div><div>&nbsp; &nbsp; &nbsp; &nbsp;print("Value: " + qp.Value);</div><div>}</div><div><br/></div><div>Result :</div><div><pre style="font-family:monospace,fixed">------0-----
//Result :
///////////
------0-----
Id: 93490
Id: 93490
QuestionID: 1489
QuestionID: 1489
Line 33: Line 58:
QuestionPropertyType: 7
QuestionPropertyType: 7
QuestionPropertyTypeAsString: NoMulti
QuestionPropertyTypeAsString: NoMulti
Value: [32]</pre></div>
Value: [32]
'''Availability'''
</source>


Version 5.8
<source lang="javascript">
//Example for using not required questionnaire context
string questionName = "Q1";
number qnaireRId = 15546533;
array propertyList = getQuestionProperties(questionName, qnaireRId);
</source>

Latest revision as of 03:35, 23 March 2022




getQuestionProperties

Return value property of question.

Syntax

getQuestionProperties(questionName) required questionnaire context

getQuestionProperties(questionName, qnaireRId) not required questionnaire context

Arguments

questionName: Is a name of question.

qnaireRId: is resource Id of questionnaire, this is an optional param

Return type

array of QuestionProperty

Examples

setRPQId(370222122);
array listOfQuestionProperty = getQuestionProperties("Q6_Awareness");
for(number i = 0; i < listOfQuestionProperty.Count; i++) {
        QuestionProperty qp = listOfQuestionProperty[i];
       print("------" + i.ToString() + "-----");
       print("Id: " + qp.Id);
       print("QuestionID: " + qp.QuestionID);
       print("QuestionPropertyType: " + qp.QuestionPropertyType);
       print("QuestionPropertyTypeAsString: " + qp.QuestionPropertyTypeAsString);
       print("Value: " + qp.Value);
}

///////////
//Result :
///////////
------0-----
Id: 93490
QuestionID: 1489
QuestionPropertyType: 65
QuestionPropertyTypeAsString: AnswerOptionColumns
Value: 4
------1-----
Id: 5849
QuestionID: 1489
QuestionPropertyType: 3
QuestionPropertyTypeAsString: RotateAnswerOptions
Value: [1,2,34,3,35,36,4,5,6,7,37,8,9,10,11,12,13,14,15,16,17,18,19,20,21,38,22,23,24,25,39,26,27,28,33,29,30]
------2-----
Id: 5850
QuestionID: 1489
QuestionPropertyType: 7
QuestionPropertyTypeAsString: NoMulti
Value: [32]
//Example for using not required questionnaire context
string questionName = "Q1";
number qnaireRId = 15546533;
array propertyList = getQuestionProperties(questionName, qnaireRId);