If a label is specified, the Label will be shown in the Field to Filter dropdown for Dashboard and widget filters.
Example: Using the runtime parameter filter with the label- "MEMBERS" at the dashboard and widget level:
Configuring Runtime Parameters (C9 Tokens)
To optionally use a runtime parameter:
- Set the token default value to *
- Prepend |$ at the end of the optional section
- Append $| at the end of the optional section
Syntax
Scenario 1: Optional runtime parameters placed at the middle or end of a WHERE statement:
WHERE <field1> = <value>
|$ and <field2> = $c9_<tokenName>$(*)$[<filterLabel>]$ $|
and <field3> = <value>
SELECT *
WHERE state = AZ
|$ and city = $c9_city$(*)$[city]$ $|
Scenario 2: Optional runtime parameter(s) at the beginning of a WHERE statement:
Single optional runtime parameter
|$ WHERE <field> = $c9_<tokenName>$(*)$[<filterLabel>]$ $|
WHERE |$ <field> = $c9_<tokenName>$(*)$[<filterLabel>]$ and $|
<field2> = <value>
SELECT *
|$ WHERE city = $c9_city$(*)$[city]$ $|
WHERE <field1> = <value>
|$ and <field2> = $c9_optional$(*)$
|$ and <field3> = $c9_optional2$(*)$ $| $|
and <field4> = $c9_required$(<value>)$
Example 3: The following query will return records where state equals AZ and set the default neighbourhood to Uptown. All cities and streets will be returned by default. If only a street is passed as a filter value, it will not be returned unless a city is also specified.
SELECT *
WHERE state = AZ
|$ and city = $c9_city$(*)$[city]$
|$ and street = $c9_street$(*)$[street]$ $| $|
and neighborhood = $c9_neighborhood$(Uptown)$[neighborhood]$
$C9_user_timeZone$ Token
The $c9_user_timeZone$ token allows users to dynamically display/use the user’s Knowi time zone within a query.
Note - Only direct queries can use the $c9_user_timeZone$ token.
To display the timezone:
- Navigate to the query editor.
- Select Direct Query as the data strategy.
- Write your query and include the $c9_user_timeZone$ token. The token will be replaced dynamically by the user’s Knowi timezone.
- Save your dataset.
For example: