Query Variables

Chart and table queries can use Keys to reference variables. Values can be selected in forms and this will populate the key.

The example form below contains one dropdown.

  1. The dropdown is populated from a user supplied list of value|nice name|descriptions.
  2. When a user selects an option, the value gets placed into the key.
    i.e. 1 Hour is selected, the key mins is populated with the value 60.
  3. This means any query that references the key mins using {{mins}} will be updated with the value 60.

Creating a form

e.g. below is a chart that uses the {{mins}} parameter to configure how many minutes of data to display.
Notice the curly braces are used within queries to allow your variables to be detected and replaced.

Creating a form

Do I need to use curly braces {{curlyBraces}} ?

No. You can also use double parentheses ((variable)).
However recommended best practice is to use {{variable}}.

Within the SQL code you need a way to identify variables you want to set. The clearest way to do this is by using containing braces similar BASH script. Other alternatives such as $prefix were considered but these clashed with functions used in some databases.

To Escape characters e.g. \{ can be used to force { to be sent. If you need to send a curly brace and do NOT want it replaced or used as a parameter, escape it.