A variable is a placeholder for a value. You can use variables in queries so when you change the value, your queries will be re-ran and the chart or table updated.

  • Variables map keys to values.
  • Setting Variables
    • These variables can be empty or set to defaults by the author when a dashboard is loaded.
    • User interaction with User Forms or Chart/Grids can set variables
      • User Forms have buttons, text inputs, numeric inputs etc. mapped to author specified keys.
      • Chart automatically populate specially named keys (ts/name/seriesName) when clicked.
      • Tables populate keys named tbl.YYY where YYY is mapped to each column name and the value is the selected rows column value.
  • Once a variable is set. Any SQL query containing that variable is sent and the view automatically updated.

Notice in the picture below, the author has added a Debug component. This component shows the value of all keys/values. On the left is a form where the user has chosen EUR/JPY, this causes the variable ccy to map to the value EUR/JPY.

Interactive Dashboards

Page Address Importance

The web page address contains the current key/values at all times. You will notice as you set variables either by interacting with forms, charts or tables that the address bar gets updated to contain these vaiables like so:

http://pulseui.net/dash/5/PnL?ccy=EUR%2FJPY&days=2

This has a number of benefits:

  • You can bookmark and share a page by emailing the URL.
  • When an author saves a dashboard, the current values in the URL are used as defaults when a dashboard is first loaded for other users.

Variable Formatters

Syntax: {{variable_name:format}}

The formatting of the variable normally depends on the data source, but in some situations you might want to override the default formatting. If for example you are trying to generate a query that involves nested quotations.

Format Description Examples
raw Turns off all formatting. No wrapping or escaping. Comma separates multiple values. A"A,BB,C MINUS
sql Wrap strings and dates with single-quotes, escape ' with ''. Comma separate multiple values. Enclose within parenthesis (). Detect single numerical values and pass without quotes. ('A"A','BB','C MINUS')
kdb Wrap strings with double-quotes, escape " with \". Semi-colon separate multiple values. Enclose multiple values within parentheses. Detect single numerical values and pass without quotes.
Note You may want to use `${{VARNAME}} to convert the string list to symbols.
("A\"A";"BB";"C MINUS")
csv Comma separates the values. No wrapping or escaping strings. A"A,BB,C MINUS
html HTML encode strings to escape <> as &lt;&gt; etc. A&quot;A,BB,C MINUS
pipe Same as CSV but uses pipe | separator. A"A|BB|C MINUS
json Wrap strings with double-quotes, escape " with \". Convert multiple values to array []. ["A\"A","BB","C MINUS"]
url URL encode the CSV version. %28A%22A%2CBB%2CC%20MINUS%29