Semaphor
Semantic Domains

Dataset Inputs

Declare typed inputs on a SQL dataset so dashboard filters, controls, and agents can pass dates, lists, and thresholds directly into the dataset's query

A dataset input is a typed parameter declared on a SQL dataset. Instead of hand-wiring dashboard controls to match parameter names, you declare the input once on the dataset—its type, whether it is required, an optional default, and optionally which dataset field it narrows—and dashboards pick it up automatically as a filter or ready-made control.

The five input kinds

Every declared input has one of five types:

KindWhat viewers pickSQL syntaxLinked field
Date rangeA start and end day (presets, static, or relative){{ param('order_window').start }} and {{ param('order_window').end }}Required (must be a date or datetime field)
DateA single calendar day (Today, Yesterday, Previous business day, or a date){{ param('as_of_date') }}Optional (must be a date field)
TextA single text value{{ param('region') }}Optional
List of textOne or more text values{{ param('regions').list }} (for IN clauses)Optional
NumberA single numeric value (rendered unquoted){{ param('min_amount') }}Optional

Use {% if param('name').present %} ... {% endif %} around optional inputs so the SQL leaves the condition out whenever the input has no value or is cleared.

A datetime field takes a Date range: its start and end become the first and last moments of whole days, so one day is a range of one. A single Date links only to a date field, because one date can't cover a whole day of timestamps.

Who sets it: Filter or Control

Each input says who sets its value on a dashboard.

  • Filter: the input narrows rows by a field's values. Pick the field; the input's type follows it. Viewers get the dashboard filter on that field, which also narrows other datasets that match it. A Date range is always a Filter, on a date or datetime field.
    • The dashboard Filter picker lists it under Inputs inside the dataset's folder, marked Needed by the cards that can't run without it until a filter sets it.
    • Option lists for One value and Several values load distinct values from the field (running with that input absent so viewers can see all choices).
    • A card that needs it and has no value offers a one-click Add filter.
  • Control: a value the SQL uses on its own, such as a rate, a number of days, or a scenario. There's no field; the type decides the widget viewers get:
TypeViewers get
DateA date picker (Today, Yesterday, Previous business day, or any day), rolling forward in the report's calendar on views, schedules, and Briefings
NumberA number box
One valueA text box (Viewers: Type it), or a pick list of choices you type (Viewers: Pick from a list)
Several valuesA multi-select list of choices you type
  • A Control's choices are yours to type; they never come from a field's values (that is a Filter). Choices must be unique and not empty, and a default must be one of them.
  • Add control on the dashboard suggests the dataset's Controls first, ready to use: for example Add Look back: a number box, 30 by default. Reaches 2 of 3 cards. Click it and the control lands on the toolbar at once, with its widget, choices, default, and required setting from the input; change its default or lock it in the control's settings. A card that needs one offers a one-click Add control, which adds it with its widget and choices and no value yet, for the viewer to pick.

Declaring inputs in the domain editor

  1. Open a SQL dataset in Add Dataset or Edit Dataset and write or paste your SQL. The editor never changes your SQL, and never declares an input on its own.
  2. Each param(...) the SQL uses that isn't declared shows as Not declared, with a Declare button. Declare the ones viewers should set. A reference the SQL can run without, because it has a default (param('min_sales', 0)) or sits inside {% if param('name').present %}, can stay undeclared; one it can't run without must be declared, or given a default in the SQL, before Preview Columns runs.
  3. Or click Add input above the SQL editor: Limit a field (a dataset field) or A value the SQL uses (a Date, Text, or Number). The new input waits as Not in the SQL until you use it: its Use it in the SQL list shows each reference to copy and the text it becomes, for example {{ param('regions').list }} becomes ('East', 'West'). Write the condition with your own column, then paste the reference into it.
  4. Configure each input: Who sets it (Filter on a field, or Control, with its choices for a pick list), type, label, the Required toggle, and an optional Default (fixed values or relative dates resolved in the report calendar; data-anchored relative defaults are not supported on inputs).
  5. Click Preview Columns. If a required input has no default, enter a preview value for it to validate the SQL. Optional inputs are also verified with no value so clearing the filter on a dashboard won't break the SQL.
  6. Click Apply and Save the domain.

Removing an input removes its row only; your SQL stays as it is. If the SQL still uses it, it shows as Not declared, and Declare brings it back with its settings. If you delete a reference from the SQL, its input moves to a dashed Not in the SQL row and is not saved unless the reference comes back.

How input filters behave on dashboards

  • SQL parameters, never a WHERE on the declaring dataset. Cards reading the declaring dataset receive the input value strictly through the dataset's SQL template—never as an extra outer WHERE predicate—so pre-aggregation and multi-column filters work accurately.
  • Restricted pickers. Input filter chips match the input's exact type (no multi-operator condition switching, no invalid ranges on single-day inputs). Required inputs cannot be cleared to empty; clearing an optional input sends an explicit empty value so it never silently falls back to the dataset's declared default.
  • One date filter across datasets. A Date or Date range input filter can be mapped in its Cards tab (or via MCP filter.bind) to a date field on another dataset on the same sheet—for example, letting one Order window filter drive both a SQL completed_orders card and a table-backed store_sales card. Cards reading the declaring dataset stay locked as "its SQL takes it".
  • Period-shifting comparisons. Period-over-period comparisons (vs previous period, vs last year, period_change) are refused on cards reading a dataset with an active Date or Date range input, because the SQL input clips the prior window. Fixed target comparisons, cleared optional date inputs, and cards on other datasets on the same sheet continue to run normally.

Precedence and overlap warnings

When more than one source can supply an input's value on a card, Semaphor resolves them in this order:

  1. Explicit card sql_param control binding
  2. Dashboard input filter value
  3. Same-name dashboard control
  4. Declared input default on the dataset
  5. Fallback value written in the SQL (param('name', default))

If a dashboard control shares its variable name with a declared input on a dataset the dashboard uses, the dashboard's Controls panel counts the dataset as usage (Used by <Dataset>) and shows a warning whenever a field-backed input or dashboard filter overlaps with that control so precedence stays visible.

Where input values apply

Resolved dataset input values carry consistently across every execution path: tables, charts, KPIs, Matrix tables, drill-to-detail, CSV and Excel exports, PDF renders, bookmarks, scheduled reports, Briefings, filter option lists, and MCP analysis (semaphor_analyze accepts datasetInputs and semaphor_get_dataset_schema lists every declared input).

Supported connections

Dataset inputs and template expressions work on all database-backed connections and S3 datasets. Google Sheets and uploaded-file connections do not support template expressions or dataset inputs.

On this page