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.

SubQuestion class: Difference between revisions

From Catglobe Wiki
Created page with "{{CGscriptClass_Template |Name=<nowiki>SubQuestion</nowiki> |Description=<nowiki>The sub question template</nowiki> |InheritsFrom=object|Constructors= {{CGscriptConstructors_T..."
 
No edit summary
Line 18: Line 18:
{{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|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
}}
}}
=== <span style="color:#DF8621">'''Examples'''</span> ===
<source lang="javascript">
// new SubQuestion
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);
</source>

Revision as of 05:10, 11 May 2022

SubQuestion



The sub question template

Parent class

Inherits from object

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

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

Properties

  • bool HasData { get; } - Check if this sub question contains data or not
  • int Id { get; } - Sub question id
  • string ObjectTypeName { get; } - The name of the type of object.
  • LocalizedString Text { get; set; } - Sub question text
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.

Examples

// new SubQuestion 
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);