ERXArrayUtilities.AvgNonNullOperator Class Reference
List of all members.
Detailed Description
Define an
NSArray.Operator for the key
avgNonNull.
This allows for key value paths like:
-
myArray.valueForKey("@avgNonNull.payment.amount");
-
myArray.valueForKey("payment.@avgNonNull.amount");
-
myArray.valueForKey("payment.amount.@avgNonNull");
which will sum up all values for the key amount and divide by the number of nun-null entries. applies to the array of objects to its left if it is the last key in the path. Otherwise it applies to the end of the keypath to its right. It should not be followed by an array or any other array operators. This is because it does not call
valueForKeyPath on the array to its left, but instead loops through the values of the array to its left, calling
valueForKeyPath on the individual array values instead. This behavior is consistent with Apple's standard
NSArray operators.
Constructor & Destructor Documentation
Member Function Documentation
| Object compute |
( |
NSArray<?> |
array, |
|
|
String |
keypath | |
|
) |
| | |
returns the average value for over all non-null values.
- Parameters:
-
| array | array to be checked. |
| keypath | path to numeric values |
- Returns:
- computed average as BigDecimal or
NULL.
The documentation for this class was generated from the following file: