Windows - Table - Calendar date filer - SQL query

Hello

I’m trying to filer some data for a table. The reason I am using a table is the user wants to be able to download an excel document with the data.

I created a pop-up calendar called start_date, and then a table and a button to save the table to excel. This work perfectly without the date filter.

When I then add the command: WHERE datetime >= {Root Container.start_date.date}
I then get the error below:
Exception: Error running query:
SQLQuery(query=select *
From w00066
WHERE datetime >= 2017-06-06 16:41:40, database=watercare_za)@0ms
On: sg_ck1_all_settlers (1).Root Container.Table.data
caused by GatewayException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘16:41:40’ at line 2
caused by MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘16:41:40’ at line 2

Ignition v7.9.1 (b2017012511)
Java: Oracle Corporation 1.8.0_121

Parameter substitution (curly braces) within SQL bindings is purely a string concatenation. You need single quotes around your date parameters.

1 Like

Hello Phil,
Thank you so much, I thought I tried that, but I guess I was confusing myself.
Using the WHERE datetime >= ‘{Root Container.start_date.date}’ worked perfectly.
Thanks again!