Revenue by Channel

Variables

Using variables

Add variables in SQL with {{var_name}}. When you type one, Lotus detects it and adds an input in the toolbar.

SELECT *
FROM orders
WHERE status = {{status}}
  AND created_at >= {{from_date}}
  AND total_amount >= {{min_amount}}

Types

  • Text – plain strings (quoted for you)
  • Number – integers/decimals
  • Date – date picker, ISO date

Widgets

  • Input – free text/number entry
  • Dropdown – choose one:
    • Static options – one per line. value.
    • SQL query – return columns as value, label (or a single value column).

Labels & defaults

  • Label defaults to title-cased variable name (min_age → Min Age).
  • Default value is used if the toolbar input is empty.

Optional clauses

Wrap a clause in [[...]] to make it optional. When the variable has no value, the entire clause is removed.

SELECT *
FROM users
WHERE 1=1
  [[AND "name" ILIKE ‘%’ || {{name}} || ‘%’]]
  [[AND "status" = {{status}}]]
Values are always sent as prepared parameters (no string interpolation), using your DB dialect’s placeholders.
Toolbar
Source
Schema

Results

Running...
Lotus v0.16.4 Lotus.Web v0.14.4