Toggle menu
913
3.8K
30.2K
279.2K
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

AnswerOption class: Difference between revisions

From Catglobe Wiki
No edit summary
No edit summary
 
Line 2: Line 2:
|Name=<nowiki>AnswerOption</nowiki>
|Name=<nowiki>AnswerOption</nowiki>
|Description=<nowiki>The answer option template</nowiki>
|Description=<nowiki>The answer option template</nowiki>
|InheritsFrom=object|Constructors=
|InheritsFrom=Array|Constructors=
{{CGscriptConstructors_Template|Parameters=
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=QuestionTemplate|Name=<nowiki>question</nowiki>|Description=<nowiki>The question contains this answer option</nowiki>}}
{{CGscriptParameters_Template|Type=QuestionTemplate|Name=<nowiki>question</nowiki>|Description=<nowiki>The question contains this answer option</nowiki>}}
Line 10: Line 10:
|Description=<nowiki>Fetch exist answer option template</nowiki>}}
|Description=<nowiki>Fetch exist answer option template</nowiki>}}
|Methods=
|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>|Description=<nowiki>The string representation of the object.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}}
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>this[] { get; }</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=object|Name=<nowiki>value</nowiki>|Description=<nowiki>Value to set</nowiki>}}
|Description=<nowiki>Backward-compatible indexer</nowiki>}}
|Properties=
|Properties=
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Average</nowiki>|HasGetter=1|Description=<nowiki>Average of the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>HasData</nowiki>|HasGetter=1|Description=<nowiki>Check if this answer option contains data or not</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>HasData</nowiki>|HasGetter=1|Description=<nowiki>Check if this answer option contains data or not</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Id</nowiki>|HasGetter=1|Description=<nowiki>Answer option id</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Id</nowiki>|HasGetter=1|Description=<nowiki>Answer option id</nowiki>}}
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Max</nowiki>|HasGetter=1|Description=<nowiki>Largest of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
{{CGscriptProperties_Template|ReturnType=number|Name=<nowiki>Min</nowiki>|HasGetter=1|Description=<nowiki>Smallest of all the objects in the Array object. Can only use if all the elements are of type Number</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=number|Name=<nowiki>Sum</nowiki>|HasGetter=1|Description=<nowiki>Sum of all the objects in the Array object. Can only use if all the elements are of type Number</nowiki>}}
{{CGscriptProperties_Template|ReturnType=LocalizedString|Name=<nowiki>Text</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Answer option text</nowiki>}}
{{CGscriptProperties_Template|ReturnType=LocalizedString|Name=<nowiki>Text</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Answer option text</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|Description=<nowiki>Get information about this class.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Value</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Answer option value</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Value</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Answer option value</nowiki>}}
}}
}}

Latest revision as of 03:59, 29 May 2026

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);