Difference between revisions of "QuestionProperty class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=<nowiki>QuestionProperty</nowiki> |Description=<nowiki>The question property.</nowiki> |InheritsFrom=object|Methods= {{CGscriptMethods_Template|...")
 
Line 20: Line 20:
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Value</nowiki>|HasGetter=1|Description=<nowiki>Get Value of the question property. Only valid when HasText is false</nowiki>}}
 
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Value</nowiki>|HasGetter=1|Description=<nowiki>Get Value of the question property. Only valid when HasText is false</nowiki>}}
 
}}
 
}}
 +
 +
=== <span style="color:#DF8621;">'''Examples'''</span> ===
 +
<source lang="javascript">
 +
// Example to get Export/Report label on "Q7"
 +
</source>
 +
[[File:2019-02-19_10-40-32.png]]
 +
 +
<source lang="javascript">
 +
string questionName = "Q7";
 +
number qnaireRId = 15644863;
 +
array questionProperty = getQuestionProperties(questionName, qnaireRId);
 +
for(number i = 0; i < questionProperty.Count; i++)
 +
{
 +
QuestionProperty qp = questionProperty[i];
 +
print(qp.QuestionPropertyType);//97
 +
print(qp.QuestionPropertyLanguages);//{"da-DK": Export Report label in DK, "en-GB": Export Report label in UK}
 +
print(qp.QuestionPropertyLanguagesLocalized.GetTranslationForLoggedInUser());//Export Report label in UK
 +
print(qp.QuestionPropertyLanguagesLocalized.GetSpecificTranslation("da-DK"));//Export Report label in DK
 +
}
 +
</source>

Revision as of 09:11, 2 July 2020

QuestionProperty



The question property.

Parent class

Inherits from object

Methods

  • (From object) string ToString() - The string representation of the object.

Properties

  • int GridNumber { get; } - Get GridNumber of the question property
  • bool HasText { get; } - Get HasText of the question property
  • int Id { get; } - Get id of the question property
  • bool IsSpecialText { get; } - Get IsSpecialText of the question property
  • string Name { get; } - Get Name of the question property
  • string ObjectTypeName { get; } - The name of the type of object.
  • int QuestionID { get; } - Get QuestionID of the question property
  • Dictionary QuestionPropertyLanguages { get; } - Get QuestionPropertyLanguages of the question property. Only valid when HasText is true
  • LocalizedString QuestionPropertyLanguagesLocalized { get; } - Same as QuestionPropertyLanguages, just different container
  • int QuestionPropertyType { get; } - Get QuestionPropertyType of the question property
  • string QuestionPropertyTypeAsString { get; } - Get QuestionPropertyType as string of the question property
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.
  • string TypeValue { get; } - Get TypeValue of the question property
  • string Value { get; } - Get Value of the question property. Only valid when HasText is false


Examples

// Example to get Export/Report label on "Q7"

2019-02-19 10-40-32.png

string questionName = "Q7";
number qnaireRId = 15644863;
array questionProperty = getQuestionProperties(questionName, qnaireRId);
for(number i = 0; i < questionProperty.Count; i++) 
{
	QuestionProperty qp = questionProperty[i];
	print(qp.QuestionPropertyType);//97
	print(qp.QuestionPropertyLanguages);//{"da-DK": Export Report label in DK, "en-GB": Export Report label in UK}
	print(qp.QuestionPropertyLanguagesLocalized.GetTranslationForLoggedInUser());//Export Report label in UK
	print(qp.QuestionPropertyLanguagesLocalized.GetSpecificTranslation("da-DK"));//Export Report label in DK
}