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

QuestionGroupRoot class: Difference between revisions

From Catglobe Wiki
No edit summary
No edit summary
 
Line 21: Line 21:


=== <span style="color:#DF8621">'''Examples'''</span> ===
=== <span style="color:#DF8621">'''Examples'''</span> ===
<span style="color:#DF8621"> QuestionGroupRoot is returned when calling [[Questionnaire_getQuestionGroups]]</span>
<source lang="javascript">
<source lang="javascript">
number qnaireRId = 15644704;
//get question groups from Questionnaire_getQuestionGroups
number qnaireRId = 17148177;
QuestionGroupRoot root = Questionnaire_getQuestionGroups(qnaireRId);
QuestionGroupRoot root = Questionnaire_getQuestionGroups(qnaireRId);
</source>
<source lang="javascript">
//get question groups from QuestionnaireTemplate
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
qt.Groups;//QuestionGroupRoot
array a = qt.Groups.GetChildGroups();//{QuestionGroupLeaf,QuestionGroupBranch, ...}
</source>
<source lang="javascript">
//create new group branch and leaf
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionGroupBranch g1 = new QuestionGroupBranch ("G1", qt);
QuestionGroupLeaf g2 = new QuestionGroupLeaf ("G2", qt);
g2.SetQuestions({"Q1", "Q2"});//Questions must in order
g1.SetChildGroups({g2});
//add new group to group root
array groupRoot = qt.Groups.GetChildGroups();
groupRoot.Add(g1);
qt.Groups.SetChildGroups(groupRoot);
qt.Save(true);
</source>
</source>

Latest revision as of 08:58, 11 May 2022

QuestionGroupRoot



Information about question groups in questionnaire.

Parent class

Inherits from object

Methods

  • QuestionGroupTree FindByName(string name "Question group name") - Find a question group by name
  • QuestionGroupLeaf FindByQuestion(string label "Question label") - Find the question group that contains the given question
  • Array of QuestionGroupTree GetChildGroups() - Return all child groups.
  • Array of string GetPermutation() - Get a sequence of questions following the question group rules
  • Empty SetChildGroups(Array of QuestionGroupTree groups "Question groups") - Set root question groups
  • (From object) string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.


Examples

//get question groups from Questionnaire_getQuestionGroups
number qnaireRId = 17148177;
QuestionGroupRoot root = Questionnaire_getQuestionGroups(qnaireRId);
//get question groups from QuestionnaireTemplate 
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
qt.Groups;//QuestionGroupRoot
array a = qt.Groups.GetChildGroups();//{QuestionGroupLeaf,QuestionGroupBranch, ...}
//create new group branch and leaf
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionGroupBranch g1 = new QuestionGroupBranch ("G1", qt);
QuestionGroupLeaf g2 = new QuestionGroupLeaf ("G2", qt);
g2.SetQuestions({"Q1", "Q2"});//Questions must in order
g1.SetChildGroups({g2});
//add new group to group root
array groupRoot = qt.Groups.GetChildGroups();
groupRoot.Add(g1);
qt.Groups.SetChildGroups(groupRoot);
qt.Save(true);