...MathOp Functions
The following functions carry out operations (summation, subtraction, average
computing, etc.) over a set of records and differ only in the type of the source
of records.
- folMathOp (FolderID, FormID, |Field|,
|Operation|) - records are retrieved from the folder with FolderID.
- mmrMathOp (|RelationalField|, |Field|, |Operation|) -
records are retrieved from the many-to-many field (the RelationalField parameter).
- setMathOp (|VariableName|, |Field|, |Operation|) -
records are retrieved from the variable with the VariableName name.
- queMathOp (QueryID, FormID, |Field|,
|Operation|, Var1, Var2) - records are generated on the basis of the
query with QueryID. You can use the optional variables Var1 and Var2 to set the User Input query parameters.
The following 3 functions can be used only with the Report Styles or
Export/Send templates:
- repMathOp (|Field|, |Operation|) - operation over records selected in the report (for
printing).
- subMathOp (|Field|, |Operation|) -
operation over records grouped into the report (for
printing).
- cexMathOp (|Field|, |Operation|) - operation over records selected in Custom Export.
The Field parameter defines the record field over which the operation
is to be carried out.
The Operation parameter defines the operation itself. For example,
there are three records with values 1, 2 and 3. Then:
- Sum - sums values (1+2+3=6);
- SumOfSquares - calculates the sum of squares (1*1+2*2+3*3=14);
- SimpleAverage - calculates simple average ((1+2+3)/3=2)
;
- Quantity - returns the number of records (=3);
- Min - returns the smallest value of the set (=1);
- Max - returns the greatest value of the set (=3);
- First - returns the first value of the set (=1);
- Last - returns the last value of the set (=3)
.
Examples: Let's assume that we have 2 records in the folder with ID=7. The records use the form with ID=9 and have the Price field.
The Price field contains the following values: 3 and 4.
folMathOp(7,9,|Price|, |Sum|), returns 3+4=7;
folMathOp(7,9,|Price|, |SumOfSquares|), returns 3*3+4*4=9+16=25;
folMathOp(7,9,|Price|, |SimpleAverage|), returns (3+4)/2=3.5;
folMathOp(7,9,|Price|, |Quantity|), returns 2.
...RecN Functions
RecN functions are a particular case of the MathOp functions that return the number of records in the selection:
folRecN, mmrRecN, setRecN, queRecN, repRecN, subRecN, cexRecN
| |
|
|
All topics in the "Functions Description" section:
|
|