AnswerOption class
From Catglobe Wiki
More actions
AnswerOption
The answer option template
Parent class
Inherits from Array
Constructors
- (QuestionTemplate question "The question contains this answer option") - Create new answer option and add it into question. Default its value is max options + 1
- (int id "Answer option id") - Fetch exist answer option template
Methods
- string ToString() - The string representation of the object.
- object this[] { get; }(int index "Index") - Backward-compatible indexer
- Empty this[] { get; }(int index "Index", object value "Value to set") - Backward-compatible indexer
Properties
- number Average { get; } - Average of the objects in the Array object. Can only use if all the elements are of type Number
- bool HasData { get; } - Check if this answer option contains data or not
- int Id { get; } - Answer option id
- number Max { get; } - Largest of all the objects in the Array object. Can only use if all the elements are of type Number
- number Min { get; } - Smallest of all the objects in the Array object. Can only use if all the elements are of type Number
- string ObjectTypeName { get; } - The name of the type of object.
- number Sum { get; } - Sum of all the objects in the Array object. Can only use if all the elements are of type Number
- LocalizedString Text { get; set; } - Answer option text
- TypeInformation TypeInformation { get; } - Get information about this class.
- int Value { get; set; } - Answer option value
Examples
// new AnswerOption for a question
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionTemplate q = qt.GetQuestion("Q1");
AnswerOption ao = new AnswerOption (q);
ao.Text.SetTranslation ("", "Option 3");
qt.Save(true);