Difference between revisions of "DCS updateCustomColumn"
Line 1: | Line 1: | ||
− | + | {{HelpFiles}} | |
− | {{HelpFiles}} | ||
− | ====DCS_updateCustomColumn==== | + | ==== DCS_updateCustomColumn ==== |
− | Updates the custom column specified as the argument to the method. The custom column is updated with the state found in the custom column array passed as argument, the column in the DCS is rebuilt and the function returns true. | + | Updates the custom column specified as the argument to the method. The custom column is updated with the state found in the custom column array passed as argument, the column in the DCS is rebuilt and the function returns true. |
− | '''Syntax''' | + | '''Syntax''' |
− | DCS_updateCustomColumn(''customColumn'') | + | DCS_updateCustomColumn(''customColumn'') |
− | '''Arguments''' | + | '''Arguments''' |
− | ''customColumn'': Is an array created by CustomColumn_new function | + | ''customColumn'': Is an array created by CustomColumn_new function |
− | '''Return type''' | + | '''Return type''' |
− | bool | + | bool |
− | '''Examples''' | + | '''Examples''' |
− | array customColumn1 = CustomColumn_new(CUSTOM_COLUMN_TYPE_NUMBER, "AgeGroup"); | + | ''array customColumn1 = CustomColumn_new(CUSTOM_COLUMN_TYPE_NUMBER, "AgeGroup");'' |
− | customColumn1[CUSTOM_COLUMN_TEXT] = "Age groups"; | + | ''customColumn1[CUSTOM_COLUMN_TEXT] = "Age groups";'' |
− | array customColumnOption_Kid = CustomColumnOption_new("Age | + | ''array customColumnOption_Kid = CustomColumnOption_new("Age < 15", 1, "Kid");'' |
− | array customColumnOption_Teen = CustomColumnOption_new("Age == [15-18]", 2, "Teen"); | + | ''array customColumnOption_Teen = CustomColumnOption_new("Age == [15-18]", 2, "Teen");'' |
− | array customColumnOption_Adult = CustomColumnOption_new("Age == [19-45]", 3, "Adult"); | + | ''array customColumnOption_Adult = CustomColumnOption_new("Age == [19-45]", 3, "Adult");'' |
− | |||
− | |||
− | + | ''array customColumnOption_Senior = CustomColumnOption_new("Age > 45", 4, "Senior");'' | |
− | CustomColumn_addOption(customColumn1, | + | ''CustomColumn_addOption(customColumn1, customColumnOption_Kid );'' |
− | CustomColumn_addOption(customColumn1, | + | ''CustomColumn_addOption(customColumn1, customColumnOption_Teen);'' |
− | CustomColumn_addOption(customColumn1, | + | ''CustomColumn_addOption(customColumn1, customColumnOption_Adult);'' |
− | + | ''CustomColumn_addOption(customColumn1, customColumnOption_Senior);'' | |
− | + | ''bool b = DCS_addCustomColumn(customColumn1);'' | |
− | + | ''if (b) print("Custom column 1 was added.");'' | |
− | + | ''else print("Custom column 1 was not added."); //Result: Custom column 1 was added.'' | |
− | + | ''array myCustomColumn = DCS_getCustomColumn("AgeGroup");'' | |
− | + | ''print(myCustomColumn);'' | |
− | // | + | ''//Result: {2,1,AgeGroup,Age groups,{{3,Age < 15,1,Kid},{3,Age == [15-18],2,Teen},{3,Age == [19-45],3,Adult},{3,Age > 45,4,Senior}},} '' |
− | '' | + | ''//----------Update custom column option----------//'' |
− | '' | + | ''number countOptions = CustomColumn_countOptions(customColumn1); '' |
− | |||
− | |||
− | '' | + | ''for (number i = 0; i < countOptions; i = i + 1)'' |
− | '' | + | '' CustomColumn_removeOption(customColumn1, 0);'' |
− | '' | + | ''customColumnOption_Teen = CustomColumnOption_new("Age < 18", 1, "Teen");'' |
− | '' | + | ''customColumnOption_Adult = CustomColumnOption_new("Age == [19-45]", 2, "Adult");'' |
− | '' | + | ''customColumnOption_Senior = CustomColumnOption_new("Age > 45", 3, "Senior");'' |
− | ''CustomColumn_addOption(customColumn1, | + | ''CustomColumn_addOption(customColumn1, customColumnOption_Teen);'' |
− | '' | + | ''CustomColumn_addOption(customColumn1, customColumnOption_Adult);'' |
− | '' | + | ''CustomColumn_addOption(customColumn1, customColumnOption_Senior);'' |
− | '' | + | ''bool c = DCS_updateCustomColumn(customColumn1); '' |
− | ''print( | + | ''if (c) print("Custom column 1 was updated.");'' |
− | ''//Result: | + | ''else print("Custom column 1 was not updated."); //Result: Custom column 1 was updated.'' |
− | '' | + | ''print(customColumn1);'' |
− | Version 5.5 | + | ''//Result: {2,1,AgeGroup,Age groups,{{3,Age < 18,1,Teen},{3,Age == [19-45],2,Adult},{3,Age > 45,3,Senior}},}'' |
− | __NOTOC__ | + | |
− | <!-- imported from file: 5219.htm--> | + | '''Availability''' |
+ | |||
+ | Version 5.5 __NOTOC__ <!-- imported from file: 5219.htm--> | ||
+ | |||
+ | [[Category:Data_cache_modifying_CGScript_functions]] |
Latest revision as of 10:29, 26 December 2011
DCS_updateCustomColumn
Updates the custom column specified as the argument to the method. The custom column is updated with the state found in the custom column array passed as argument, the column in the DCS is rebuilt and the function returns true.
Syntax
DCS_updateCustomColumn(customColumn)
Arguments
customColumn: Is an array created by CustomColumn_new function
Return type
bool
Examples
array customColumn1 = CustomColumn_new(CUSTOM_COLUMN_TYPE_NUMBER, "AgeGroup");
customColumn1[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(customColumn1, customColumnOption_Kid );
CustomColumn_addOption(customColumn1, customColumnOption_Teen);
CustomColumn_addOption(customColumn1, customColumnOption_Adult);
CustomColumn_addOption(customColumn1, customColumnOption_Senior);
bool b = DCS_addCustomColumn(customColumn1);
if (b) print("Custom column 1 was added.");
else print("Custom column 1 was not added."); //Result: Custom column 1 was added.
array myCustomColumn = DCS_getCustomColumn("AgeGroup");
print(myCustomColumn);
//Result: {2,1,AgeGroup,Age groups,{{3,Age < 15,1,Kid},{3,Age == [15-18],2,Teen},{3,Age == [19-45],3,Adult},{3,Age > 45,4,Senior}},}
//----------Update custom column option----------//
number countOptions = CustomColumn_countOptions(customColumn1);
for (number i = 0; i < countOptions; i = i + 1)
CustomColumn_removeOption(customColumn1, 0);
customColumnOption_Teen = CustomColumnOption_new("Age < 18", 1, "Teen");
customColumnOption_Adult = CustomColumnOption_new("Age == [19-45]", 2, "Adult");
customColumnOption_Senior = CustomColumnOption_new("Age > 45", 3, "Senior");
CustomColumn_addOption(customColumn1, customColumnOption_Teen);
CustomColumn_addOption(customColumn1, customColumnOption_Adult);
CustomColumn_addOption(customColumn1, customColumnOption_Senior);
bool c = DCS_updateCustomColumn(customColumn1);
if (c) print("Custom column 1 was updated.");
else print("Custom column 1 was not updated."); //Result: Custom column 1 was updated.
print(customColumn1);
//Result: {2,1,AgeGroup,Age groups,{{3,Age < 18,1,Teen},{3,Age == [19-45],2,Adult},{3,Age > 45,3,Senior}},}
Availability
Version 5.5