Report with SQL Query Binding

I’m trying to generate a report with the following SQL query where the report is on a window with two popup calendars.

SELECT turbine_compliance.PowerOutput1, turbine_compliance.WindSpeed1, turbine_compliance.PowerOutput2, turbine_compliance.WindSpeed2, turbine_compliance.PowerOutput3, turbine_compliance.WindSpeed3, turbine_compliance.WindSpeed4, turbine_compliance.PowerOutput4, turbine_compliance.t_stamp FROM turbine_compliance WHERE t_stamp >= '{Root Container.StartDate}' AND t_stamp <= '{Root Container.EndDate}'

The problem I have is that I can get it to work using static dates, but I’m having trouble getting it to work with the dates generated by the popup calendars. I’ve tried using ‘{Root Container.Popup Calendar.date}’ and ‘{Root Container.Popup Calendar.formattedDate}’ in the WHERE clause. In the example above, I’m trying to reference the StartDate and EndDate properties from the report.

I’m at a loss, but being very new at SCADA programming, I know it’s just something simple that I’m missing.

I’m running 7.8.3 on Windows 7 x64

The report viewer component doesn’t run the report SQL. That happens in the gateway, not in the client, and can only reference report parameters. The report viewer will show bindable properties for each input parameter defined in the report, which is how you need to feed client-side data over to the report generator. Use start and end timestamp parameters in the report’s SQL. In the report viewer, bind those properties to the popup calendars to feed the desired dates/times to the report.

By report do you mean the results of a query or report from the report module? If you want the user to be able to select two dates and view the results in a table then all you have to do is select the chain icon and find the date value from each calendar. You can script it to export the data to a html file, and then have the file open in a browser. Somewhere in the docs it should tell you how to do it.

Ok, thanks for the clarification.

This is what I’ve been using as a reference: https://docs.inductiveautomation.com:8443/display/DOC/SQL+Query+Binding

[quote=“jstwhln”]This is what I’ve been using as a reference: https://docs.inductiveautomation.com:8443/display/DOC/SQL+Query+Binding[/quote]Right. That’s how you supply query data to client-side objects other than the reporting module.

Got it, thanks!

Using ? in the WHERE clause solved my problem. It let me supply query data to the gateway.