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.

SubQuestion class: Difference between revisions

From Catglobe Wiki
No edit summary
No edit summary
 
(2 intermediate revisions by one other user not shown)
Line 2: Line 2:
|Name=<nowiki>SubQuestion</nowiki>
|Name=<nowiki>SubQuestion</nowiki>
|Description=<nowiki>The sub question template</nowiki>
|Description=<nowiki>The sub question 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 sub question</nowiki>}}
{{CGscriptParameters_Template|Type=QuestionTemplate|Name=<nowiki>question</nowiki>|Description=<nowiki>The question contains this sub question</nowiki>}}
Line 10: Line 10:
|Description=<nowiki>Fetch exist sub question template</nowiki>}}
|Description=<nowiki>Fetch exist sub question 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=int|Name=<nowiki>GridNumber</nowiki>|HasGetter=1|Description=<nowiki>Sub question gridNumber</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>HasData</nowiki>|HasGetter=1|Description=<nowiki>Check if this sub question contains data or not</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>HasData</nowiki>|HasGetter=1|Description=<nowiki>Check if this sub question contains data or not</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Id</nowiki>|HasGetter=1|Description=<nowiki>Sub question id</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Id</nowiki>|HasGetter=1|Description=<nowiki>Sub question 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>Sub question text</nowiki>}}
{{CGscriptProperties_Template|ReturnType=LocalizedString|Name=<nowiki>Text</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Sub question 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>}}
}}
}}
=== <span style="color:#DF8621">'''Examples'''</span> ===
=== <span style="color:#DF8621">'''Examples'''</span> ===
<source lang="javascript">
<source lang="javascript">
// new SubQuestion  
// new SubQuestion of a question
Questionnaire qnaire = new Questionnaire (17148177);
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);

Latest revision as of 03:56, 29 May 2026

SubQuestion


The sub question template

Parent class

Inherits from Array

Constructors

  • (QuestionTemplate question "The question contains this sub question") - Create new sub question and add it into question
  • (int id "Sub question id") - Fetch exist sub question 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
  • int GridNumber { get; } - Sub question gridNumber
  • bool HasData { get; } - Check if this sub question contains data or not
  • int Id { get; } - Sub question 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; } - Sub question text
  • TypeInformation TypeInformation { get; } - Get information about this class.

Examples

// new SubQuestion of a question
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionTemplate q = qt.GetQuestion("Q2");
SubQuestion sq = new SubQuestion (q);
sq.Text = new LocalizedString ({"":"new Sub question"}, "");
qt.Save(true);