ADD-ON MODULE

Reports

What you'll learn in this guide

How to write a report as a SELECT with declared parameters over a project's staging database or Orchestrate's own tables, run it, work the grid, save a layout, download the result, and put it on run pages.

Overview

A report is a saved SELECT statement with declared parameters, run from the browser as a sortable, filterable grid and downloadable as Excel or CSV. Reports read either a project's staging database, which is how operators see what a run loaded, rejected and produced without a developer's help, or the Orchestrate database itself, for questions about runs and publishes. A report with a run-id parameter appears on the pages of the runs it applies to.

Reports are under Reports in the sidebar's Data section. View reports lets you run and download; Manage reports lets you write and change them. Both depend on the tenant's Reports enabled setting.


Write a report

  1. On the Reports page click New.
  2. Give it a Name and a Description, and leave Enabled ticked.
  3. Choose what it Reads: a project's staging database, or the Orchestrate database (runs, publishes).
  4. For a staging report, choose the Projects whose databases it may read; at least one. For an Orchestrate report, the same picker, labelled Show on the run pages of, limits which runs show it; empty means all.
  5. Write the SQL. The editor colours it and Format tidies it. As you type it says Looks like a report or names the problem.
  6. Declare the parameters (below), then Save or Save and run.
    ‍
The report editor: what the report reads, the SQL with its live check, and the declared parameters on the right.
The report editor: what the report reads, the SQL with its live check, and the declared parameters on the right.

What the SQL may be

One SELECT, read-only, with no semicolons, no ORDER BY (the grid sorts), no WITH (put a CTE in a view), and no words that change data. Alias every expression so the grid has a column name. Parameters are written @Name and every one used must be declared; names are letters, digits and underscores, up to 64 characters. The staging schema a report sees is the project's own tables in stg, its dbo objects and the lookup tables in lkp.


Parameters

Each declared parameter has a name, display name, type (Text, Number, Date, Yes/No, or Pick from a lookup set with the set and display column), a default, whether it is required, and help text. Declare from SQL adds one for every @Name in the statement. A default can be an expression such as @today-7d or @firstDayOfPreviousMonth, resolved in the tenant's time zone when the report runs. Values are bound as SQL parameters, never spliced into the text.

A Number parameter has one more choice: Typed in when the report runs, or Filled with the run's id on a run's page. The second is what puts a report on run pages.


Run a report

The Reports page lists the reports on the left, with a filter once there are many, and shows the chosen one on the right. A report with no required parameters runs as soon as it is opened; otherwise fill the parameters and click Run. A staging report that names several projects asks which Project to read. A link can pre-fill parameters with ?p.Name=value in its address.

A report that takes longer than the tenant's command timeout (30 seconds by default, with a floor of 60 for reports) is stopped with a message naming the setting. Every run of a report is written to the audit log with its parameters.


Work the grid

For a report, sorting, filtering and paging happen in the database, so the grid is as fast on a million rows as on a hundred.

  • Click a column header to sort; shift-click to add a second or third sort.
  • The funnel on a header opens the column menu: sort commands named as Excel names them (Sort A to Z, Sort oldest to newest), Hide column, Filter by condition with up to two conditions joined by And or Or (contains, equals, starts with, between, before, after, in the last N days, is empty, and so on, by column type), and Filter by values, a checklist of up to 100 distinct values with a search box.
  • Active filters show as chips above the grid, with Clear all.
  • Drag a column edge to resize it. Columns opens a popover to show or hide columns, fit the widths or reset to the report's own layout.
  • Page sizes are 25, 50, 100 and 250. The row count stops at the tenant's Report row count limit (10,000 by default) and shows as 10,000+; filter to narrow the result, or download it.

Save layout keeps your hidden columns, widths and sort for this report, per person, so the grid opens the way you left it. Filters are not saved.


Download

Download offers Excel and CSV and takes everything the current filters leave, up to 100,000 rows, with typed cells in Excel. The download is recorded in the audit log.


Reports on a run page

A report that has a Number parameter bound to the run's id, is enabled, and applies to the run's project appears on the run's Reports tab, grouped under This project and Across projects. The run parameter is filled with the run's id and hidden; a staging report reads that run's project. Full page opens the same report on the Reports page with the run id carried across. This is the way to give operators a "records rejected on this run" view: write the report once with a @RunId parameter bound to the run, and every run page gets it.


When you'd use this

  • Operators need to see the rejected records of a run with the reason: a staging report on stg.Rejections with a run-id parameter.
  • A monthly reconciliation of records in against documents out: a staging report with a period parameter defaulting to @previousMonth.
  • Which projects ran yesterday and how long they took: an Orchestrate report over the runs tables.