Skip to content

[proposal] reports: user-set parameters - a period, a threshold, a name the reader chooses #53

Description

@delchev

A report is rarely read once. It is read for a period, for amounts above a threshold, for a counterparty whose name someone half-remembers - inputs the reader chooses at the moment of reading.

The format has no way to say so. filter is fixed when the report is generated, and the only runtime narrowing a reader gets is whatever per-column filtering the surface offers over the columns the report already displays. Two consequences, both routine:

  • A period is not a column. "This quarter" over an invoice date means two bounds the reader sets. The model can express either every row or one hard-coded window, so an application carries one report per period, or none.
  • The interesting filter is often on a field the report does not show. A receivables list displays customer, number and balance; the reader wants only the ones whose internal owner is themselves. Filtering over displayed columns cannot reach that field, so the report grows a column nobody wanted in order to be filterable by it.

One report kind already escapes this, by hardwiring: the balance report declares its own From/To window, because its opening/period/closing shape cannot be specified without one. That is the argument that the mechanism belongs to reports in general.

Proposed shape:

reports:
  - name: Revenue
    source: Invoice
    dimensions: [date, customer.name]
    measures: ["sum(total)"]
    parameters:
      - { name: fromDate, target: date, op: ge }
      - { name: toDate, target: date, op: le }
      - { name: minTotal, target: total, op: ge, initial: "0" }
      - { name: customer, target: customer.name, op: like }

The load-bearing decision is that a parameter is bound on every read, so the unset case is carried by a value (initial) rather than by a vanishing predicate - a report whose query shape depends on which inputs were touched is one no surface can present or cache. initial is therefore required unless the comparison has a neutral "any value" default (a date bound, a like search).

Proposal document and the full normative text: PR to follow. Reference implementation: eclipse-dirigible/dirigible#6357 / eclipse-dirigible/dirigible#6911.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions