Difference between revisions of "QuestionProperty class"
Line 2: | Line 2: | ||
|Name=<nowiki>QuestionProperty</nowiki> | |Name=<nowiki>QuestionProperty</nowiki> | ||
|Description=<nowiki>The question property.</nowiki> | |Description=<nowiki>The question property.</nowiki> | ||
− | |InheritsFrom=object|Methods= | + | |InheritsFrom=object|Constructors= |
+ | {{CGscriptConstructors_Template|Parameters= | ||
+ | {{CGscriptParameters_Template|Type=PropertyType constant|Name=<nowiki>type</nowiki>|Description=<nowiki>Property type. Use constant named Question_Property_xxx</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=QuestionTemplate|Name=<nowiki>question</nowiki>|Description=<nowiki>Question template contains this property</nowiki>}} | ||
+ | |Description=<nowiki>Create new property and add it to question properties</nowiki>}} | ||
+ | {{CGscriptConstructors_Template|Parameters= | ||
+ | {{CGscriptParameters_Template|Type=PropertyType constant|Name=<nowiki>type</nowiki>|Description=<nowiki>Property type. Use constant named Question_Property_xxx</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>gridNumber</nowiki>|Description=<nowiki>Index of sub question that this property belong to</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=QuestionTemplate|Name=<nowiki>question</nowiki>|Description=<nowiki>Question template contains this property</nowiki>}} | ||
+ | |Description=<nowiki>Create new property and add it to question properties</nowiki>}} | ||
+ | |Methods= | ||
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} | {{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}} | ||
|Properties= | |Properties= | ||
− | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>GridNumber</nowiki>|HasGetter=1|Description=<nowiki>Get | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>GridNumber</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get/Set Index of sub question that this property belong to</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>HasText</nowiki>|HasGetter=1|Description=<nowiki>Get HasText of the question property</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>HasText</nowiki>|HasGetter=1|Description=<nowiki>[OBSOLETE] Get HasText of the question property</nowiki>}} |
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Id</nowiki>|HasGetter=1|Description=<nowiki>Get id of the question property</nowiki>}} | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Id</nowiki>|HasGetter=1|Description=<nowiki>Get id of the question property</nowiki>}} | ||
− | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IsSpecialText</nowiki>|HasGetter=1|Description=<nowiki>Get IsSpecialText of the question property</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IsLocalize</nowiki>|HasGetter=1|Description=<nowiki>Check value type of property should be use as LocalizedString</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|Description=<nowiki>Get Name of the | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IsSpecialText</nowiki>|HasGetter=1|Description=<nowiki>Get IsSpecialText of the question property that marked by system</nowiki>}} |
+ | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>Name</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get or set Name of the this property.</nowiki>}} | ||
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}} | ||
− | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionID</nowiki>|HasGetter=1|Description=<nowiki>Get QuestionID of the question property</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=PropertyType constant|Name=<nowiki>PropertyType</nowiki>|HasGetter=1|Description=<nowiki>Get constant of the property's type</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>QuestionPropertyLanguages</nowiki>|HasGetter=1|Description=<nowiki>Get QuestionPropertyLanguages of the question property. Only valid when HasText is true</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>PropertyTypeAsString</nowiki>|HasGetter=1|Description=<nowiki>Get PropertyType as string</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=LocalizedString|Name=<nowiki>QuestionPropertyLanguagesLocalized</nowiki>|HasGetter=1|Description=<nowiki>Same as QuestionPropertyLanguages, just different container</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionID</nowiki>|HasGetter=1|Description=<nowiki>[OBSOLETE] Get QuestionID of the question property</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionPropertyType</nowiki>|HasGetter=1|Description=<nowiki>Get QuestionPropertyType of the question property</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=Dictionary|Name=<nowiki>QuestionPropertyLanguages</nowiki>|HasGetter=1|Description=<nowiki>[OBSOLETE] Get QuestionPropertyLanguages of the question property. Only valid when HasText is true</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>QuestionPropertyTypeAsString</nowiki>|HasGetter=1|Description=<nowiki>Get QuestionPropertyType as string of the question property</nowiki>}} | + | {{CGscriptProperties_Template|ReturnType=LocalizedString|Name=<nowiki>QuestionPropertyLanguagesLocalized</nowiki>|HasGetter=1|Description=<nowiki>[OBSOLETE] Same as QuestionPropertyLanguages, just different container</nowiki>}} |
+ | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionPropertyType</nowiki>|HasGetter=1|Description=<nowiki>[OBSOLETE] Get QuestionPropertyType of the question property</nowiki>}} | ||
+ | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>QuestionPropertyTypeAsString</nowiki>|HasGetter=1|Description=<nowiki>[OBSOLETE] Get QuestionPropertyType as string of the question property</nowiki>}} | ||
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} | {{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}} | ||
− | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>TypeValue</nowiki>|HasGetter=1|Description=<nowiki>Get TypeValue of | + | {{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>TypeValue</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get or set TypeValue of this property</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType= | + | {{CGscriptProperties_Template|ReturnType=object|Name=<nowiki>Value</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Get or set value of the this property. Base on IsLocalize, it can be a String or LocalizedString</nowiki>}} |
}} | }} | ||
Revision as of 10:43, 25 April 2022
QuestionProperty
The question property.
Parent class
Inherits from object
Constructors
- (PropertyType constant type "Property type. Use constant named Question_Property_xxx", QuestionTemplate question "Question template contains this property") - Create new property and add it to question properties
- (PropertyType constant type "Property type. Use constant named Question_Property_xxx", int gridNumber "Index of sub question that this property belong to", QuestionTemplate question "Question template contains this property") - Create new property and add it to question properties
Methods
- (From object) string ToString() - The string representation of the object.
Properties
- int GridNumber { get; set; } - Get/Set Index of sub question that this property belong to
- bool HasText { get; } - [OBSOLETE] Get HasText of the question property
- int Id { get; } - Get id of the question property
- bool IsLocalize { get; } - Check value type of property should be use as LocalizedString
- bool IsSpecialText { get; } - Get IsSpecialText of the question property that marked by system
- string Name { get; set; } - Get or set Name of the this property.
- string ObjectTypeName { get; } - The name of the type of object.
- PropertyType constant PropertyType { get; } - Get constant of the property's type
- string PropertyTypeAsString { get; } - Get PropertyType as string
- int QuestionID { get; } - [OBSOLETE] Get QuestionID of the question property
- Dictionary QuestionPropertyLanguages { get; } - [OBSOLETE] Get QuestionPropertyLanguages of the question property. Only valid when HasText is true
- LocalizedString QuestionPropertyLanguagesLocalized { get; } - [OBSOLETE] Same as QuestionPropertyLanguages, just different container
- int QuestionPropertyType { get; } - [OBSOLETE] Get QuestionPropertyType of the question property
- string QuestionPropertyTypeAsString { get; } - [OBSOLETE] Get QuestionPropertyType as string of the question property
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
- string TypeValue { get; set; } - Get or set TypeValue of this property
- object Value { get; set; } - Get or set value of the this property. Base on IsLocalize, it can be a String or LocalizedString
Examples
// Example to get Export/Report label on "Q7"
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
}