Skip to content

Build / Widgets

Query Widget YAML

This is the field reference for a Query Widget Definition. For when to use a Query Widget and how to build one, see Query Widgets. Put joins and reusable SQL in a Query Dataset.

schemaVersion: 1
source:
type: dataset
source: 46b0bbe8-619a-4b23-bc44-f11842775640
display:
type: metric
value: ticket_count
timezone: America/Chicago
parameters:
- name: board_values
filterVariable: 32b69796-14b3-48d1-a9a7-d196b91752c1
drilldownQuery: |-
select ticket_number, ticket_subject
from source
where board_name in $board_values
query: |-
select count(*) as ticket_count
from source
where board_name in $board_values
Field Required Notes
schemaVersion Yes Must be 1.
source No One Dataset, Stash or Query Dataset, read as source. See Sources.
sources No Up to eight named sources. Use instead of source, not with it.
timezone No IANA timezone name. Defaults to UTC; new widgets in the editor start with yours.
parameters No Filter Variable bindings. See Parameters.
query Most displays The Widget Query. Markdown and HTML can leave it out. See Widget Query.
drilldownQuery No Detail rows for drilldown. Needs query. See Drilldown.
cellDrilldown No Per-cell drilldown for tables. Needs drilldownQuery.
queries No Extra result sets for HTML widgets.
drilldowns No Named drilldowns for HTML widgets.
display Yes How the result is shown. See Display.
ui No Extra Quick controls.

Unknown keys are rejected. Don’t wrap the definition in a widget object.

Declare one source, a sources map, or neither.

Field Notes
type dataset, stash or queryDataset.
source The source’s ID. Browse Datasets in the editor fills it in.
type Reads
dataset A synced Dataset
stash A Stash
queryDataset A saved Query Dataset

modifiedDataset and joinedDataset aren’t valid. Shape that data in a Query Dataset.

Use sources when different queries in one widget read different data, such as an HTML page with unrelated panels. Each key is an alias you select from in SQL.

sources:
tickets:
type: queryDataset
source: 5a242d39-195c-41da-a99b-93b402a4325b
invoices:
type: dataset
source: 46b0bbe8-619a-4b23-bc44-f11842775640
  • Aliases start with a lowercase letter or underscore, and use only lowercase letters, digits and underscores, up to 63 characters.
  • Up to eight sources.
  • Each query reads exactly one alias. Queries can’t join aliases.
  • The widget refreshes when any of its sources updates.

Any display can leave out source and use a self-contained query: a SELECT with no FROM, or one over inline VALUES.

Markdown and HTML can also leave out query, for static text or text that only shows Filter Variable values. Without a query, a widget can’t use column placeholders, chart fields or drilldownQuery. If you declare a source, you need a query too.

A parameter makes one Filter Variable’s selection available to SQL as $name.

parameters:
- name: board_values
filterVariable: 32b69796-14b3-48d1-a9a7-d196b91752c1
Field Required Notes
name Yes Starts with a letter or underscore, then letters, digits and underscores.
filterVariable Yes The Filter Variable’s ID, from your company.
  • Every $name in SQL must be declared.
  • Use in $name for multi-select Filter Variables and = $name for single-select ones.
  • An empty multi-select becomes an empty list. An empty single-select becomes null.
  • Values are passed as typed parameters, never pasted into the SQL.

Datetime columns from the source are converted into timezone before the Widget Query runs, and the date helpers use it too. Use an IANA name such as America/Chicago or UTC.

query is one read-only SELECT from one relation: source, one alias from sources, or no relation at all for a self-contained query.

Allowed Not allowed
Filtering, grouping, aggregates, case, ordering, limit, declared $parameters, date helpers Joins, CTEs, subqueries, unions, reading more than one source, selecting a source by ID, changing data, reading or writing files

Table displays return at most 1,000 rows from query, in the preview and on the dashboard. Longer results are cut off and the widget says so. Other displays have a higher limit. Bar and line charts over dates keep the newest points when cut off.

Helper What it does
dashboard_date_filter(column) True for rows inside the dashboard’s date range. True for every row when no date filter is set.
dashboard_date_filter_or_default(column, start, end) Uses the dashboard’s date range, or start and end when none is set.
dashboard_start_date(default) The dashboard’s start date, or default.
dashboard_end_date(default) The dashboard’s end date, or default.
runtime_start_date('this month') The start of a relative period, such as today, this week or this month.
runtime_end_date('this month') The end of the same period.

