Order operations

Choose a view, check the totals, then inspect the orders behind them.

Explore the operations report ↗

Report filtered to open orders, showing their value, count, and individual rows.

From overview to detail

  1. Filter: choose open, completed, or all orders.
  2. Review: totals reflect the selected view.
  3. Inspect: browse individual records and pages.

“Show open orders by country, with totals and a table I can explore.”

The source below shows a wider layout with country, date, and minimum-total filters, two charts, and a detail table.

View complete Markdown source

Source for your assistant. Layout and component instructions are shown as code here; they do not execute in the documentation.

---
layout: full
theme: paper
toc: true
components: cards
density: compact
data_ref: main
cache: 5m
---
# Order operations

Use the controls to inspect one coherent view. The URL contains the complete
filter state. This page expects an `orders` table with `id`, `ordered_at`,
`country`, `status`, and numeric `total` columns.

:::: {.cluster #filters}
```component_input name=country type=select label="Country" options="all:All,ES:Spain,PT:Portugal,FR:France" default=all
```

```component_input name=min_total type=number label="Minimum total" default=0
```

```component_input name=start type=date label="Ordered since" default=2026-01-01
```
::::

## Current position

:::: {.grid columns=3}
```component_sql type=value title="Orders" label="matching orders"
SELECT count(*)
FROM orders
WHERE (:country = 'all' OR country = :country)
  AND total >= :min_total
  AND ordered_at >= :start;
```

```component_sql type=value title="Revenue" label="gross revenue"
SELECT coalesce(sum(total), 0)
FROM orders
WHERE (:country = 'all' OR country = :country)
  AND total >= :min_total
  AND ordered_at >= :start;
```

```component_sql type=value title="Open" label="orders requiring action"
SELECT count(*)
FROM orders
WHERE status = 'open'
  AND (:country = 'all' OR country = :country)
  AND total >= :min_total
  AND ordered_at >= :start;
```
::::

## Movement

:::: {.grid columns=3}
::: {.cell span=2}
```component_sql type=line title="Daily revenue" x=day
SELECT date(ordered_at) AS day, sum(total) AS revenue
FROM orders
WHERE (:country = 'all' OR country = :country)
  AND total >= :min_total
  AND ordered_at >= :start
GROUP BY 1
ORDER BY 1;
```
:::

::: {.cell span=1}
```component_sql type=bar orientation=horizontal title="Orders by status"
SELECT status, count(*) AS orders
FROM orders
WHERE (:country = 'all' OR country = :country)
  AND total >= :min_total
  AND ordered_at >= :start
GROUP BY 1
ORDER BY orders DESC;
```
:::
::::

## Detail

::: {.wide}
```component_sql type=table title="Matching orders" page_size=25
SELECT id, ordered_at, country, status, total
FROM orders
WHERE (:country = 'all' OR country = :country)
  AND total >= :min_total
  AND ordered_at >= :start
ORDER BY ordered_at DESC, id DESC;
```
:::