DocsFQL syntax reference
On this page

Aggregates reference

Look up counts, sums and transaction totals.

Before you begin: Selectors and aggregates reference.

Aggregates

Aggregates are exposed as special path segments.

SyntaxResult
$transactions.{$where: {status:'successful'}}.$countCount matching current-user transactions.
$transactions.{$where: {status:'successful'}}.$sum.requestedAmountSum requestedAmount on matching current-user transactions.
$posts.investments.{$where: {status:'active'}}.$countCount matching posts.
$posts.investments.{$where: {status:'active'}}.$sum.amountSum the amount field on matching posts.

For post fields declared as money in FRL, sums use the active site currency. Ordinary number fields continue to return numeric totals.

For sums, the field is written after $sum:

text

Function calls are written as path segments. The resolved value before .functionName() is passed to the browser function:

text

Frontbacked returns the aggregate first, then passes that value to the registered function. Function arguments are supported, but the aggregate field still belongs after $sum: $sum.requestedAmount.formatMoney('USD'), not $sum(requestedAmount).

Older themes may still use $counts, but new FQL should use $count.

When summing paidAmount, filter by paidCurrency or another single-method condition to avoid summing mixed units:

text

Transaction rows expose the stored status. Completed payments currently appear as successful in FQL transaction filters and rows. FRL payment events expose the same completion event as payment confirmed with $payment.status == "confirmed" and $payment.rawStatus available for compatibility.

Continue with HTML attributes reference.