Difference between revisions of "GroupBuilderSampleRuleVariable class"
Nguyenduyan (talk | contribs) |
|||
Line 1: | Line 1: | ||
{{CGscriptClass_Template | {{CGscriptClass_Template | ||
− | |Name=GroupBuilderSampleRuleVariable | + | |Name=<nowiki>GroupBuilderSampleRuleVariable</nowiki> |
− | |Description=Represents a group builder variable for users with no or invalid emails. | + | |Description=<nowiki>Represents a group builder variable for users with no or invalid emails.</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=array|Name=sampleIdList|Description=List of sample ids to add}} | + | {{CGscriptParameters_Template|Type=array|Name=<nowiki>sampleIdList</nowiki>|Description=<nowiki>List of sample ids to add</nowiki>}} |
− | |Description=Add a new sample}} | + | |Description=<nowiki>Add a new sample</nowiki>}} |
− | {{CGscriptMethods_Template|ReturnType= | + | {{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 sample id at index}} | + | |Description=<nowiki>Get sample 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=sampleId|Description=Sample id to remove}} | + | {{CGscriptParameters_Template|Type=int|Name=<nowiki>sampleId</nowiki>|Description=<nowiki>Sample id to remove</nowiki>}} |
− | |Description=Remove sample. Return true if removed}} | + | |Description=<nowiki>Remove sample. 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 samples}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>Count</nowiki>|HasGetter=1|Description=<nowiki>Number of specific samples</nowiki>}} |
− | {{CGscriptProperties_Template|ReturnType=bool|Name=IncludeNoSample|HasGetter=1|HasSetter=1|Description=Include users that have no sample set}} | + | {{CGscriptProperties_Template|ReturnType=bool|Name=<nowiki>IncludeNoSample</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Include users that have no sample set</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=QuestionnaireResourceId|HasGetter=1|HasSetter=1|Description=Questionnaire to get users from}} | + | {{CGscriptProperties_Template|ReturnType=int|Name=<nowiki>QuestionnaireResourceId</nowiki>|HasGetter=1|HasSetter=1|Description=<nowiki>Questionnaire to get users from</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>}} |
}} | }} | ||
Latest revision as of 05:49, 2 July 2020
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();