VolkovLabs / volkovlabs-dynamictext-panel

Business Text Panel for @grafana
https://docs.volkovlabs.io
Apache License 2.0
78 stars 14 forks source link

Access data variable #214

Closed craftzneko closed 9 months ago

craftzneko commented 9 months ago

Is it possible to access a data variable from a query. ${__data.fields.Fieldname1}

mikhail-vl commented 9 months ago

@craftzneko What is the query? In the query Editor or in the JavaScript Code Editor? or somewhere else?

Please add more details.

craftzneko commented 9 months ago

It's a Sql query in the query editor it only returns a single column called with a single value based on dashboard variable, I'm basically using the panel for a single button and clicking the button sends an api req and takes the value from the query. Usually I would just reference with a Grafana query variable $__data.fields.datafieldname but these don't seem available in the JavaScript query. I can see I can access dashboard variables but these only refresh on time changes and this will refresh when a user changes the value of a text field

mikhail-vl commented 9 months ago

@craftzneko It's inside data as explained in the documentation: https://volkovlabs.io/plugins/volkovlabs-dynamictext-panel/code/.