I’m trying to count the number of recrords which have a certain field value = 1 so I’m using a repeat statement to go through each record. An if/then conditional is used to test for the field value and if true then a countvariable is incremented by 1. This doesn’t seem to work. I have several fields which I want to keep counts of so using the repeat statement seems better than having separate queries to get the totals for each field.
What am I doing wrong?
Hi Rick,
I use COUNT under Aggregate in the DB Query builder. To get a count where a specific condition is met, add the condition in the Conditions tab to filter data.
Add multiple steps if you need to get a count from the same or different table with different conditions.
This is an example:
yes this works. i was just trying to keep track of a bunch of counters so wanted to go row by row which should be possible with repeats. i have no idea why its not working that way. to do it using ibdividual queries with aggregate counts will mean a zillion queries so concerned about perfornance. is there a secret trick to getting repeats to work? ive always struggled with them.
If performance is the main reason for using repeats, then repeats with nested conditions will be slower than running a single query to calculate count of records based on a specific condition.
If you require counts for multiple datasets based on specific conditions, you can group these API steps in a Parellel.
Another option is to create views in the database to calculate counts and then use these views in the server actions.


