Best alternative to a datepicker for a table with a query

Datepicker doesn’t autopopulate today’s date.

So what is the next best option for showing data across date ranges?

It’s not clear what you are asking.
If by “autopopulate today’s date” you mean have today’s date as an initial value then try adding an expression binding midnight(now(0)).
now(0) will only execute once on view load.

What has that to do with date ranges and tables?

4 Likes

What needs to be there in the date picker is to highlight today’s date, but you can easily auto populate selecting today’s date

3 Likes

I am not sure what I did wrong.
If I set a binding, then when I try to change the date, the date picker reverts to the binding.
I tried using a startup script, but that didn’t populate today’s date when I started the page.
Doing something wrong there maybe.

I am using two datepickers for a table with a query to get date ranges.
Since I can’t get them to populate with for example one for now and one for yesterday, I want to figure out the next best thing.

So I am asking instead of how to fix the datepicker, just what is the best alternative?

Sounds like you used now() when you should have used now(0), as @Transistor points out.

1 Like

Have you set the binding to bidirectional so that the date picker can update whatever it is bound to. If you don't then the binding will win.

1 Like

Thanks, I really appreciate the help.

I set the binding as now(0), and it is working.
I didn’t see a bidirectional option.

I am still curious what people are using instead of the datepicker when they use something different.
I am very happy that you helped me get this functionality with the datepicker.
Thanks

Expression bindings don’t have a bi-directional option because you’re binding to an ephemeral logic instead of a “physical” property or tag. You’ll notice that Named Queries also lack a bi-directional option, and even though Tag History references some actual tags there is no reasonable reason to write over historical data, so there is no directional option there either.

1 Like

8.1.30

I just setup a new date picker with now(0).

When I refresh the page, the value does not reset to today.

What does value reset to? Is there any chance the Gateway is in a different timezone, where the time difference makes sense?

value remains whatever I had last set the value as before I hit refresh on the browser.
Using chrome.
Gateway is eastern time.

I wouldn't expect a refresh to remove any modification you've already made... You'll notice the same behavior if you bind a Text Field against an expression of now(0), then modify the Text Field, and then refresh. User modification trumps binding, otherwise users are primed to lose all modifications on a page refresh.

I'm pretty sure others have noticed this, and thus requested the ability to hook into a "refresh" event.

A reset button is my best option for now?