GroupBuilderRule class
GroupBuilderRule
Represents a group builder rule.
Parent class
Inherits from object
Constructors
- (GroupBuilderRoot root "Associate with this root collections group") - Create a new rule
Methods
- Empty Add(GroupBuilderVariable variable "Variable to add") - Add a new variable
- object this[] { get; }(int index "Index") - Get variable at index
- bool Remove(GroupBuilderVariable variable "Variable to remove") - Remove variable. Return true if removed
- Empty this[] { set; }(int index "Index", object value "Value to set") - Set variable at index
- (From object) string ToString() - The string representation of the object.
Properties
- int Actual { get; } - How many of the final group amount was generated from this rule
- GroupBuilderRuleCollection Children { get; } - Child rules for this rule
- int Count { get; } - Number of variables at this level
- bool IncludeDeleted { get; set; } - Include deleted users or not
- bool IncludeDisabled { get; set; } - Include disabled users or not
- bool IsLeaf { get; } - True if this rule as no children
- string Name { get; set; } - Name of rule
- string ObjectTypeName { get; } - The name of the type of object.
- int Target { get; set; } - Target amount to build for this group. -1 == all
- number TargetPct { get; set; } - Target as pct of parent. -1 == use Target
- (From object) TypeInformation TypeInformation { get; } - Get information about this class.
Examples
Example: Add new rule
//Create a new group
string groupName = "Test Group Builder: GroupBuilderRule";
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);
GroupBuilderRule rule = new GroupBuilderRule (root);
rule.Name = "Main rule";
print(rule.Actual);
print(rule.Count);
print(rule.IsLeaf);
print(rule.Name);
rule.IncludeDeleted = true;
rule.IncludeDisabled = true;
rule.Target=100;
GroupBuilderRuleCollection ruleColection = root.RootRules;
ruleColection.Add(rule);
root.Save();
Example: Add variable for rule
GroupBuilderRoot root = new GroupBuilderRoot (15560828);
GroupBuilderRuleCollection ruleColection = root.RootRules;
GroupBuilderRule rule = ruleColection[0];
GroupBuilderOptionDataVariable variable1 = new GroupBuilderOptionDataVariable();
GroupBuilderGroupVariable variable2 = new GroupBuilderGroupVariable (true);
GroupBuilderBulkmailVariable variable3 = new GroupBuilderBulkmailVariable ();
rule.Add(variable1);
rule.Add(variable2);
rule.Add(variable3);
root.Save();
Example: remove variable
GroupBuilderRoot root = new GroupBuilderRoot (15560828);
GroupBuilderRuleCollection ruleColection = root.RootRules;
GroupBuilderRule rule = ruleColection[0];
GroupBuilderOptionDataVariable variable1 = rule[0];
rule.Remove(variable1);
root.Save();
Example: Add children rule
GroupBuilderRoot root = new GroupBuilderRoot (15560828);
GroupBuilderRuleCollection rootRules = root.RootRules;
GroupBuilderRule rootRule = rootRules[0];
GroupBuilderRuleCollection supRules = rootRule.Children;
GroupBuilderRule supRule1 = new GroupBuilderRule (root);
supRules.Add(supRule1);
GroupBuilderRule supRule2 = new GroupBuilderRule (root);
supRules.Add(supRule2);
GroupBuilderGroupVariable variable = new GroupBuilderGroupVariable (true);
for (number i=0;i<supRules.Count;i++)
{
supRules[i].IncludeDeleted=true;
supRules[i].IncludeDisabled = true;
supRules[i].TargetPct=20;
supRules[i].Name="subRule "+i;
supRules[i].Add(variable);
}
root.Save();