Difference between revisions of "SubQuestion class"

From Catglobe Wiki
Jump to: navigation, search
Line 20: Line 20:
 
=== <span style="color:#DF8621">'''Examples'''</span> ===
 
=== <span style="color:#DF8621">'''Examples'''</span> ===
 
<source lang="javascript">
 
<source lang="javascript">
// new SubQuestion  
+
// new SubQuestion of a quesion
 
Questionnaire qnaire = new Questionnaire (17148177);
 
Questionnaire qnaire = new Questionnaire (17148177);
 
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
 
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);

Revision as of 07: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 of a quesion
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);