You are here: Core Reference > Coding > Expressions > PRODUCT

PRODUCT

The PRODUCT function is a mathematical function that returns the product of a set of values (the result of value 1 multiplied by value 2 multiplied by value 3 multiplied by value 4 and so on). The product value is a real value.

Function Name

PRODUCT

Description

Returns the product of a set of values (the result of value 1 multiplied by value 2 multiplied by value 3 multiplied by value 4 and so on).

Arguments

PRODUCT(INTEGER or REAL, INTEGER or REAL, INTEGER or REAL...)

The set of values for the PRODUCT calculation consists of comma separated values. The values can be integers or real floating values—see Number (Integer or Real).

There is a PRODUCT extension for use with Data Grids (see below)

Returns

INTEGER or REAL depending on the data type of the inputs.

The result is the product of a set of values.

Example:

PRODUCT(2, 3, 4, 1)

The output is 24 (2X3X4X1).

PRODUCT Extension for Data Grids Only

The PRODUCT function has been extended for use with Data Grids. It can support blocks of cells (arrays) as well as numerical values. This means that you can use fields and rows instead of numerical values in the PRODUCT function (or you can use a combination of blocks, single cells and numbers as required).

Syntax

PRODUCT(<Field1><Row1>, <Field2><Row1>, <Field3><Row1>...)

Where <Field1><Row1> is the name of a field in a row, <Field2><Row1> is the name of another field in the row and so on. Do not enter the angle brackets < >.

For blocks of cells, you have to define the first field and row and the last field and row in the range and separate them with a colon:

PRODUCT(<FirstFieldinRange><FirstRowinRange>:<LastFieldinRange><LastRowinRange>)

NOTE: You can enter the last field first and the first field last if required—ClearSCADA will still recognize the required range.

Example:

PRODUCT(A1:B9)

Where A1 defines the first cell to be used and B9 defines the last cell to be used. The PRODUCT function will use the data from the cells between the A1 cell and the B9 cell in its calculation. If we assume that A1 is the first cell in a field named A and B9 is the 9th cell in a field named B, the PRODUCT function will use the values from the cells in field A and the values from cells 1-9 inclusive from field B in its calculation.

PRODUCT(A1:B9, 3, 75, C6, C8, D11)

Where A1:B9 defines a block of cells (the cells between the A1 cell and the B9 cell), 3 and 75 define numerical values, C6, C8, and D11 define individual cells. The PRODUCT function will use the numerical values and the values from the defined cells (including the cells in the block) in its calculation.


ClearSCADA 2015 R2