Don’t pass 'dashboard' to runtime_start_date or runtime_end_date; use the dashboard helpers instead.

Activity widgets should filter on the selected range. Point-in-time widgets, such as balances, should use dashboard_end_date() and can include history before the start date.

select account_name, sum(amount) as balance
from source
where posted_on <= dashboard_end_date(runtime_end_date('today'))
group by account_name

Detail rows viewers see when they drill in. It follows the same rules as query, with the same parameters, and needs a main query.

drilldownQuery: |-
select ticket_number, ticket_subject, board_name
from source
where board_name = {{ x }}
and dashboard_date_filter(created_at)
  • On charts, {{ x }} is the display.x value that was clicked. It’s passed as a parameter.
  • Tables open drilldownQuery from the footer’s Expand table and don’t pass {{ x }}, so don’t use it in a table’s drilldown.
  • Mirror the main query’s filters and dates so the rows match.
  • Drilldown is not limited to 1,000 rows.
  • Drilldown cells show raw values unless a display.columnFormats entry formats that column. Use useGrouping: true for counts, format: currency for money, format: percent or percentSuffix: true for rates, and format: date, datetime or time for timestamps. The widget’s own rounding and percentSuffix don’t carry over.

For table displays only. Clicking a cell opens detail rows for that cell’s row, like a classic Matrix widget.

cellDrilldown:
rowKeys: [category]
columns:
total_amount: |-
select id, category, amount
from source
where amount > 90
Field Required Notes
rowKeys Yes The Widget Query columns that identify a row. Every cell query, and drilldownQuery, must return them under the same names.
columns No Maps a table column to its own detail query. Columns not listed use drilldownQuery.

Cell queries follow the Widget Query rules. They can’t use {{ x }} or end in LIMIT or OFFSET; the app narrows them to the clicked row. Expand table still opens the full drilldownQuery.

HTML widgets can run extra queries and open drilldowns by name. Both need a main query.

Field Limit Notes
queries.<name>.query Up to 8 An extra result set, up to 1,000 rows, that the HTML gets by name. Same rules and parameters as query.
drilldowns.<name>.query Up to 16 A detail query the HTML opens by name. {{ x }} is the value it passes.
drilldowns.<name>.title 120 characters Optional dialog heading. Defaults to the name.

Names start with a letter and use letters, digits and underscores, up to 64 characters.

Named drilldowns use the same filters, Query Parameters and dashboard dates as drilldownQuery. Pass a clicked value as {{ x }}, or omit it if the detail query doesn’t filter by that value. If you define both kinds, a request without a name still uses drilldownQuery. Share Link viewers can open named drilldowns when the link allows drilldown into data.

ui.editablePaths adds fields to the editor’s Quick controls tab, on top of the defaults for the display type.

ui:
editablePaths:
- display.barGap
- display.option.xAxis.axisLabel.fontSize
  • Each entry is a dotted path to a single value: a true/false, number, text or choice.
  • Paths start with display, source, sources, timezone, parameters, schemaVersion or ui.
  • Paths to SQL (query, drilldownQuery) and to whole objects, such as display.option or display.thresholds, aren’t allowed.
  • If ui is present, it needs at least one path.

display maps the Widget Query’s result columns onto the widget. It doesn’t reshape data; do that in SQL. Column names in display are the names your query returns.

display.type Required fields
bar, line x, y
pie, funnel label, value
metric value
gauge value
table None
markdown body
html body

These work on every type:

Field Notes
showTitle false hides the widget title on the dashboard. The title still names the widget in lists.
title An in-widget title. Prefer the widget title.
noDataMessage Replaces the text shown when the query returns no rows.
display:
type: bar
x: board_name
y:
- open_count
- closed_count
yLabel: Tickets
seriesMode: stacked
Field Notes
x Category or date column.
y One or more numeric columns. A single name works too. Put series names in columnLabels.
seriesBy A category column that splits long data into one series per value. Needs exactly one y, must differ from x, and can’t combine with axes, columnAxes or columnMarks. Return at most one row for each x and seriesBy pair.
seriesMode grouped or stacked.
showStackTotals Shows totals on stacked bars.
colorBy Bar only. series (default) gives each series one color. data colors each category from the palette.
horizontalBars Bar only. Sideways bars. Works only with one value axis.
areaFill Line only. Fills under the line.
barGap Space between bars in a group, such as 30%.
barCategoryGap Space between categories, such as 20%.
barMaxWidth Widest a bar can be, 1 to 400 pixels.
xLabel, yLabel Axis titles.
yAxisMin, yAxisMax Value axis bounds. Max must be greater than min.
yAxisLogScale Logarithmic value axis.
xLabelRotation, yLabelRotation Tilts axis labels, -90 to 90 degrees. Use these instead of display.option.
axes, columnAxes, columnMarks Extra value axes and mixed bar and line marks. See Named value axes.
overlay A number painted on the chart. See Number overlay.

