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.

QuestionnaireProperty class: Difference between revisions

From Catglobe Wiki
Created page with "{{CGscriptClass_Template |Name=<nowiki>QuestionnaireProperty</nowiki> |Description=<nowiki>The questionnaire property.</nowiki> |InheritsFrom=object|Constructors= {{CGscriptCo..."
 
No edit summary
 
Line 20: Line 20:
{{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>}}
{{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>}}
}}
}}
=== <span style="color:#DF8621">'''Examples'''</span> ===
<source lang="javascript">
//create new qnaire property
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionnaireProperty p = new QuestionnaireProperty (Question_Property_QuestionnaireCompletedText, qt);
p.Value = new LocalizedString ({"": "Completed", "da-DK": "Komplet"}, "en-GB");
//p.Value.SetTranslation("", "Completed");
//p.Value.SetTranslation("da-DK", "Komplet");
qt.Save(false);
print(qt.GetProperty(Question_Property_QuestionnaireCompletedText).ToDictionary());//{"": Completed, "da-DK": Komplet}
</source>
<source lang="javascript">
//create new qnaire property or update if existed
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
print(qt.Languages);//{en-GB,da-DK}
LocalizedString a = new LocalizedString ({"": "Completed", "da-DK": "Komplet"}, "en-GBd");
qt.SetProperty(Question_Property_QuestionnaireCompletedText, a);
qt.Save(false);
print(qt.GetProperty(Question_Property_QuestionnaireCompletedText).ToDictionary());//{"": Completed, "da-DK": Komplet}
</source>
<source lang="javascript">
//update existing qnaire property
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
print(qt.Properties);//{QuestionnaireProperty,...}
for(i for 0; qt.Properties.Count){
QuestionnaireProperty p = qt.Properties[i];
if(p.PropertyTypeAsString == "QuestionnaireCompletedText"){
p.Value = new LocalizedString ({"": "Completed", "da-DK": "Komplet"},"en-GB");
}
}
qt.Save(false);
print(qt.GetProperty(Question_Property_QuestionnaireCompletedText).ToDictionary());//{"": Completed, "da-DK": Komplet}
</source>

Latest revision as of 06:49, 11 May 2022

QuestionnaireProperty



The questionnaire property.

Parent class

Inherits from object

Constructors

  • (PropertyType constant type "Property type. Use constant named Question_Property_xxx", QuestionnaireTemplate questionnaire "Questionnaire template contains this property") - Create new property and add it to questionnaire properties

Methods

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

Properties

  • int Id { get; } - Get id of the questionnaire property
  • bool IsLocalize { get; } - Check value type of property should be use as LocalizedString
  • bool IsSpecialText { get; } - Get IsSpecialText of the questionnaire 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
  • (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

//create new qnaire property
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionnaireProperty p = new QuestionnaireProperty (Question_Property_QuestionnaireCompletedText, qt);
p.Value = new LocalizedString ({"": "Completed", "da-DK": "Komplet"}, "en-GB");
//p.Value.SetTranslation("", "Completed");
//p.Value.SetTranslation("da-DK", "Komplet");
qt.Save(false);
print(qt.GetProperty(Question_Property_QuestionnaireCompletedText).ToDictionary());//{"": Completed, "da-DK": Komplet}
//create new qnaire property or update if existed
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
print(qt.Languages);//{en-GB,da-DK}
LocalizedString a = new LocalizedString ({"": "Completed", "da-DK": "Komplet"}, "en-GBd");
qt.SetProperty(Question_Property_QuestionnaireCompletedText, a);
qt.Save(false);
print(qt.GetProperty(Question_Property_QuestionnaireCompletedText).ToDictionary());//{"": Completed, "da-DK": Komplet}
//update existing qnaire property
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
print(qt.Properties);//{QuestionnaireProperty,...}
for(i for 0; qt.Properties.Count){
	QuestionnaireProperty p = qt.Properties[i];
	if(p.PropertyTypeAsString == "QuestionnaireCompletedText"){
		p.Value = new LocalizedString ({"": "Completed", "da-DK": "Komplet"},"en-GB");
	}		
}
qt.Save(false);
print(qt.GetProperty(Question_Property_QuestionnaireCompletedText).ToDictionary());//{"": Completed, "da-DK": Komplet}