Customizing the SELECT template

<< Click to Display Table of Contents >>

Navigation:  Using s-Dashboard > Working with Panels > s-Dashboard Input Overview > Setting Input Preferences >

Customizing the SELECT template

Previous pageReturn to chapter overviewNext page

By default, a dashboard frame uses either SELECT * FROM <input> SELECT (if Include ROWTIME is not selected) or SELECT STREAM ROWTIME,* FROM <input> (if Include ROWTIME is selected).

You can use the SELECT template to modify this SELECT statement that's used to get the data for that frame of the dashboard. To do so, you need to know both SQL and JavaScript. For assistance in implementing this template, please contact SQLstream support at

The SELECT statement uses an JavaScript Underscore template that accepts a series of variables. For example, the above default SELECT statement would be represented in the template as SELECT <%= selection %> FROM <%= from %>.

The following variables are available inside a template:




The schema for the selected input.


The name of the selected input stream/table/view


The type of SQL object selected: stream, table, or view.


A Boolean value that is true if the input is streaming.


A Boolean value that is true if the input option to view views as tables is true


A Boolean value that is true if the rowtime input option is true


The object of the SELECT clause: the part that goes between SELECT and FROM, such as STREAM ROWTIME,*, or *, depending on input options.


The full name of the stream, table or view.


The message on the s-dashboard blackboard for the current 'Listen to' channel.


This following statement added to the SELECT template adjusts the SELECT statement for the stream or table:

SELECT <%= selection %> FROM <%= from %> <% if (msg && print( 'WHERE "state" = ' + "'" + +"'"); %>

The statement adds a WHERE clause to the table's SELECT statement when a state is selected.