Use these when one chart plots y columns with different scales or units, such as cases and revenue. You can also draw some columns as lines on a bar chart.

display:
type: bar
x: month
y: [cases, revenue]
columnFormats:
revenue: {format: currency, currencyCode: USD}
axes:
left: {position: left, name: Cases}
dollars: {position: right, name: Dollars}
columnAxes:
revenue: dollars
columnMarks:
revenue: line
Field Notes
axes.<id>.position Required. left or right. Axes on the same side are offset.
axes.<id>.name Axis title. Name every axis when there are two or more.
axes.<id>.min, axes.<id>.max Bounds. Max must be greater than min.
axes.<id>.log Log scale. Min must be greater than 0.
axes.<id>.reverse Flips the axis.
axes.<id>.thresholds Thresholds for the series on this axis. Use these instead of display.thresholds with two or more axes.
columnAxes Maps a y column to an axis ID. Unlisted columns use left.
columnMarks Maps a y column to bar or line. Unlisted columns use display.type.
  • Up to four axes, including the built-in left.
  • yLabel, yAxisMin, yAxisMax and yAxisLogScale set the left axis. If you declare axes.left, set them there instead, not both.
  • Columns on one axis need compatible formats. Put currency and percentages on different axes.
  • Don’t set display.option.yAxis when using named axes.

Paints one number, reduced from a column, on a bar or line chart.

display:
type: line
x: trend_day
y: [rolling_average_hours]
columnFormats:
rolling_average_hours: {format: duration, durationUnit: hours}
overlay:
value: rolling_average_hours
reducer: last
placement: center
size: large
label: Rolling 30-day average
Field Required Notes
value Yes A numeric column. Non-numeric cells are skipped.
reducer Yes last, first, sum, avg, min or max. first and last follow the query’s row order, so add order by.
placement No topRight (default), top, right, bottom, left, center, topLeft, bottomLeft or bottomRight.
size No small, medium (default) or large. Smaller widgets step down a size.
label No Static text shown with the number.
accessibleText No auto (default) or value. What screen readers announce.

The overlay formats its value with that column’s columnFormats. Long values shrink to fit. If no numeric value is left, it shows a dash.

display:
type: pie
label: status_name
value: ticket_count
pieLabelFormat: labelAndPercentage
Field Notes
label Required. The slice or stage name column.
value Required. A numeric column.
donut Pie only. Pies are donuts unless you set false.
pieRadius One size, or [inner, outer] such as ["40%", "70%"].
pieLabelFormat label, value, percentage, labelAndValue or labelAndPercentage.

On a dashboard, pie and funnel colors follow the dashboard’s label color rules unless you set colors or thresholds.

Shows one value from the first row: a number, time, date, datetime or short text.

display:
type: metric
value: ticket_count
label: Tickets opened
subtitle: '{{ period_label }}'
icon: zap
tone: info
comparison:
value: prev_period_count
label: vs previous period
Field Notes
value Required. One column name, not a template.
valueFormat Formats only the main value. Same fields as a columnFormats entry.
label A short label above the value. Leave it out if it would repeat the widget title.
subtitle Supporting text.
icon, iconColumn A Lucide icon name, or a column that holds one.
tone, toneColumn positive, negative, neutral, info or warning, or a column that holds one. Colors the icon, value and comparison accents.
layout stacked, split or centered.
fontSize Preferred value size, 8 to 200 pixels. Leave it out to fit the widget. It still shrinks if the value would overflow.
comparison A comparison below the value. See the next table.
comparison field Notes
value A column to compare with. Needs value or text.
text Comparison text instead of a value.
label Text after the comparison, such as vs last month.
icon, iconColumn An icon for the comparison.
tone, toneColumn A fixed tone. Overrides favorableDirection.
favorableDirection up (default) or down. With down, a decrease shows as good, for things like open balances or errors.

