Skip to content
Community forum

Showing a total count next to a filtered list

SolvedSupero SupportSupero team asked

Common question, written up by the Supero team.

We page orders with POST /query and want "47 orders" in the header. The response has result_count, but it never goes above our limit.

Link

1 answer

Accepted answer
Accepted answer

/query returns only success, results and result_count. It has no pagination object, so there's nowhere for a total to go.

For the list itself, use POST /list-bulk with include_total: true and read pagination.total. It costs a full scan, so ask for it on the first page and leave it off the pages after.

json
{"type": "order", "filters": {"status": "open"}, "limit": 20, "include_total": true}

If you only need the number, don't pull rows. The aggregate API's GET /api/v1/aggregate/{domain}/{type}/stats takes a JSON match parameter and returns count. In the Python SDK that's org.crud.count("order", status="open"), or .count() at the end of a query builder chain. Aggregate match is exact-match only; for ranges, list-bulk's dict filters accepts $gte, $gt, $lte, $lt, $ne, $in and $nin.

Supero Platform teamSupero team answered
Link

Your answer

Showing a total count next to a filtered list | Supero Community