Jadpo is experimental and not ready for production. These docs follow the compiler's main branch as of 29 Nov 2026. What's built · Install 0.6.0
jadpo
ReferenceReads and writes

DataReads and writes

A report of counts

A report that counts several things is a query for each count and an action that puts them together. Each query has aggregate: and no group:, so it gives one row, whose count is 0 when nothing matches (Counts, sums and groups).

Here a help desk reports, for the past 7 days, how many enquiries were opened and solved, and how many are open now. The request didn't say what "the past 7 days" means, so the action reads it one reasonable way and says so in its /// line, where the app's owner sees it:

example
/// The desk's last seven days, and how it stands now.type WeekOfEnquiries = Output {    opened: Int    solved: Int    open_now: Int}
example
use desk/entities { Enquiry }use desk/types { EnquiryCount, EnquiryTime }/// How many enquiries were opened at or after `since`.query opened_since(since: EnquiryTime) -> EnquiryCount {    from: Enquiry    where: Enquiry.raised_at >= since    aggregate: {        enquiries: count()    }}
example
use desk/entities { Enquiry }use desk/types { EnquiryCount, EnquiryStatus, EnquiryTime }/// How many enquiries are solved and were solved at or after `since`./// Reopening a enquiry clears `solved_at`, so a enquiry solved and reopened/// since isn't counted.query solved_since(since: EnquiryTime) -> EnquiryCount {    from: Enquiry    where: Enquiry.status == EnquiryStatus.solved    where: Enquiry.solved_at >= since    aggregate: {        enquiries: count()    }}
example
use desk/entities { Enquiry }use desk/types { EnquiryCount, EnquiryStatus }/// How many enquiries aren't solved: open or pending.query open_now() -> EnquiryCount {    from: Enquiry    where: Enquiry.status != EnquiryStatus.solved    aggregate: {        enquiries: count()    }}
example
use desk/types { EnquiryCount, EnquiryTime, WeekOfEnquiries }use desk/queries { open_now, opened_since, solved_since }/// The report for the past 7 days. The request said only "the past 7/// days", so this reads it as the 7 × 24 hours before the report is made/// (a rolling week, in UTC as every `Instant` is), not 7 calendar days.action weekly_report() -> WeekOfEnquiries {    var since: EnquiryTime = EnquiryTime(clock.now - 7d)    var opened: EnquiryCount = opened_since(since)    var solved: EnquiryCount = solved_since(since)    var open: EnquiryCount = open_now()    return WeekOfEnquiries {        opened: opened.enquiries        solved: solved.enquiries        open_now: open.enquiries    }}
example
use desk/entities { Enquiry }use desk/types { WeekOfEnquiries }use desk/actions { open_enquiry, solve_enquiry }test "the report counts the last 7 × 24 hours, and what is open now" {    clock: "2026-11-01T09:00:00Z"    var old: Enquiry = open_enquiry("Printer jammed")    clock.advance(3d)    var login: Enquiry = open_enquiry("Can't sign in")    var refund: Enquiry = open_enquiry("Refund, please")    var solved: Enquiry = solve_enquiry(refund)    assert solved.solved_at == clock.now    clock.advance(5d)    assert weekly_report() == WeekOfEnquiries {        opened: 2        solved: 1        open_now: 2    }    assert login.status == old.status}

A report kept for each day is the same action run by a schedule, its counts stored in a record of their own.

Markdown for agents: /docs/a-report-of-counts.md.Built from Jadpo's main branch at commit 9080dc3.