GroupBuilderSampleRuleVariable class
GroupBuilderSampleRuleVariable
Represents a group builder variable for users with no or invalid emails.
Parent class
Inherits from GroupBuilderVariable
Constructors
- () - Create new variable
Methods
- Empty Add(array sampleIdList "List of sample ids to add") - Add a new sample
- object this[] { get; }(int index "Index") - Get sample id at index
- bool Remove(int sampleId "Sample id to remove") - Remove sample. Return true if removed
- (From object) string ToString() - The string representation of the object.
Properties
- int Count { get; } - Number of specific samples
- bool IncludeNoSample { get; set; } - Include users that have no sample set
- string ObjectTypeName { get; } - The name of the type of object.
- int QuestionnaireResourceId { get; set; } - Questionnaire to get users from
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
Examples
Example: Add new sample
//Create a new group
string groupName = "Test Group Builder: sampleRuleVariable";
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);
GroupBuilderSampleRuleVariable sampleRuleVariable = new GroupBuilderSampleRuleVariable();
sampleRuleVariable.QuestionnaireResourceId = 15546533;
sampleRuleVariable.IncludeNoSample = true;
sampleRuleVariable.Add({58378,58385});
GroupBuilderRule rule = new GroupBuilderRule (root);
rule.Add(sampleRuleVariable);
GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule);
root.Save();
Example: Remove sample
GroupBuilderRoot root = new GroupBuilderRoot (15560808);
GroupBuilderRuleCollection ruleColection = root.RootRules;
GroupBuilderSampleRuleVariable sampleRuleVariable = ruleColection [0][0];
print(sampleRuleVariable.Count);//2
sampleRuleVariable.Remove(sampleRuleVariable[0]);
print(sampleRuleVariable.Count);//1
root.Save();