QuestionnaireProperty class

From Catglobe Wiki
Jump to: navigation, search

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}