Skip to main content
Version: 1.28 (Current)

Data Sources New in 2

Audience: Low-code Engineers

Skill Prerequisites: Dashboard, Entities, SQL, Tokens

Every widget reads its own data, chosen on its Data tab under Data Source. KPI tiles and charts have the same six sources, so one dashboard can mix an entity's records, a table on another database and a workflow's output.

The Data tab of a chart with the Data Source list open: Constant, Database Tables, Entities, SQL Query, Token and Workflow

Data sourceWhat it readsBest for
EntitiesAn entity's records, counted or summed by the platformYour app's own records, with the viewer's permissions
Database TablesA table or view, counted or summed by the platformTables outside entities, on this or another database
SQL QueryThe rows of your own queryAnything a query can compute
WorkflowAn output of one of your workflowsData from other systems, or computed in steps
TokenText or JSON with tokens replacedA value a token already gives
ConstantText or JSON typed inFixed values, targets, examples

Entities and Database Tables​

You don't write SQL: you pick the entity or the table and say what to calculate, and the platform builds the query. The fields read as a sentence:

The Data tab of a bar chart of Database Tables: Database, Table or View, a Where clause, Calculate Sum of Amount, Group By Region, and Time Range following a filter

  1. Entity, or Database and Table or View. A table can be on this site's database or on any Database connector defined in Connectors.
  2. Where (optional): a SQL WHERE clause that narrows the records, e.g. Status = 'Open'. The filter button next to the table opens an editor for it. Tokens work, and their values are escaped.
  3. Calculate Count, Sum, Average, Minimum or Maximum of a number property or column. On a chart, + Add value adds another calculation, e.g. Sum of Cost next to Sum of Revenue, each with its Legend name.
  4. Group By (charts): a date per Day, Week, Month, Quarter or Year, or any other property or column, e.g. Region. A chart draws a point or a bar per group. Records grouped by a reference to another entity are labeled with the referenced records' names; records without a value form a "(none)" group.
  5. Time Range based on a date property or column: All Time, Today, Last 24 Hours, Last 7 Days, Last 30 Days, This or Last Week, Month or Year, or Custom days. See Filters.
  6. Format (KPI tiles): how the number is written, e.g. Rounded Money.

The counting and grouping happen in the database, so a large table returns one row per group. A widget of an entity applies the entity's view permissions: each viewer sees the numbers of the records they can read.

SQL Query​

Write a SELECT and the widget draws its rows.

The Data tab of a SQL Query line chart: the Database, the query editor, and the X Axis and Values chosen from the query's columns

  • A KPI shows the first column of the first row: SELECT COUNT(*) FROM dbo.Orders WHERE Status = 'Open'.
  • A chart draws the rows, up to 1,000. Choose the X Axis and Values from the query's columns; by default the first column is the X axis and every other number column is a value.
  • Database: this site's database, or a Database connector from Connectors. The connection string stays in the connector.
  • Tokens are replaced before the query runs, and their values escaped for SQL: WHERE Region = '[QueryString:region]' or WHERE OwnerId = [User:UserID].
  • The query runs in a transaction that is always rolled back, and stops after 30 seconds.
  • Dates on the first of each month are labeled as months ("Jan 2026"), and on 1 January as years, so a query grouped by month needn't format its labels.

The builder previews the query's rows when you leave the editor. If it fails, the reason shows under it.

note

Only Low-code Engineers, Administrators and superusers can write or change a widget's SQL, here and in a WHERE clause. For others the query is read-only, and SQL Query can't be chosen for a widget that doesn't already use it.

Workflow​

Choose one of your app's workflows and one of its outputs. The workflow runs on the server, as the viewer, when the widget loads.

  • A KPI shows the output's value.
  • A chart reads rows from the output: JSON rows, or a list or table the workflow built.

Use it for data from another system's API, or numbers that take several steps to compute.

Token​

Text whose tokens are replaced for the viewer.

  • A KPI shows the text, e.g. [GetData:BounceRate]%.
  • A chart reads JSON from it, so a custom token can return the whole chart's rows, e.g. [Charts:RevenueByMonth] from a SQL query ending in FOR JSON PATH.

Constant​

Text shown as you typed it.

  • A KPI shows the text, e.g. a target: $250,000.

  • A chart reads JSON: a list of objects, one per row, or an object of names and values, one row each:

    [{"Month": "Jan", "Sales": 10}, {"Month": "Feb", "Sales": 14}]
    {"Open": 5, "Closed": 7}

Numbers written as text count as numbers, and ISO dates as dates.

Tokens in a widget's data​

Tokens work in a SQL query, a WHERE clause, a Token or Constant value, the title, the description and the Show Condition. They're replaced for each viewer, so one dashboard can show each viewer their own numbers:

  • [User:UserID] for the viewer's own records.
  • [QueryString:region] for the page's address: on /Sales?region=North the widget shows North's numbers.
  • [Filter:Region] for the dashboard's filters. See Filters.

How long data is kept​

The server keeps what a widget read for the time set in Keep data for (5 minutes for a new dashboard), and serves it to every viewer who asks. A widget whose data depends on the viewer, such as an entity's (its permissions), a workflow's (it runs as the viewer) or any source with a token, keeps its data apart for each viewer. See Keep the data fresh.