The Short Date format is retrieved using Delphi calls which get the client machine's local Short Date format. If you would like to customize the display formats provided, check out the ppDisplayFormat.pas file in the RBuilder Source. An example of replacing a display format with one of your own can be found by clicking on the link below.
I added the two lines of code below into the ReplaceDisplayFormats example and it seemed to work fine. I ran the project, entered the designer and added a date system variable to the header band of the report. Next I changed the display format to the newly added "Short Date" which matched my Regional Settings in Windows. After that I closed the application, changed the Regional ShortDate settings, then re-ran the example. The ShortDate display format showed the newly added Windows ShortDate setting. Add breakpoints where your adding the format list and in the case statement of the myDisplayFormat class to make sure it is trying to fomat the dtDate type and not the dtDateTime type.
After further research, I found that you shouldn't need to create a customdate format because by default, ReportBuilder uses the Short Date format in Windows. When creating your template, make sure there is no display format set for the system variable when you save. This will cause the display format to automatically default to the Windows Short Date format and will change according to the specific computer's settings. If you then in turn want to set a custom display for the end-user, you will need to use the Report.Template.OnLoadEnd event to change the display format of the component.
The replaceable display formats are intended to be used to provide non-standard display formats and they are saved in the template so you were seeing the intended behavior.
I adjusted the demo I had you dowload earlier to work the way you need it to. Now you are able to select the 'short date' format and save the template, then the format will reflect another computer's setup when they load the template with DateTime or just Date. The display format saved in the template is the actual 'Short Date' string. New code in the format routine of the demo handles this case. You can download the updated demo at...
Comments
machine's local Short Date format. If you would like to customize the
display formats provided, check out the ppDisplayFormat.pas file in the
RBuilder Source. An example of replacing a display format with one of your
own can be found by clicking on the link below.
http://www.digital-metaphors.com/tips/ReplaceDisplayFormats.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I added the two lines of code below into the ReplaceDisplayFormats example
and it seemed to work fine. I ran the project, entered the designer and
added a date system variable to the header band of the report. Next I
changed the display format to the newly added "Short Date" which matched my
Regional Settings in Windows. After that I closed the application, changed
the Regional ShortDate settings, then re-ran the example. The ShortDate
display format showed the newly added Windows ShortDate setting. Add
breakpoints where your adding the format list and in the case statement of
the myDisplayFormat class to make sure it is trying to fomat the dtDate type
and not the dtDateTime type.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
After further research, I found that you shouldn't need to create a
customdate format because by default, ReportBuilder uses the Short Date
format in Windows. When creating your template, make sure there is no
display format set for the system variable when you save. This will cause
the display format to automatically default to the Windows Short Date format
and will change according to the specific computer's settings. If you then
in turn want to set a custom display for the end-user, you will need to use
the Report.Template.OnLoadEnd event to change the display format of the
component.
The replaceable display formats are intended to be used to provide
non-standard display formats and they are saved in the template so you were
seeing the intended behavior.
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
I adjusted the demo I had you dowload earlier to work the way you need it
to. Now you are able to select the 'short date' format and save the
template, then the format will reflect another computer's setup when they
load the template with DateTime or just Date. The display format saved in
the template is the actual 'Short Date' string. New code in the format
routine of the demo handles this case. You can download the updated demo
at...
http://www.digital-metaphors.com/tips/ReplaceDisplayFormats2.zip
--
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
It works - Thanks!
Jonathan