GroupBuilderParticipationPeriodVariable class

From Catglobe Wiki
Jump to: navigation, search

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();