When value and comparison.value are both numbers, the widget shows the percent change and the baseline.

label, subtitle and comparison.text can hold {{ column_name }} slots, filled from the first row. Slots only insert a column; shape the text in SQL.

For a clock time, put a time or timestamp column in value and set valueFormat: {format: time, timeStyle: short}. format: time doesn’t turn a decimal hour such as 17.25 into a time. For an elapsed time, use a number with valueFormat: {format: duration, durationUnit: hours}.

display:
type: gauge
value: completion_percent
min: 0
max: 100
percentSuffix: true
gaugeIntervalLabels: [Low, High]
Field Notes
value Required. A numeric column.
min, max Numbers or numeric columns. A literal max must be greater than a literal min.
gaugeIntervalLabels Exactly two labels, for the min and max ends.

Gauges mark each threshold on the arc.

Every field is optional. Leave out columns to show every result column.

display:
type: table
columns: [ticket_number, ticket_subject, last_email_age_minutes]
columnFormats:
last_email_age_minutes: {rounding: 0}
columnLinks:
ticket_number: "https://psa.example.com/tickets/{{ ticket_number }}"
Field Notes
columns Result columns to show, in order. Can’t be an empty list.
columnLabels Header text by column.
columnFormats Formats by column. See Number formatting.
columnLinks Turns a column’s cells into links. See below.
columnAutoSort Orders columns by header: alphabetical, reverseAlphabetical, calendarAscending or calendarDescending. Off when left out.
pinnedColumns Columns kept in place while scrolling sideways.
fitToWidth Columns stretch to the widget by default.
verticalScroll true scrolls inside the widget instead of showing pages.
gridOptions, columnDefs Advanced grid settings. See below.

columnLabels, columnDefs, pinnedColumns, columnFormats and columnLinks also apply to drilldown columns, including ones only drilldownQuery returns.

A link template is an https:// or http:// URL with placeholders:

  • {{ column_name }} is filled from the same row.
  • {{ conn.variable_name }} is filled from the source integration’s settings, such as your PSA’s address.

Links with other schemes show as plain text.

If you leave out columnLinks, Resplendent fills it in from the link templates set on the source Dataset, or on the Datasets behind a Query Dataset, for columns your queries return. A link is dropped if its column or a column it uses isn’t selected. Set columnLinks: {} to turn links off; that choice is kept on later saves.

gridOptions takes grid options such as pagination, and columnDefs takes per-column settings keyed by column name. Only a fixed set of options is accepted; others are rejected. Cell styling uses the built-in qw-cell-* classes and the paletteColor(), categoryPill() and tonePill() helpers. Schema help in the editor lists them. Use the typed fields above when they cover what you need.

Formatted text in one card, with values from the query and filters, and one optional chart.

Field Notes
body Required. Markdown.
chartType bar, line, pie, gauge or funnel to embed a chart. Leave out for text only.
chartHeight Chart height, 48 to 2,000 pixels. Default 240.
Placeholder Filled with
{{column_name}} That column from the first row, formatted by columnFormats. Shows a dash when there’s no value.
{{filters.name}} The current selection of the parameter name, comma-separated. None selected when empty.
{{chart}} The embedded chart. Use exactly once, as its own paragraph, when chartType is set.

Put the chart’s fields, such as x, y, label, value and thresholds, directly on display. Placeholders can’t go inside HTML tags, link or image URLs, or image alt text. Static text and filter values still show when the query returns no rows. Set showTitle: false to let the body carry the headline.

A custom layout in HTML, CSS and JavaScript, rendered in a sandboxed frame on dashboards, share links and reports.

Field Notes
body Required. HTML, CSS and optional JavaScript. Not templated: your script receives query rows, queries results, filter values, dashboard dates, timezone and theme on each render.
autoHeight true lets the widget grow to fit its content on a viewer’s dashboard. Widgets below move down. The saved layout doesn’t change.
externalDomains Up to 10 HTTPS domains, such as api.example.com, the widget asks to reach. Each needs approval. See Let an HTML widget reach other sites.

