Difference between revisions of "GetQuestionProperties"

From Catglobe Wiki
Jump to: navigation, search
(Return type)
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Category:Questionnaire_Functions]]
 
[[Category:Questionnaire_Functions]]
 
{{HelpFiles}}
 
{{HelpFiles}}
 +
 
__NOTOC__
 
__NOTOC__
  
====getQuestionProperties====
+
=getQuestionProperties=
  
 
Return value property of question.
 
Return value property of question.
Line 9: Line 10:
 
===Syntax===
 
===Syntax===
  
getQuestionProperties(questionName);
+
getQuestionProperties(questionName) required questionnaire context
 +
 
 +
getQuestionProperties(questionName, qnaireRId) not required questionnaire context
  
 
===Arguments===
 
===Arguments===
  
 
questionName: Is a name of question.
 
questionName: Is a name of question.
 +
 +
qnaireRId: is resource Id of questionnaire, this is an optional param
  
 
===Return type===
 
===Return type===
  
array of '''QuestionProperty''' object.
+
array of '''[[QuestionProperty_class|QuestionProperty]]'''
  
===Examples====
+
===Examples===
 
<source lang="javascript">
 
<source lang="javascript">
 
setRPQId(370222122);
 
setRPQId(370222122);
Line 54: Line 59:
 
QuestionPropertyTypeAsString: NoMulti
 
QuestionPropertyTypeAsString: NoMulti
 
Value: [32]
 
Value: [32]
 +
</source>
 +
 +
<source lang="javascript">
 +
//Example for using not required questionnaire context
 +
string questionName = "Q1";
 +
number qnaireRId = 15546533;
 +
array propertyList = getQuestionProperties(questionName, qnaireRId);
 
</source>
 
</source>

Latest revision as of 04: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);