Skip to content

Commit

Permalink
Update dashboard-template-variables.mdx
Browse files Browse the repository at this point in the history
  • Loading branch information
akristen committed May 8, 2024
1 parent 3bf6826 commit 81ffa97
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,25 +321,27 @@ As discussed in the [section on defining template variables](#step1), there are
Note that this is a different topic than writing queries that make use of a template variable.
</Callout>

Here are some rules and guidance on creating a query-type variable:
* You can use almost any NRQL query as long as it returns a list of values. For that, you can use either the `uniques` or `keyset` functions:
* with `uniques`:
You can use almost any NRQL query as long as it returns a list of values. For that, you can use either the `uniques` or `keyset` functions.

With [`uniques`](/docs/nrql/nrql-syntax-clauses-functions/#func-uniques):

```sql
From PageAction select uniques(countryCode)
```

```sql
-- you can use the second param to define the maximum number of results to be listed.
From PageAction select uniques(countryCode, 10000) --> this will return up to 10k results
```
Reference docs: [`uniques`](/docs/nrql/nrql-syntax-clauses-functions/#func-uniques)
* with `keyset`

With [`keyset`](/docs/nrql/nrql-syntax-clauses-functions/#keyset):

```sql
--- with `keyset`, you'll get a list with all of the attributes from the table you're querying from
From PageAction select keyset() SINCE 1 day ago
```
Reference docs: [`keyset`](/docs/nrql/nrql-syntax-clauses-functions/#keyset)

* Nested variables are not supported: there can't be variables within variables.
Keep in mind that nested variables are not supported as there can't be variables within variables.

## Some examples [#examples]

Expand Down

0 comments on commit 81ffa97

Please sign in to comment.