This function multiplies each cell in the specified column of a table by a value.
SppTableColumnMultiplyByValue([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 multiply each of the cells in the specified column by.
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 |
---|---|---|
SppTableColumnMultiplyByValue(DwLookupMyNumbers, 2, 100) | {"First","Second";4,100;8,200;15,300;16,400;23,500;42,600} | Will return the table MyNumbers with all the values in the second column multiplied by 100. |
The result of the above example when viewed as a table.
First | Second |
---|---|
4 | 100 |
8 | 200 |
15 | 300 |
16 | 400 |
23 | 500 |
42 | 600 |
This function can also be used to do division by using a decimal or fraction as the Value.
Rule | Result | Meaning |
---|---|---|
SppTableColumnMultiplyByValue(DwLookupMyNumbers, 1, 0.5)
Or SppTableColumnMultiplyByValue(DwLookupMyNumbers, 1, 1/2) | {"First","Second";2,1;4,2;7.5,3;8,4;11.5,5;21,6} | Will return the array all the values in the first column divided by 2. |
The result of the above example when viewed as a table.
First | Second |
---|---|
2 | 1 |
4 | 2 |
7.5 | 3 |
8 | 4 |
11.5 | 5 |
21 | 6 |