More actions
No edit summary |
No edit summary |
||
Line 21: | Line 21: | ||
=== <span style="color:#DF8621">'''Examples'''</span> === | === <span style="color:#DF8621">'''Examples'''</span> === | ||
<source lang="javascript"> | <source lang="javascript"> | ||
number qnaireRId = | //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);