Skip to content

Table

The Table widget shows the result of an SQL query as a table on the dashboard: open invoices, orders of the month, a customer list. Viewers search, sort, hide columns, open records with a click and download the result as CSV, Excel or JSON.

Table widget Rechnungen (invoices) with search field, column selection icon, the columns Rechnungsnr, Datum, Kunde and Status, three rows, the summary row with count 3 and the footer 3 / 3 with download icon
Three invoices with summary row (count) and download.

Setting up

Configure table opens a dialog with all settings:

Dialog Configure table with an SQL query over app_invoices and app_contacts, the button Test, the tip on @periodStart and @periodEnd, the options Row limit 200 and Hide system columns, and the summary row with brutto Sum, netto Sum and rechnungsnr Count
SQL, test run, options and summary row in one dialog.
  • SQL query: any columns; the column names of the query become column headers. Test loads the first five rows as a preview and determines the columns for the summary row. If the query contains filter placeholders $(…), the test substitutes “All” for them.
  • Row limit: how many rows the table shows at most, default 50. ORDER BY in the query decides which rows these are.
  • Hide system columns: hides technical columns such as pk, sk or createdat, on by default.
  • Time filter: appears as soon as the query contains @periodStart and @periodEnd. Here the offered periods, month, year and free calendar selection, and the Default are defined; viewers then choose the period themselves in the widget.
  • Summary row: per column None, Sum, Average, Median, Minimum, Maximum or Count. The row sits below the table and calculates over the currently visible rows, so also after a search.
  • Save applies the settings. The robot icon at the top right opens the SQL assistant, which proposes the query from a description.

Links to records: columns named id or ending in _id or _ref (except data_schema_id) become links that open the record in the Database. Use such names only for columns that contain a record id.

On the dashboard

  • Search… filters across all columns, including hidden ones, regardless of case.
  • Sorting by clicking the column header: ascending, descending, off. Numbers inside text are sorted as numbers, empty values always come last.
  • Select columns (icon to the right of the search): show and hide columns, Show all restores everything. Sorting and column selection are remembered by the browser per viewer.
  • Cells: long values show the full text on hover, the Copy icon copies the value. Link columns open the record in a new tab.
  • Period: with a configured time filter, a button with the current period, see Dashboards. Without a match it reads “No data in the selected period”.
  • Footer: “filtered / total” and the Download icon with CSV, Excel (.xlsx) and JSON. Exactly what is visible is exported: filtered rows, selected columns, current sorting. Excel recognizes date and time values and formats them as dates.
  • Summary row: symbols Σ (sum), ⌀ (average), x̃ (median), ↓ ↑ (minimum, maximum), # (count); non-numeric values are skipped.

The table loads when the dashboard opens, on Refresh dashboard and via the refresh icon in the header. Permissions apply: each person sees only the records they are allowed to query, see SQL in widgets.

Example: open invoices with customer

The table shows all invoices with an open amount, the customer's name and the totals at the bottom. The example uses the tables app_invoices (invoices) and app_contacts (contacts) of the invoicing app; the invoice field app_recipient refers to the contact.

  1. Add the Table widget, Configure table.
  2. Enter the query below and Test.
  3. Row limit 200, Hide system columns on.
  4. Summary row: brutto → Sum, offen → Sum, rechnungsnr → Count.
  5. Save and publish the dashboard.
SELECT i.app_invoice_no AS rechnungsnr,
       i.app_invoice_date AS rechnungsdatum,
       COALESCE(c.document_name, '-') AS kunde,
       i.app_due_date AS faellig_am,
       i.app_gross_total AS brutto,
       i.app_open_amount AS offen,
       i.id AS id
FROM app_invoices i
LEFT JOIN app_contacts c ON c.id = i.app_recipient
WHERE i.app_open_amount > 0
ORDER BY i.app_due_date
LIMIT 200

Why this way:

  • LEFT JOIN on app_contacts fetches the customer name; without a customer the invoice still stays in the list, COALESCE then inserts “-”.
  • The column id becomes a link and opens the invoice.
  • ORDER BY decides which rows stay within the row limit, here the ones due first.
  • Amount and date remain unformatted so that sorting, totals and the Excel export are correct. How date fields are compared is described under SQL in widgets.

Frequently asked questions

The summary row is missing.

It appears only if at least one visible column has an aggregation. After changing the query in the dialog, Test again so that the columns are known.

The export does not contain all rows.

The visible rows are exported: search and row limit apply. For the complete data set, run the query in Data analytics and export there.

Two people see a different number of rows.

The query runs with the permissions of the viewing person. Whoever may see only certain records gets only those, also in the totals.

Can the column width or a number format be set?

Not in the dialog. Number and date formats are produced in the query, see Formatting numbers and dates; the columns are then text, however, and sort alphabetically.

Next step

Chart: the same queries as line, bar or pie.