# Table Query

**URL:** <https://forum.inductiveautomation.com/t/table-query/2427>\
**Category:** Ignition\
**Created:** [December 14, 2010, 10:44pm UTC](https://forum.inductiveautomation.com/t/table-query/2427 "2010-12-14T22:44:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rooks](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@rooks](https://forum.inductiveautomation.com/u/rooks)\
**Post date:** [December 14, 2010, 10:44pm UTC](https://forum.inductiveautomation.com/t/table-query/2427/1 "2010-12-14T22:44:42Z")

</div>

How can I use a single popup calendar to generate a db query to populate a table with the 24-hours of data for the selected date?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [December 14, 2010, 10:52pm UTC](https://forum.inductiveautomation.com/t/table-query/2427/2 "2010-12-14T22:52:32Z")

</div>

You can add a dynamic property to the popup calendar called date2 that is bound to the following expression:`dateArithmetic({Root Container.Popup Calendar.date}, 24, "hour")`You can now use both the date and date2 properties in your SQL query. Something like:`SELECT * FROM Table WHERE TStamp >= '{Root Container.Popup Calendar.date}' AND TStamp <= '{Root Container.Popup Calendar.date2}'`

---

<div class="post-metadata">

**Author:** ![rooks](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@rooks](https://forum.inductiveautomation.com/u/rooks)\
**Post date:** [December 14, 2010, 11:41pm UTC](https://forum.inductiveautomation.com/t/table-query/2427/3 "2010-12-14T23:41:11Z")

</div>

Thanks Travis. I’ll give it a try.

---

<div class="post-metadata">

**Author:** ![rooks](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@rooks](https://forum.inductiveautomation.com/u/rooks)\
**Post date:** [January 6, 2011, 7:06pm UTC](https://forum.inductiveautomation.com/t/table-query/2427/4 "2011-01-06T19:06:32Z")

</div>

Is there a way to have the initial calendar date be automatically set to “Todays” date when the window is opened?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 6, 2011, 8:40pm UTC](https://forum.inductiveautomation.com/t/table-query/2427/5 "2011-01-06T20:40:00Z")

</div>

Sure, just bind the date property to the following expression:`now(0)`When the window opens it will be set to the current date.

---

<div class="post-metadata">

**Author:** ![rooks](https://avatars.discourse-cdn.com/v4/letter/r/ce7236/32.png) [@rooks](https://forum.inductiveautomation.com/u/rooks)\
**Post date:** [January 6, 2011, 9:03pm UTC](https://forum.inductiveautomation.com/t/table-query/2427/6 "2011-01-06T21:03:11Z")

</div>

Thanks Travis. Is there a way to force the time to always be 12AM. The now(0) expression returns the current time, and I need it to always be set at 12AM.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [January 6, 2011, 9:12pm UTC](https://forum.inductiveautomation.com/t/table-query/2427/7 "2011-01-06T21:12:37Z")

</div>

You can do the following:`toDate(dateFormat(now(0), 'yyyy-MM-dd 00:00:00'))`
