Report View
Overview
The Report view generates a formatted document — HTML or PDF — from a feature's data. It's built two independent ways: describe it to the AI assistant and it authors a self-contained HTML artifact, or design it manually in a block-based PDF builder. A report can run over a whole collection (e.g., a price list) or bind to a single record (e.g., an invoice opened from a row).
Use it for printable or exportable documents — invoices, certificates, price lists, contracts — anything that needs a fixed layout rather than the flexible grid of a Table or Dashboard.
The two report kinds
A report view is either HTML or Native (PDF), set via the Tipo dropdown in the Conteúdo tab of the view configuration.
| Kind | Built with | Rendered as | Best for |
|---|---|---|---|
| HTML (AI) (default) | AI assistant conversation, or hand-edited HTML | Sandboxed, offline webview inside the view | Free-form documents where the AI can decide both structure and style |
| PDF (template) | Block builder (A4/Letter canvas) | Generated PDF, previewed inline | Structured documents with predictable layout — invoices, tabular reports |
Switching Tipo doesn't discard the other kind's content — the HTML artifact/data contract and the PDF template are stored independently, so switching back restores what was there before.
Building with AI (HTML kind)
From the empty state, or the AI icon in the toolbar, open Construir com AI / Editar com IA. This opens an in-view assistant:
- Describe the report in chat (e.g., "tabela de projetos com filtro por estado e total no rodapé").
- The assistant generates a self-contained HTML document plus a data contract — the query definitions it needs from this feature (and other features in the workspace) — and shows a live preview rendered with real, current data.
- Keep iterating in the same conversation; each reply replaces the previous draft.
- Guardar persists the draft into the view; Descartar discards it (asks for confirmation if there's unsaved work). A save can be undone via the Anular action on the confirmation snackbar.
The generated HTML is self-contained (inline CSS/JS, no external requests) and reads its data from window.OUTDO_DATA, which is injected fresh from local data every time the view is opened — no regeneration needed to reflect new rows. A locked-down Content-Security-Policy blocks any network access from inside the document, and no writes happen from the artifact back to OutDo.
You can also skip the AI and edit the artifact and data contract directly — see Manual HTML configuration.
Building with the block builder (PDF kind)
Construtor de blocos opens an A4/Letter canvas with three regions: header (repeats every page), body (flows and paginates), and footer (repeats, with page numbers).
Available block types:
| Block | Purpose |
|---|---|
| Texto | Static or templated text ({{...}} placeholders), optionally styled as a heading |
| Variável | A single expression rendered as label: value (lookups, aggregates, formatters) |
| Tabela | A data table — choose columns, per-column width/alignment, optional sum per column, zebra striping, filled header row |
| Separador | A horizontal rule |
| Quebra de página | Forces a page break |
| Repetição | Master-detail: iterates rows from another feature (with an optional per-row filter), rendering a child sub-layout for each |
| Condicional | Shows/hides its content based on a condition |
| Imagem | A static image (e.g., a logo) |
Blocks sit on a grid (configurable column count) and can span columns/rows within the header/footer bands; body blocks stack into ordered rows.
Page setup in the builder only exposes page size (A4/Letter) and orientation (portrait/landscape) — margins and grid resolution use fixed defaults. Dados mode is Lista (one document, table-style, over all matching rows) or Individual (one document for one record: the bound row in Por registo scope, or the first row of the filtered set in Coleção scope). A Validação panel flags template problems.
The template also carries its own dataset filter, independent of the view's admin filters — it decides which rows feed the document.
Once a template exists, the report renders inline as a PDF preview, generated on demand via Gerar PDF / Atualizar PDF (not on every data change — edit the template, then refresh). From there: Transferir saves the file to disk and Imprimir opens the system print dialog. Editar blocos reopens the builder on the same template.
Scope: collection vs record
Set via Âmbito in the Conteúdo tab:
| Scope | Behavior |
|---|---|
| Coleção (default) | The report runs over the view's full (filtered) row set |
| Por registo | The report is bound to exactly one row. HTML templates read it via $current.<column>. PDF templates expose it as record.<field> — stable anywhere in the document, including inside repeating blocks — while row.<field> is the current row: the bound record itself outside a repeating block, or each iterated child row inside one. Typically opened by embedding the report view inside a Linked View on a form, which supplies the bound row |
A record-scoped report opened without a bound row shows a "Documento por registo" placeholder asking you to open it from a row. In the view configurator's own preview, the feature's first row is used as sample data instead of that placeholder.
Filters
Two independent layers, same as Table/Kanban:
- Filtros Base (Filtros tab, admin) — a filter group applied automatically before the report renders, using the same rule builder as elsewhere in the engine.
- Filtros (toolbar, per user) — an additional filter each user applies on top of the admin's, persisted per user. Collection scope only.
Facets
In collection scope, a left-hand facet panel (toggle with the filter icon; Escape closes it) lets you narrow the data by discrete column values, mirroring Table/Kanban facets. Supported column types: text, select, linked select, checkbox, number, date, and status. Date columns get a Year → Month → Day drill-down with per-value counts available. Facet selections combine with the admin and user filters.
Manual HTML configuration
For the HTML kind, the Conteúdo tab also exposes the raw fields the AI writes to, for hand-editing or pasting an artifact from elsewhere:
- Artefacto HTML (self-contained) — the full HTML document. Include a
<head>— it's used as the injection point for data and theme CSS. - Data contract (JSON) — declares the named queries the document reads, e.g.
{"queries":[{"name":"...","feature":"$f_<feature>"}]}. Each query can restrict columns, apply row filters, and cap row count withlimit.
Toolbar
| Action | Availability |
|---|---|
| Imprimir / PDF | HTML kind only, with content, desktop/mobile only (not available on web) — opens the injected document in the system browser for printing (Cmd/Ctrl+P) |
| Editar com IA | HTML kind, when not already in edit mode |
| Filtros | Collection scope only — opens the per-user filter dialog; shows an active-count badge |
| Configurar | Opens the full configuration dialog (Filtros + Conteúdo tabs) |
Tips
- An unconfigured report offers three entry points from its empty state: Construtor de blocos, Construir com AI, and Configuração manual — pick whichever fits.
- Facets and the per-user filter panel only apply in collection scope; a record-scoped report always shows just the one bound row.
- The PDF preview doesn't update live — after editing the template, click Atualizar PDF to see the change.
- A saved configuration that fails to parse shows a "Configuração inválida" placeholder — reopen Configurar and save again to recover.