Skip to main content

Internal Variables

In addition to the form variables you declare yourself, Kvery provides internal variables — values the platform supplies automatically when a query runs. Unlike form variables, you don't enter a value for these; Kvery fills them in.

The :log variable​

:log is a built-in custom query variable recognised by Kvery. It lets a query participate in Kvery's logging/auditing flow without you wiring anything up manually. Reference :log in your SQL where the platform expects it, and Kvery substitutes the appropriate value at run time.

Because it is provided by the platform, :log behaves consistently across the editor, scheduled runs and API calls.

Internal vs. form variables​

Form variablesInternal variables
Who supplies the valueThe person/caller running the queryKvery, automatically
Prefix$ (e.g. $status, $from_date): (e.g. :log)
Shows an input fieldYesNo
Safe insertionYes (apostrophes escaped)Yes

Combining them​

Internal and form variables work together in one query. Use form variables to let the user filter, and internal variables to keep the query wired into Kvery's platform behaviour:

SELECT *
FROM orders
WHERE created_at >= '$from_date'; -- form variable the user supplies

Tips​

  • Treat internal variables as reserved — don't reuse their names for your own form variables.
  • See the related directives for controlling output, status codes and webhooks alongside your variables.