Count
Counts the number of records, rows or times where a condition is true.
Parameters
Name | Default | Meaning |
---|---|---|
name | The name of the value to be written to the frame | |
where | A Substitutable condition - the count increases by 1 for every row that matches the rule. | |
when | A Substitutable condition - the count increases by 1 for every the the rule becomes 'true' |
Description
This function performs a count, either of…
1) The number of rows that match a condition, or
2) The number of times a condition became true
To count each individual row, use the where parameter. This will count each row individually - if we where each value is yes in the table below…
Row # | Value |
---|---|
1 | Yes |
2 | No |
3 | Yes |
4 | Yes |
5 | Yes |
6 | No |
…the answer will be 4, since there are four rows where the value is 'yes'.
Alternatively if we used when instead of where, the answer would be '2', because the value only changed to 'Yes' twice.
Example
If the frame contains the following attributes…
Row # | Value |
---|---|
1 | Yes |
2 | No |
3 | Yes |
4 | Yes |
5 | Yes |
6 | No |
{ "type": "count", "when": "{Value}='Yes'", "name": "Yesses" }
The final results will include a “Yesses” attribute with a value of 2.