Difference between revisions of "CustomColumn addOption"
(jrfconvert import) |
Cg huyphong (talk | contribs) |
||
(One intermediate revision by one other user not shown) | |||
Line 1: | Line 1: | ||
− | [[Category: | + | [[Category:Data cache modifying CGScript functions]] |
− | | + | {{HelpFiles}} |
====CustomColumn_addOption==== | ====CustomColumn_addOption==== |
Latest revision as of 10:46, 12 December 2011
CustomColumn_addOption
Adds a custom column option to the end of the options array for the custom column passed as argument to the method. The custom column option is added to the custom column and the method returns the index positioning it among the custom column options for the custom column.
Important: the order of adding options to custom column does matter much. The script will be generated as:
if(expression for custom column option 0)
{return value for custom column 0;}
else if(expression for custom column 1)
{return value for custom column option 1;}
...
else if(expression for custom column n – 1)
{return value for custom column option n - 1}
else {return empty;}
Syntax
CustomColumn_addOption(customColumn, customColumnOption)
Arguments
customColumn: is an array. It is the custom column array returned by CustomColumn_new function.
customColumnOption: is an array. It is the custom column option array returned by CustomColumnOption_new function.
Return type
Number
Examples
array customColumn = CustomColumn_new(CUSTOM_COLUMN_TYPE_NUMBER, "AgeGroup");
customColumn[CUSTOM_COLUMN_TEXT] = "Age groups";
array customColumnOption_Kid = CustomColumnOption_new("Age < 15", 1, "Kid");
array customColumnOption_Teen = CustomColumnOption_new("Age == [15-18]", 2, "Teen");
array customColumnOption_Adult = CustomColumnOption_new("Age == [19-45]", 3, "Adult");
array customColumnOption_Senior = CustomColumnOption_new("Age > 45", 4, "Senior");
CustomColumn_addOption(customColumn, customColumnOption_Kid );
CustomColumn_addOption(customColumn, customColumnOption_Teen);
CustomColumn_addOption(customColumn, customColumnOption_Adult);
CustomColumn_addOption(customColumn, customColumnOption_Senior);
DCS_addCustomColumn(customColumn);
/*the custom column's script will be similar to this:
if (Age < 15)
{return 1;}
else if (Age == [15-18])
{return 2;}
else if (Age == [19-45])
{return 3;}
else if (Age > 45)
{return 4;}
else return empty;
*/
Availability
Version 5.5