Difference between revisions of "GroupBuilderParticipationPeriodVariable class"

From Catglobe Wiki
Jump to: navigation, search
(Created page with "{{CGscriptClass_Template |Name=GroupBuilderParticipationPeriodVariable |Description=Represents a group builder variable for users that has participated in a list of questionna...")
 
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
 
{{CGscriptClass_Template
 
{{CGscriptClass_Template
|Name=GroupBuilderParticipationPeriodVariable
+
|Name=<nowiki>GroupBuilderParticipationPeriodVariable</nowiki>
|Description=Represents a group builder variable for users that has participated in a list of questionnaires.
+
|Description=<nowiki>Represents a group builder variable for users that has participated in a list of questionnaires.</nowiki>
|Constructors=
+
|InheritsFrom=GroupBuilderVariable|Constructors=
{{CGscriptConstructors_Template|Description=Create new variable}}
+
{{CGscriptConstructors_Template|Description=<nowiki>Create new variable</nowiki>}}
 
|Methods=
 
|Methods=
{{CGscriptMethods_Template|ReturnType=Empty|Name=Add|Parameters=
+
{{CGscriptMethods_Template|ReturnType=Empty|Name=<nowiki>Add</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=int|Name=questionnaireResourceId|Description=Questionnaire resource id to add}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id to add</nowiki>}}
|Description=Add a new questionnaire}}
+
|Description=<nowiki>Add a new questionnaire</nowiki>}}
{{CGscriptMethods_Template|ReturnType=int|Name=this[] { get; }|Parameters=
+
{{CGscriptMethods_Template|ReturnType=object|Name=<nowiki>this[] { get; }</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=int|Name=index|Description=Index}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>index</nowiki>|Description=<nowiki>Index</nowiki>}}
|Description=Get questionnaire resource id at index}}
+
|Description=<nowiki>Get questionnaire resource id at index</nowiki>}}
{{CGscriptMethods_Template|ReturnType=bool|Name=Remove|Parameters=
+
{{CGscriptMethods_Template|ReturnType=bool|Name=<nowiki>Remove</nowiki>|Parameters=
{{CGscriptParameters_Template|Type=int|Name=questionnaireResourceId|Description=Questionnaire resource id to remove}}
+
{{CGscriptParameters_Template|Type=int|Name=<nowiki>questionnaireResourceId</nowiki>|Description=<nowiki>Questionnaire resource id to remove</nowiki>}}
|Description=Remove questionnaire. Return true if removed}}
+
|Description=<nowiki>Remove questionnaire. Return true if removed</nowiki>}}
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
+
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}}
 
|Properties=
 
