Reduce (FPScript)
Reduces the number of values in a data set.
Syntax
Reduce(DataSet, [ ReductionFactor = 1 ] [ , Position = 0 ])
The syntax of the Reduce function consists of the following parts:
Part |
Description |
---|---|
DataSet |
The data set whose number of values is to be reduced. All data structures are allowed, except scalar value und list. Not supported data types arestring. If the argument is a list, then the function is executed for each element of the list and the result is also a list. |
ReductionFactor |
An integral factor that specifies by how much the number of values is to be reduced. Permitted data structures are scalar value. All integral data types are permitted. The value must be greater or equal to 1. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value 1. |
Position |
Specifies the position of the first value to be extracted. If you omit the argument, the extraction will start with the first value. Permitted data structures are scalar value. All integral data types are permitted. If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated. If this argument is omitted, it will be set to the default value 0. |
Remarks
The result has the same unit as the argument DataSet.
The reduction is achieved by copying only every nth value into the result data set.
Available in
FlexPro View, Basic, Professional, Developer Suite
Examples
Reduce({3, 5, 4, 2, 7, 6, 8, 1}, 2) |
Results in {3, 4, 7, 8}. |
Reduce({3, 5, 4, 2, 7, 6, 8, 1}, 2, 1) |
Results in {5, 2, 6, 1}. |