By default, a dashboard frame uses either *SELECT * FROM SELECT* (if Include ROWTIME is not selected) or SELECT STREAM ROWTIME, FROM * (if Include ROWTIME is selected).
following variables are available inside a template:
|schema||The schema for the selected input.|
|object||The name of the selected input stream/table/view|
|type||The type of SQL object selected: stream, table, or view.|
|streaming||A Boolean value that is true if the input is streaming.|
|tableview||A Boolean value that is true if the input option to view views as tables is true|
|rowtime||A Boolean value that is true if the rowtime input option is true|
|selection||The object of the SELECT clause: the part that goes between SELECT and FROM, such as STREAM ROWTIME,*, or ***, **depending on input options.|
|from||The full name of the stream, table or view.|
|msg||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 && msg.id) print( 'WHERE "state" = ' + "'" + msg.id.substring(4) +"'"); %>
The statement adds a WHERE clause to the table’s SELECT statement when a state is selected.