ErrorsReads and writes · rule
query.aggregate_field
Aggregate cannot be worked out over this field.
Area 6, Reads and writes; not declinable; the next step is usually the agent's.
type Fine = Money {}entity Loan { id: Uuid fine: Fine}type FinesOwed = Output { owed: Money}query fines_owed() -> FinesOwed { from: Loan aggregate: { owed: sum(Loan.fine) }}
error sum adds up money in one currency, and Loan.fine's type doesn't fix one
--> main.jadpo:15:19
|15 | owed: sum(Loan.fine) | ^^^^^^^^^ `Fine`
- reason
- Amounts in two currencies don't add up (
currency_mismatch), and a sum of no records needs a currency for its zero, so the field's type fixes its currency:Finedoesn't. - next
- Give
Fineacurrency:(agent) - rule
- query.
aggregate_ field - help
- https://jadpo.
dev/docs/errors/query. aggregate_ field
Markdown for agents: /docs/errors/query.aggregate_field.md.Built from Jadpo main at aee2e8f.