# Best alternative to a datepicker for a table with a query

**URL:** <https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971>\
**Category:** Ignition\
**Created:** [August 12, 2022, 8:26pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971 "2022-08-12T20:26:24Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [August 12, 2022, 8:26pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/1 "2022-08-12T20:26:24Z")

</div>

Datepicker doesn’t autopopulate today’s date.

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

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 12, 2022, 10:09pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/2 "2022-08-12T22:09:29Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [August 13, 2022, 12:38am UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/3 "2022-08-13T00:38:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [August 15, 2022, 12:46pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/4 "2022-08-15T12:46:03Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 15, 2022, 1:05pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/5 "2022-08-15T13:05:13Z")

</div>

> [@zacharyw.larson](#):
>
> I am not sure what I did wrong.

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

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [August 15, 2022, 1:31pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/6 "2022-08-15T13:31:47Z")

</div>

> [@zacharyw.larson](#):
>
> If I set a binding, then when I try to change the date, the date picker reverts to the binding.

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.

---

<div class="post-metadata">

**Author:** ![zacharyw.larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zacharyw.larson/32/23749_2.png) [@zacharyw.larson](https://forum.inductiveautomation.com/u/zacharyw.larson)\
**Post date:** [August 15, 2022, 1:40pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/7 "2022-08-15T13:40:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [August 15, 2022, 3:27pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/8 "2022-08-15T15:27:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Zach\_Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zach_larson/32/54388_2.png) [@Zach\_Larson](https://forum.inductiveautomation.com/u/Zach_Larson)\
**Post date:** [February 28, 2024, 9:11pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/9 "2024-02-28T21:11:24Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 28, 2024, 9:13pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/10 "2024-02-28T21:13:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Zach\_Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zach_larson/32/54388_2.png) [@Zach\_Larson](https://forum.inductiveautomation.com/u/Zach_Larson)\
**Post date:** [February 28, 2024, 9:20pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/11 "2024-02-28T21:20:46Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 28, 2024, 9:59pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/12 "2024-02-28T21:59:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Zach\_Larson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zach_larson/32/54388_2.png) [@Zach\_Larson](https://forum.inductiveautomation.com/u/Zach_Larson)\
**Post date:** [February 29, 2024, 12:38pm UTC](https://forum.inductiveautomation.com/t/best-alternative-to-a-datepicker-for-a-table-with-a-query/62971/13 "2024-02-29T12:38:03Z")

</div>

A reset button is my best option for now?