|Properties=
{{CGscriptProperties_Template|ReturnType=int|Name=Count|HasGetter=1|Description=Number of specific questionnaires}}
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Count</nowiki>|HasGetter=1|Description=<nowiki>Number of specific questionnaires</nowiki>}}
{{CGscriptProperties_Template|ReturnType=DateTime|Name=FromDate|HasGetter=1|HasSetter=1|Description=From date}}
+
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>FromDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>From date</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=FromDateStartDate|HasGetter=1|HasSetter=1|Description=From date is the start date, or if false the end date}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>FromDateStartDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>From date is the start date, or if false the end date</nowiki>}}
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
+
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=int|Name=ResourceTemplateResourceId|HasGetter=1|HasSetter=1|Description=Questionnaire resource template to get users from, instead of individual questionnaires}}
+
{{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>ResourceTemplateResourceId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Questionnaire resource template to get users from, instead of individual questionnaires</nowiki>}}
{{CGscriptProperties_Template|ReturnType=DateTime|Name=ToDate|HasGetter=1|HasSetter=1|Description=To date}}
+
{{CGscriptProperties_Template|ReturnType=DateTime|Name=<nowiki>ToDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>To date</nowiki>}}
{{CGscriptProperties_Template|ReturnType=bool|Name=ToDateStartDate|HasGetter=1|HasSetter=1|Description=To date is the start date, or if false the end date}}
+
{{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>ToDateStartDate</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>To date is the start date, or if false the end date</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
+
{{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> ===
 +
'''Example: Add questionnaire'''
 +
<source lang="javascript">
 +
//Create a new group
 +
string groupName = "Test Group Builder: participationPeriodVariable";
 +
number groupTemplateResourceId=2066;
 +
number parentResourceId = 11088827;
 +
array group = Group_new(groupName, groupTemplateResourceId, parentResourceId);
 +
Group_save(group);
 +
number groupRId = group[GROUP_RESOURCE_ID ];
 +
//Create rule for the group
 +
GroupBuilderRoot root = new GroupBuilderRoot (groupRId);
 +
GroupBuilderParticipationPeriodVariable participationPeriodVariable = new GroupBuilderParticipationPeriodVariable();
 +
number questionnaireResourceId = 15546533 ;
 +
participationPeriodVariable.Add(questionnaireResourceId );
 +
participationPeriodVariable.Add(15559234 );
 +
participationPeriodVariable.ResourceTemplateResourceId = 43086;
 +
DateTime date = new DateTime("2017-4-19");
 +
participationPeriodVariable.FromDate = date;
 +
participationPeriodVariable.ToDate = date;
 +
participationPeriodVariable.FromDateStartDate= false;
 +
participationPeriodVariable.ToDateStartDate= false;
 +
GroupBuilderRule rule = new GroupBuilderRule (root);
 +
rule.Add(participationPeriodVariable);
 +
GroupBuilderRuleCollection ruleColection = root.RootRules;
 +
ruleColection.Add(rule);
 +
root.Save();
 +
</source>
 +
<br/>
 +
'''Example: Remove questionnaire'''
 +
<source lang="javascript">
 +
GroupBuilderRoot root = new GroupBuilderRoot (15560826);
 +
GroupBuilderRuleCollection ruleColection = root.RootRules;
 +
GroupBuilderParticipationPeriodVariable participationPeriodVariable = ruleColection[0][0];
 +
print(participationPeriodVariable.Count);//2
 +
number questionnaireResourceId = participationPeriodVariable[1];
 +
participationPeriodVariable.Remove(questionnaireResourceId);
 +
print(participationPeriodVariable.Count);//1
 +
root.Save();
 +
</source>

Latest revision as of 07:50, 2 July 2020

GroupBuilderParticipationPeriodVariable


Represents a group builder variable for users that has participated in a list of questionnaires.

Parent class

Inherits from GroupBuilderVariable

Constructors

  • () - Create new variable

Methods

  • Empty Add(int questionnaireResourceId "Questionnaire resource id to add") - Add a new questionnaire
  • object this[] { get; }(int index "Index") - Get questionnaire resource id at index
  • bool Remove(int questionnaireResourceId "Questionnaire resource id to remove") - Remove questionnaire. Return true if removed
  • (From object) string ToString() - The string representation of the object.

Properties

  • int Count { get; } - Number of specific questionnaires
  • DateTime FromDate { get; set; } - From date
  • bool FromDateStartDate { get; set; } - From date is the start date, or if false the end date
  • string ObjectTypeName { get; } - The name of the type of object.
  • int ResourceTemplateResourceId { get; set; } - Questionnaire resource template to get users from, instead of individual questionnaires
  • DateTime ToDate { get; set; } - To date
  • bool ToDateStartDate { get; set; } - To date is the start date, or if false the end date
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.


Examples

Example: Add questionnaire

//Create a new group
string groupName = "Test Group Builder: participationPeriodVariable";
number groupTemplateResourceId=2066;
number parentResourceId = 11088827;
array group = Group_new(groupName, groupTemplateResourceId, parentResourceId);
Group_save(group);
number groupRId = group[GROUP_RESOURCE_ID ]; 
//Create rule for the group
GroupBuilderRoot root = new GroupBuilderRoot (groupRId);
GroupBuilderParticipationPeriodVariable participationPeriodVariable = new GroupBuilderParticipationPeriodVariable();
number questionnaireResourceId = 15546533 ;
participationPeriodVariable.Add(questionnaireResourceId );
participationPeriodVariable.Add(15559234 );
participationPeriodVariable.ResourceTemplateResourceId = 43086;
DateTime date = new DateTime("2017-4-19");
participationPeriodVariable.FromDate = date;
participationPeriodVariable.ToDate = date;
participationPeriodVariable.FromDateStartDate= false;
participationPeriodVariable.ToDateStartDate= false; 
GroupBuilderRule rule = new GroupBuilderRule (root);
rule.Add(participationPeriodVariable); 
GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule); 
root.Save();


Example: Remove questionnaire

GroupBuilderRoot root = new GroupBuilderRoot (15560826);
GroupBuilderRuleCollection ruleColection = root.RootRules;
GroupBuilderParticipationPeriodVariable participationPeriodVariable = ruleColection[0][0];
print(participationPeriodVariable.Count);//2
number questionnaireResourceId = participationPeriodVariable[1];
participationPeriodVariable.Remove(questionnaireResourceId);
print(participationPeriodVariable.Count);//1
root.Save();