-
What Grafana version and what operating system are you using?
9.3.6 running on MacOS, datasource is using the BigQuery datasource from Grafana Labs version 1.2.4. -
What are you trying to achieve?
Setup a variable with a value and a text field so that the text field is displayed but in the dashboard I can reference the value field in other sql. -
How are you trying to achieve it?
I am using the following SQL for the variable:
SELECT DISTINCT
ctx.Site AS __text,
ctx.SiteID AS __value
FROM contexts_v0.installation_context_v0 ctx
I have tested this SQL in BigQuery Explorer and it executes as I’d expect returning two columns with the appropriate names.
The variable is called varSiteId and I reference it using ${varSiteId}.
-
What happened?
${varSiteId} is being replaced with the name of the site (from __text) rather than the id (from __value). -
What did you expect to happen?
The site name to be displayed and ${varSiteId} to contain the (integer) id (for example “Test Site 01” would see “${varSiteId}” returning “21”. -
Can you copy/paste the configuration(s) that you are having problems with?
See above -
Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
No visible errors. -
Did you follow any online instructions? If so, what is the URL?
PostgreSQL data source | Grafana documentation