Review the documentation on Custom Aggregate Functions for full details on developing and implementing this function.
Description | Returns the count of values of dataToAggregate with a corresponding true condition . Only those records with a true condition are included in the count. condition is true if it meets any one of the following conditions:
|
---|---|
Arguments |
|
Namespaces |
|
Example |
To return the number of current products: To return the number of orders whose revenue was greater than $15,000.00: |
Program Code
public class AggCountIf : ICustomAggregator { int count = 0; public void AddValue(SessionInfo sessionInfo, object value, params object[] args) { bool isTrue; double number; if ((bool.TryParse(args[0].ToString(), out isTrue) && isTrue) || (double.TryParse(args[0].ToString(), out number) && number != 0)) ++this.count; } public object Result(SessionInfo sessionInfo) { return this.count; } }