Create variable with global variable as the default value

How could I create a variable and set it’s default value using the global variables


To add an text-box-type variable and use current date as it’s default value which means dynamic default value

I have tried ${__from}

however it made no sense


What seems to be the confusion, what are you trying to do

In short how can I set ${__from} as the default value when I add a text-box type new variable

I need to display the date of the current day by default every time the page is opened

And what uses that text box type value? Will users be able to edit and enter their own date? Does it have validation?
What if they enter ‘mickey’

No just like the screenshot shows

I want to set a text-box type variable
besides I want to set it a default value which should be changed every day

or is there a kind of variable that can work as an date selector ?

Gotcha. What will you use it for? On some sort of a query?

Yes the purpose is to ensure that users can always see the data of current day by default while they browser the page

And if they want to see the data of another day they can change the value of the variable input

So it will be more convenient if there is a better choice eg date-selector

1 Like

Look into this plugin for grafana

You are trying to use a simple variable for free hand text entry to do something it is not designed for: a date picker

Someone can type mickey mouse :mouse:

OK I have looked into the calendar plugin
However it is not very suitable for our demand
And what I need is only a simple selector which should be small and easy to use
Trying to use a simple variable for free hand text entry for us is also a reluctant way
So I wander if there any better way?

Yes the better way would be you developing a date picker plugin

OOPS that should be very cool

After grafana is used, the basic ecology is very bad

I might rather consider another platform :sweat_smile:

And thks for your help

1 Like