Easy Chart DB Query gives errors

I am using Ignition 7.7.5
I have an Easy Chart that uses DB Pens. I am using a script to load the pens dataset with all the necessary information, here are the values of some of the columns for a single row.

COL_NAME = sngValue TABLE_NAME = tblRealValues XVAL_COL_NAME = dtTimeSampled DATASOURCE = DB WHERE_CLAUSE = lngTagId = 140
I have also bound the Chart’s ”Outer Range Start” and the ”Outer Range End” Properties to the Date Properties of 2 Pop Up Calenders.

I have 2 questions:

  1. The below is taken from the Active Queries window in the Database Connections Status Window on the Gateway. Why does the chart insert ”?” instead of the selected dates.

SELECT dtTimeSampled, sngValue FROM tblRealValues WHERE dtTimeSampled >= ? AND dtTimeSampled <= ? AND lngTagId = 140 ORDER BY dtTimeSampled. The same appears also as an error message in a Read timed out exception.
I have queried the database for what queries are running on it and the out put is similar, here it is:

(@P0 datetime,@P1 datetime)SELECT dtTimeSampled FROM tblRealValues WHERE dtTimeSampled >= @P0 AND dtTimeSampled <= @P1 AND lngTagId = 140 ORDER BY dtTimeSampled
I have also tried to omit the binding to the Ranges, but that doesn’t change the output. I have also tried to insert the dtTimeSampled in the where Clause of the SQL. But the existing dtTimeSampled <= ? remains.
What am i doing wrong?

  1. The Date in the Pop Up Calenders is set to have a format ”dd-MM-yyyy HH:mm:ss”. It is bound to the chart’s ”Outer Range Start” and the ”Outer Range End” properties. Why do these 2 properties have a different date format (MM/dd/yyyy HH:mm:ss GMT) than the pop up calenders. I tried using a toDate(dateFormat(…,…)) expression to force the conversion to the format i want, but with no success.

Thanks

Hi Maithen,

Don’t worry too much about those question marks. Those are placeholders for the variables that are your date ranges. Filling in variables that way prevents against things like SQL injection attacks. If you are getting a ‘Read Timed Out’ exception, there is a separate issue. If there was an error with your syntax, the error message would tell you that. I am unsure of what you are doing wrong without further information. Are you able to query the database using the DB Query Browser available under Tools in the designer? Have you tried running that same query but with hard-coded dates in place of the variables? Is the connection state active when you check in your gateway webpage?

  1. You don’t need to use dateFormat or any expression to change the format the popup calendar displays. All you need to do is select the component, in the property editor make sure ‘filter properties’ is set to All, then find the Format String property. You can edit that to display any date/time format you like.