This function adds a value to each cell in the specified column of a table.
SppTableColumnAddValue([Table],[Column Index],[Value])
Where:
Table is a table array or the name of a table (this can be any DriveWorks table such as a simple table or calculation table, or the result of a QueryDataValues function).
Column Index is the column of cells to add the value. A number starting at 1 for the first column.
Value is the number to add to each of the cells in the specified column.
A table named MyNumbers containing the following data:
First | Second |
---|---|
4 | 1 |
8 | 2 |
15 | 3 |
16 | 4 |
23 | 5 |
42 | 6 |
Rule | Result | Meaning |
---|---|---|
SppTableColumnAddValue(DwLookupMyNumbers, 2, 10) | {"First","Second";4,11;8,12;15,13;16,14;23,15;42,16} | Will return an array of the table MyNumbers with 10 added to all the values in the second column. |
The result of the above example when viewed as a table.
First | Second |
---|---|
4 | 11 |
8 | 12 |
15 | 13 |
16 | 14 |
23 | 15 |
42 | 16 |
This function can also be used to do subtraction by using a negative number as the Value.
Rule | Result | Meaning |
---|---|---|
SppTableColumnAddValue(DwLookupMyNumbers,1,-1) | {"First","Second";3,1;7,2;14,3;15,4;22,5;41,6} | Will return an array of the table MyNumbers with 1 subtracted to all the values in the first column. |
The result of the above example when viewed as a table.
First | Second |
---|---|
3 | 1 |
7 | 2 |
14 | 3 |
15 | 4 |
22 | 5 |
41 | 6 |