Text box variable: Add option to have a default value based on another variable #38208
Replies: 3 comments
-
We're in the process of moving Grafana feature requests to GitHub Discussions. This issue is being moved to Discussions or has been moved from our issues list, depending on where you're seeing this message. We hope to use the discussion thread to continue building use cases, and additional evidence based on engagement/voting, in order to help us prioritize this feature request later on down the road. As with all things Grafana, we value your input and participation in this project and appreciate your patience during this transitional period. Looking forward to the discussion! |
Beta Was this translation helpful? Give feedback.
-
Just wanted to give another upvote for this feature! In the Azure Monitor datasource we can reference other variables by doing things like ResourceGroups($subscription) which I think is very helpful for our users. So it's pretty unexpected when you switch to Constant or Custom and realize you can't do something like this: #40783 where you make a string out of several template variables. I think we currently half-way support this by letting users modify the dashboard json objects directly, but it would be nice to let datasources at least opt in to this sort of support maybe? |
Beta Was this translation helpful? Give feedback.
-
Hello, as you may have heard, we are #73424. I believe this is being addressed here #1032 If I am mistaken, feel free to make an issue if you cannot find a solution and would like to request the feature. |
Beta Was this translation helpful? Give feedback.
-
What would you like to be added:
I would like to be able to set the default of a text box variable based on another variable.
Why is this needed:
Example:
I would like to have a variable called "max_memory_hide", of type "Query", and calculate the maximum memory from my hosts based on an SQL query of my PostgreSQL database. This variable will be hidden.
I would like to have a second text box variable called "max_memory", and set its default as $max_memory_hide.
This is used to filter our lists based on the max of our hosts memory.
The user can change the max value in the text box if he wants to filter the records differently.
Adding an option to add a rule that checks that the value the user added meets the requirements, may also be very useful.
For example: lower than 100, lower then $max_memory_hide, greater then 0 and so on. If its a text allow regex check.
This way the user is notified if the value they used is incorrect and panels will not break.
The first requirement, I believe, can also be useful for the "custom" and "constant" variables.
Beta Was this translation helpful? Give feedback.
All reactions