Time formatting fields
In many of my RB7 reports I have a requirement to show time fields. These
are a length of time rather than a date/time so the hours can be greater
than 24.
These time values are stored as integer fields in the database representing
the time in minutes.
I need to display these as HOURS:MINS so currently I am adding calculated
string fields to the query and in the OnCalc event I am formatting them
using my own Dlephi code into HHH:NN.
This is ok for my own built in reports but the end user can alter the
layouts and may select additional time fields to include so I would like an
easier way to do this.
I wonder if the best way to proceed is to create a new RB control that can
format these correctly or can I somhow enhance the DBText control to include
extra formatting commands to turn integer minutes into HHH:NN ?
Which do you think is the best way to proceed with this ?
are a length of time rather than a date/time so the hours can be greater
than 24.
These time values are stored as integer fields in the database representing
the time in minutes.
I need to display these as HOURS:MINS so currently I am adding calculated
string fields to the query and in the OnCalc event I am formatting them
using my own Dlephi code into HHH:NN.
This is ok for my own built in reports but the end user can alter the
layouts and may select additional time fields to include so I would like an
easier way to do this.
I wonder if the best way to proceed is to create a new RB control that can
format these correctly or can I somhow enhance the DBText control to include
extra formatting commands to turn integer minutes into HHH:NN ?
Which do you think is the best way to proceed with this ?
This discussion has been closed.
Comments
Unfortunately in the designer, it is not possible to assign a required
display format for a DBText Component. You could either have your customers
define this display format using that proprety of the DBText component, or
create a custom DBText component that assigns a static display format. See
the example located in the \RBuilder\Demos\6. RCL\ on creating and
registering a new RB component.
The TppDBText class is located in the ppCtrls.pas for reference.
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com