Development tools : Global functions : List and Table category : tableAdd
  
tableAdd
Description
Add a numeric value to the given column of the 'IColl' List.
Usage
Client side: N
Server side: Y
Syntax
IndexedCollection tableAdd(IndexedCollection iColl, String columnName, Number number)
Arguments
iColl
The table to be calculated. The argument requires IndexedCollection type data.
columnName
The name in string of column in table. The argument requires existed column name in iColl table.
number
The value in double to be added. The argument can be any number.
Return
Returns the table to be added by number. If any of argument is null, null will be returned. If the specified columnName is not found in table, the table with the same content of 'iColl' table will be returned.
Exception
IllegalArgumentException
If the column specified by columnName does not contain data in number type, IllegalArgumentException will be thrown. User need to ensure the column specified by columnName contains number type data.
Example
The example returns a new indexed collection in which "accountAmount" column of each element is added by 50 comparing the original "accountList" indexed collection. In this example, the original "accountList" contains two elements: "accountA" in index 0 and "accountB" in index 1, each of them contains a field named "accountAmount", as shown in the following iColl structure definition:
<iColl>accountList
<kColl>acountA
<field>accountId: '1001'
<field>accountAmount: 1000.25
<kColl>accountB
<field>accountId: '1002'
<field>accountAmount: 10000.45
tableAdd(accountList,'accountAmount' 50) returns a table with following value:
<iColl>accountList
<kColl>acountA
<field>accountId: '1001'
<field>accountAmount: 1050.25
<kColl>accountB
<field>accountId: '1002'
<field>accountAmount: 10050.45
See also
List and Table category