HTML widgets also accept title, showTitle, columnFormats, columnLabels and columnLinks. Other display fields are rejected, since the body draws its own layout. Scripts can load from approved public code sites, and the frame includes a chart library and helpers. Prefer Markdown when formatted text and one chart are enough.

These fields set formatting for every numeric column the display uses. A columnFormats entry for a column overrides them wherever that column appears.

Field Notes
rounding 0 to 6 decimal places.
percentSuffix Adds %.
abbreviatedNumbers 1.2K, 3.4M, 5.6B.
currencyPrefix Adds $. Kept for older widgets; prefer format: currency.

A columnFormats entry, and valueFormat on a metric, take the fields above plus:

Field Notes
format automatic, text, number, currency, percent, date, datetime, time, scientific or duration.
durationUnit Required with format: duration, and only allowed with it: seconds, minutes or hours.
currencyCode Three-letter code, such as USD.
prefix, suffix Literal text before or after the value.
useGrouping false drops thousands separators, for IDs.
minimumFractionDigits, maximumFractionDigits 0 to 20. Max can’t be less than min.
dateStyle, timeStyle short, medium, long or full.
hour12 12-hour clock.
columnFormats:
invoice_id: {format: text}
invoice_total: {format: currency, currencyCode: USD, rounding: 2}
win_rate_pct: {rounding: 1, percentSuffix: true}
opened_at: {format: datetime, dateStyle: medium, timeStyle: short}

Durations round to the nearest second and drop zero parts, such as 1d 2h or 30s. Rounding, grouping, abbreviation, percent and currency don’t apply to them; prefix and suffix do.

For mixed units, format each column rather than setting one format for all. For example, if a metric’s value is a percentage and its subtitle holds counts, set valueFormat: {percentSuffix: true} rather than percentSuffix: true.

Field Notes
dataLabels Shows values on bars, points, slices, stages and gauges.
legend Shows or hides the legend.
legendPosition top, right, bottom or left.
colors An ordered list of colors. Leave out to use the theme.
option Extra chart styling as JSON. It can’t hold data: data, dataset, dimensions, encode, transform, renderItem and children are rejected. Prefer a typed field when one exists.

display.thresholds colors values and can play Soundboard sounds.

display:
type: gauge
value: open_tickets
thresholdBaseColor: '#22c55e'
thresholds:
- value: 50
comparator: gte
color: '#f59e0b'
label: Elevated
- value: 100
comparator: gte
color: '#ef4444'
label: Critical
soundId: 8f4c2a1b-3d9e-4f6a-9c2b-1e7d5a8b0c3f
Field Required Notes
value Yes The level.
color Yes The color when the rule matches.
comparator No gt, gte, lt, lte or eq. Defaults to gte.
label No Shown in the threshold legend.
soundId No A Soundboard sound’s ID. The editor can pick a sound by name and play it.
repeatSound No Replays while the value stays matched. Needs repeatInterval.
repeatInterval No Seconds between replays. Must be more than 0 when repeatSound is true.

These fields sit on display beside thresholds:

Field Notes
thresholdBaseColor The color for values that match no threshold.
allowMute Whether viewers can mute the widget’s sounds. Defaults to true.
snoozeSeconds How long snooze silences sounds. Defaults to 300. 0 hides snooze.

When a value matches several rules, an eq match wins, then the lowest matching lt or lte rule, then the highest matching gt or gte rule. With two or more value axes, put thresholds on each axis instead.

Display Threshold colors Threshold sounds
Bar, line Each value Play when any shown value matches
Pie, funnel Each slice or stage Play when any shown value matches
Gauge The arc, with a marker per threshold Use the first row’s value
Metric Not used; metrics use tone Use the main value
Table Not supported Not supported

A sound plays once when a value enters a matching rule, and again only after it leaves and comes back, unless repeatSound is on. If the winning rule has no soundId, nothing plays. Sounds play on saved dashboards and share links, not in previews, reports or print. The mute button appears in the widget footer once a threshold has a sound, and the snooze button once a sound has played. Both affect only the viewer’s open dashboard.

A new soundId must belong to your company’s Soundboard, or the widget won’t save.

If a source column’s name contains a dot, quote it in SQL and alias it:

select "board.name" as board_name, count(*) as ticket_count
from source
group by "board.name"

Fields in display use the alias, without quotes. Renaming such columns in a Query Dataset keeps every widget simpler.