Reuse of variable parameters from 'Dashboard' Panel

Dear Support
many thanks for the fantastic product! I like to create a new ‘landing’ page where the user can select his application (e.g. App = ‘ABC’ / ‘variable list’ defined dynamically in the template) the landing page contain the ‘Dashboard’ Panel and now I want to reuse the previously set variable (App = ‘ABC’) in the ‘Dashboard’ panel to use it on the next dashboard. Is there a way to do that?

Cheers

Hi,

Are you aware that you can define a template variable using a query that will allow you to render a drop down of for example application names.

You cannot reuse variables between dashboards. You need to create a new template variable in each dashboard. What you can do is to link from landing page or other places to existing dashboards that has template variables using query string parameter to set template variable value, i.e.

http://...<dashboard url>?var-<replace with your variable name>=value

Marcus

1 Like

Hi Marcus - many thanks for your fast reply!
I was not aware of that. How can I clear exactly the variable? Unfortunately the HTML code below don’t work:
LINK

URL of the landing-page: /dashboard/db/landingpage_default?orgId=1&var-swid=A7E

thnx

Do you mean clear it by url query string parameter so that no value are selected?

Marcus

yes, In guess so… The user is calling the landing-page and set the variable to e.g. "var-swid=A7E"
When I use the following HTML code: href="/dashboard/db/api_manager_swid?orgId=1&var-swid=$value">LINK to FooBar.
But the variable in the new URL is not set to "var-swid=A7E"
thnx

Could you please provide screenshots or more in depth descriptions that’s underlines your problem? Landing page has template variable? In what dashboard do you have HTML code? What link is not working when?

Thanks

Marcus

Hi Marcus - I suspect that I misunderstood you completely but I have the link with HTML href built into a ‘TEXT’ panel. Below the JSON of the landing-page. Hope this will help.

{
“annotations”: {
“list”: [
{
“builtIn”: 1,
“datasource”: “-- Grafana --”,
“enable”: true,
“hide”: true,
“iconColor”: “rgba(0, 211, 255, 1)”,
“name”: “Annotations & Alerts”,
“type”: “dashboard”
}
]
},
“editable”: true,
“gnetId”: null,
“graphTooltip”: 0,
“hideControls”: false,
“id”: 5,
“links”: ,
“rows”: [
{
“collapse”: false,
“height”: 256,
“panels”: [
{
“content”: “#Landing Page which provides Links to the detailed dashboard\n\n

\n <a href="/dashboard/db/api_manager_swid?orgId=1&var-swid=value">LINK to API Manager\n

”,
“id”: 2,
“links”: ,
“mode”: “html”,
“span”: 6,
“title”: “Panel Title”,
“type”: “text”
}
],
“repeat”: null,
“repeatIteration”: null,
“repeatRowId”: null,
“showTitle”: false,
“title”: “Dashboard Row”,
“titleSize”: “h6”
}
],
“schemaVersion”: 14,
“style”: “dark”,
“tags”: ,
“templating”: {
“list”: [
{
“allValue”: null,
“current”: {
“tags”: ,
“text”: “A5P”,
“value”: “A5P”
},
“datasource”: “scaqa”,
“hide”: 0,
“includeAll”: false,
“label”: null,
“multi”: false,
“name”: “swid”,
“options”: ,
“query”: “select swid from t_swid”,
“refresh”: 1,
“regex”: “”,
“sort”: 1,
“tagValuesQuery”: “”,
“tags”: ,
“tagsQuery”: “”,
“type”: “query”,
“useTags”: false
}
]
},
“time”: {
“from”: “now-6M”,
“to”: “now”
},
“timepicker”: {
“refresh_intervals”: [
“5s”,
“10s”,
“30s”,
“1m”,
“5m”,
“15m”,
“30m”,
“1h”,
“2h”,
“1d”
],
“time_options”: [
“5m”,
“15m”,
“1h”,
“6h”,
“12h”,
“24h”,
“2d”,
“7d”,
“30d”
]
},
“timezone”: “”,
“title”: “landingpage_default”,
“version”: 3
}

thnx

I got it!
the code must look like this:

href=“/dashboard/db/api_manager_swid?orgId=1&var-swid=$swid”>LINK to API Manager

thnx

1 Like

Yes exactly. Great you solved it.

Hi Mefraimsson,

I am using table panel to redirect another dashboard using dynamic id

" Event-details?orgId=1&var-GatewayId=$GatewayId"

image

can you suggest any idea on this.

Thanks,
G Surendranath

I’m afraid you need to provide more information than that for me to be able understand your problem and help you.

Hi Mefraimsson,

Sorry for the confusion, I am using data source "MS Sql Server " for fetching data into it.
I have created one table panel to fetch data & i have used one of the column as a Link for redirect to another dashboard with below URL
https://surendranathgrafana.grafana.net/d/hYwvtcuiz/data-solution-elevator-details?orgId=1&var-GatewayId=$GatewayId
with dynamic variable.

Based on dynamic variable it has to use there own dashboard.
How to write that logic??

Can you help me on that.

Given you’ve been able to create a proper link in table panel you want to create a variable in the https://surendranathgrafana.grafana.net/d/hYwvtcuiz/data-solution-elevator-details?orgId=1&var-GatewayId=$GatewayId dashboard named GatewayId. Clicking on a link to https://surendranathgrafana.grafana.net/d/hYwvtcuiz/data-solution-elevator-details?orgId=1&var-GatewayId=value12345 will render $GatewayId as value12345.

Hi Mefraimsson,

Thank you for your quick response still i am confusing please find the below my exact requirement.
I have two dashboards (State & City), When i click on state dashboard that state code need to pass as a dynamic variable to city dashboard.
Could you please suggest & provide with example on this. It will more helpful for me.

Thanks,
G Surendranath

Please have a look at this demo I just created where you from table panel can navigate to another dashboard and setting variable in target dashboard: https://play.grafana.org/d/qiwXFEuiz/navigate-from-table-panel-to-dashboard-with-variable?orgId=1

Thank you Very much Mr. Mefraimsson its working fine.:grinning::grinning::grinning:

I have one more Query, I have world map panel and i am using Microsoft Sql Server with a table called Country & columns(Country_id[33],country_name[France],county_code[FR],longitude[46.2276],latitude[2.2137], geohash[0xE6100000010CD93D7958A8B50140E9482EFF211D4740]).
I am trying to fetch country’s data based on Longitude & Latitude or geohash but its not working. Can you please provide any example on that.

From the description at Worldmap Panel plugin for Grafana | Grafana Labs

Table Data with Latitude and Longitude Columns
The Table Data format also works with two columns for latitude and longitude instead of a geohash column.

  • A metric field. This is used to give the circle a value and determines how large the circle is.
  • Latitude/Longitude Fields. These are used to calculate where the circle should be drawn.
  • an optional location name field (shown in the mouse over). Used to label each circle on the map. If it is empty then the geohash value is used as the label.

Hi Mefraimsson,

Thank you for you suggestions on world map panel i have tried a lot with different scenario’s to get lat & Long coordinates and its circle finalize, but its not working in my scenarios.
I am using Microsoft SQL Server as a data source.If you have any examples on this please help me on that.

Thanks,
G Surendranath

Please include what MSSQL queries you’ve tried

SELECT
lat as lat,
long as lon,
gateway_id as unitname,
1 as metric
FROM Employee where gateway_id = ‘ABC’

lat lon unitname
2.2137 46.2276 ABC