Skip to content

Views

A view shapes data. It is a pipeline that derives a fresh dataset from your live documents, much like a view in a database: you describe the shape you want, and wasabi computes it on demand. A view does not store a copy and it does not render anything; it is pure data shaping.

A view starts from a source and applies a sequence of steps: keep the rows that qualify with where, group them by one or more fields with group, and compute aggregates over each group with calc, such as totals, counts, averages, and minimums or maximums. It can also expand references, pulling fields from related records into the result, so a single view can span data that lives across several record types.

yaml
# revenue per region, computed from live orders
data:
  from: '@sales/order'
  where: =status == 'completed'
  group: [region]
  calc:
    revenue: { sum: amount }

Because the pipeline runs over live data every time it is read, a view is always current; there is nothing to rebuild or refresh. The same view definition can be reused in two ways: as a data source that other parts of your app read from, or as the data behind a standalone browser that turns it into a report or dashboard. This is how you compute things like inventory on hand by warehouse or sales by region, without defining a new record type or writing query code.

The distinction to keep in mind: a data source is raw reference data you bring in, and a view is a live dataset computed from your documents. A browser is what presents either one.