Difference between revisions of "DCS updateCustomColumn"

From Catglobe Wiki
Jump to: navigation, search
 
Line 1: Line 1:
[[Category:Data cache modifying CGScript functions]]
+
{{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 < 15", 1, "Kid");
+
''array customColumnOption_Kid = CustomColumnOption_new("Age &lt; 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, customColumnOption_Kid );
+
''array customColumnOption_Senior = CustomColumnOption_new("Age &gt; 45", 4, "Senior");''
  
CustomColumn_addOption(customColumn1, customColumnOption_Teen);
+
''CustomColumn_addOption(customColumn1, customColumnOption_Kid );''
  
CustomColumn_addOption(customColumn1, customColumnOption_Adult);
+
''CustomColumn_addOption(customColumn1, customColumnOption_Teen);''
  
CustomColumn_addOption(customColumn1, customColumnOption_Senior);
+
''CustomColumn_addOption(customColumn1, customColumnOption_Adult);''
  
bool b = DCS_addCustomColumn(customColumn1);
+
''CustomColumn_addOption(customColumn1, customColumnOption_Senior);''
  
if (b) print("Custom column 1 was added.");
+
''bool b = DCS_addCustomColumn(customColumn1);''
  
else print("Custom column 1 was not added."); //Result: Custom column 1 was added.
+
''if (b) print("Custom column 1 was added.");''
  
array myCustomColumn = DCS_getCustomColumn("AgeGroup");
+
''else print("Custom column 1 was not added."); //Result: Custom column 1 was added.''
  
print(myCustomColumn);
+
''array myCustomColumn = DCS_getCustomColumn("AgeGroup");''
  
//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}},}
+
''print(myCustomColumn);''
  
//----------Update custom column option-------1---//
+
''//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}},} ''
  
''number countOptions = CustomColumn_countOptions(customColumn1); ''
+
''//----------Update custom column option----------//''  
  
''for (number i = 0; i < countOptions; i = i + 1)''
+
''number countOptions = CustomColumn_countOptions(customColumn1); ''
 
  CustomColumn_removeOption(customColumn1, 0);
 
  
''customColumnOption_Teen = CustomColumnOption_new("Age < 18", 1, "Teen");''
+
''for (number i = 0; i &lt; countOptions; i = i + 1)''  
  
''customColumnOption_Adult = CustomColumnOption_new("Age == [19-45]", 2, "Adult");''
+
''&nbsp; CustomColumn_removeOption(customColumn1, 0);''  
  
''customColumnOption_Senior = CustomColumnOption_new("Age > 45", 3, "Senior");''
+
''customColumnOption_Teen = CustomColumnOption_new("Age &lt; 18", 1, "Teen");''  
  
''CustomColumn_addOption(customColumn1, customColumnOption_Teen);''
+
''customColumnOption_Adult = CustomColumnOption_new("Age == [19-45]", 2, "Adult");''  
  
''CustomColumn_addOption(customColumn1, customColumnOption_Adult);''
+
''customColumnOption_Senior = CustomColumnOption_new("Age &gt; 45", 3, "Senior");''  
  
''CustomColumn_addOption(customColumn1, customColumnOption_Senior);''
+
''CustomColumn_addOption(customColumn1, customColumnOption_Teen);''  
  
''bool c = DCS_updateCustomColumn(customColumn1); ''
+
''CustomColumn_addOption(customColumn1, customColumnOption_Adult);''  
  
''if (c) print("Custom column 1 was updated.");''
+
''CustomColumn_addOption(customColumn1, customColumnOption_Senior);''  
  
''else print("Custom column 1 was not updated."); //Result: Custom column 1 was updated.''
+
''bool c = DCS_updateCustomColumn(customColumn1); ''  
  
''print(customColumn1);''
+
''if (c) print("Custom column 1 was updated.");''  
  
''//Result: {2,1,AgeGroup,Age groups,{{3,Age < 18,1,Teen},{3,Age == [19-45],2,Adult},{3,Age > 45,3,Senior}},}''
+
''else print("Custom column 1 was not updated."); //Result: Custom column 1 was updated.''  
  
'''Availability'''
+
''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