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.

QuestionGroupLeaf class

From Catglobe Wiki
Revision as of 09:11, 11 May 2022 by Administrator (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

QuestionGroupLeaf


Question group leaf.

Parent class

Inherits from QuestionGroupTree

Constructors

Methods

  • Array of String GetQuestions() - Return label of questions in group
  • Empty SetQuestions(Array of String labels "Question labels") - Set questions in group by their label
  • (From object) string ToString() - The string representation of the object.

Properties


Examples

//Find a group leaf by its question
number qnaireRId = 17148177;
QuestionGroupRoot root = Questionnaire_getQuestionGroups(qnaireRId);
//QuestionGroupRoot root = new QuestionnaireTemplate(new Questionnaire(17148177).TemplateId).Groups;
QuestionGroupLeaf leaf = root.FindByQuestion("Q1");
print(leaf.GroupName);//G1
//create new group leaf
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionGroupLeaf g1 = new QuestionGroupLeaf ("G1", qt);
g1.SetQuestions({"Q1", "Q2"});//Questions must in order
//add the group leaf to group root
array groupRoot = qt.Groups.GetChildGroups();
groupRoot.Add(g1);
qt.Groups.SetChildGroups(groupRoot);
qt.Save(true);
//add more questions for an existing group leaf
Questionnaire qnaire = new Questionnaire (17148177);
QuestionnaireTemplate qt = new QuestionnaireTemplate (qnaire.TemplateId);
QuestionGroupLeaf g1 = qt.Groups.FindByName("G1");
// add more question to questions array
array questions = g1.GetQuestions();
questions.Add("Q3");
g1.SetQuestions(questions);
qt.Save(true);