I'm setting up the SQL syntax for a query dynamically. I'm working against a SQL server 7.0 database (using Delphi 5).
Having set the query and activating it I want to display one of the fields (an average AVG calculated field). If I am dealing with a TFloatField then I set the DisplayFormat of the field to be '0.000' using 'query.Fields[1] AS TFloatField).DisplayFormat := '0.000'', similarly if dealing with a date/time (for averaging a time duration) I set the DisplayFormat using 'query.Fields[1] AS TDateTimeField).DisplayFormat := 'hh:mm:ss'' (only wanting to view the time element.
This process seems to operate OK outside the scope of my application, when I introduce it into my program (using exactly the same logic and syntax) when I set one of the QRDBText components in the QuickReport to have the appropriate DataSet/DataField (either the TFloatField or TDateTimeField as listed above) I am not seeing the data in the format as set at the query level. That is for the TFloatField I am seeing i.e. '8.3333333333' (want to see '8.333') or for the datetime am seeing '31/12/1899 03:20:00' (want to see '03:20:00'). It's as if the QuickReport is not picking up the DisplayFormat set against the Fields.
Can anyone suggest what I am missing here ?
Thanks in advance
Steve
Having set the query and activating it I want to display one of the fields (an average AVG calculated field). If I am dealing with a TFloatField then I set the DisplayFormat of the field to be '0.000' using 'query.Fields[1] AS TFloatField).DisplayFormat := '0.000'', similarly if dealing with a date/time (for averaging a time duration) I set the DisplayFormat using 'query.Fields[1] AS TDateTimeField).DisplayFormat := 'hh:mm:ss'' (only wanting to view the time element.
This process seems to operate OK outside the scope of my application, when I introduce it into my program (using exactly the same logic and syntax) when I set one of the QRDBText components in the QuickReport to have the appropriate DataSet/DataField (either the TFloatField or TDateTimeField as listed above) I am not seeing the data in the format as set at the query level. That is for the TFloatField I am seeing i.e. '8.3333333333' (want to see '8.333') or for the datetime am seeing '31/12/1899 03:20:00' (want to see '03:20:00'). It's as if the QuickReport is not picking up the DisplayFormat set against the Fields.
Can anyone suggest what I am missing here ?
Thanks in advance
Steve