RangeCount - script and chart function
RangeCount() returns the number of values, both text and numeric, in the expression or field.
Syntax:
RangeCount(first_expr[, Expression])
Return data type: integer
Arguments:
The arguments of this function may contain inter-record functions which in themselves return a list of values.
Argument | Description |
---|---|
first_expr |
The expression or field containing the data to be counted. |
Expression |
Optional expressions or fields containing the range of data to be counted. |
Limitations:
NULL values are not counted.
Examples and results:
Examples | Results |
---|---|
RangeCount (1,2,4) | Returns 3 |
RangeCount (2,'xyz') | Returns 2 |
RangeCount (null( )) | Returns 0 |
RangeCount (2,'xyz', null()) | Returns 2 |
Example:
Add the example script to your app and run it. To see the result, add the fields listed in the results column to a sheet in your app.
RangeTab3:
LOAD recno() as RangeID, RangeCount(Field1,Field2,Field3) as MyRangeCount INLINE [
Field1, Field2, Field3
10,5,6
2,3,7
8,2,8
18,11,9
5,5,9
9,4,2
];
The resulting table shows the returned values of MyRangeCount for each of the records in the table.
RangeID | MyRangeCount |
---|---|
1 | 3 |
2 | 3 |
3 | 3 |
4 | 3 |
5 | 3 |
6 | 3 |
Example with expression:
RangeCount (Above(MyField,1,3))
Returns the number of values contained in the three results of MyField. By specifying the first argument of the Above() function as 1 and second argument as 3, it returns the values from the first three fields above the current row, where there are sufficient rows, which are taken as input to the RangeCount() function.
Data used in examples:
MyField | RangeCount(Above(MyField,1,3)) |
---|---|
10 | 0 |
2 | 1 |
8 | 2 |
18 | 3 |
5 | 3 |
9 | 3 |
Data used in examples:
RangeTab:
LOAD * INLINE [
MyField
10
2
8
18
5
9
] ;