Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

DisplayFormat inconsistency

edited June 2003 in General
I have 2 reports. Report1 has a payment field that is TppDBText. I put the
following in the displayformat and it works perfectly:

$#,0.00 CR;$#,0.00 ;$#,0.00

And the display is

$4,845.76 CR

Report2 has a payment field but in this case the field is a TppVariable with
datatype = Currency. I put the same display format in it and it does not
display the proper format. I get something like this:

$32,125.45000000
and $4,845.76000

The # of decimals isn't consistent either.

Any ideas what is wrong here?

ReportBuilder Standard V 6.03. Delphi 5 Pro. Win2K.


--

Don Gollahon

Comments

  • edited June 2003
    The display format shown should be the same on both reports, because it
    relies on the same Windows regional settings for your machine. Is the
    datatype the same for each variable in the two reports? Are you loading the
    wrongly configured template which has the same report controls, just a
    different display format set on the variable? Perhaps Report.SaveAsTemplate
    is true? Try testing with the second report in a test application where
    SaveAsTemplate is false and it sits by itself on a form.

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    The reports are each in their own application. They are not shared. Save
    as Template is False in both apps.

    The TppDBText in Report1 is attached to a field in a table that is a
    currency field. The TppVariable in Report2 is assigned a value from a
    variable that is of type currency.

    The TppReport I design right on the form and is compiled with the app in
    each case. I use the same exact display format in both reports.


  • edited June 2003
    If the data being fed to the variable is the same, and the display format is
    the same, then it should work. What is the raw data value that is being
    returned from the data access component that doesn't work when compared to
    the one that does work? Is there a format being applied to the TField object
    on the dataset that is having an effect?

    Have you tried other simple display formats to see if any work as you
    expect?

    Is there an OnFormat event handler on the variable that is overriding your
    settings?

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    The problem is the $ sign in the format. If I remove that then the
    formatting works. It doesn't matter if the variable type is currency or
    double. Same results. Just can't use the $ sign for some reason.

    I have no other code on this TppVariable object. The value being displayed
    comes from a variable so there are no data objects directly connected with
    the TppVariable object on the report.

    I've tried changing the variable being assigned to TppVariable from currency
    to double and still the same result. Only works by removing the $ sign. I
    would like the $ sign though.

    Don't know why this works in the report in the other app. Only difference
    there is that app has the TppDBText object which displays a currency type
    field from a table.


  • edited June 2003
    The display formats are customizable. I added a new format to the example
    below and it works on a TppVariable.

    http://www.digital-metaphors.com/tips/ReplaceDisplayFormats.zip

    {new code}
    aFormatList.Add('$12.34 CR' + #1 + '$#.00 CR');


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited July 2003
    That worked.

    BTW: Can this get fixed in a future version of RB so the $ sign will work
    correctly?

    Thanks.



This discussion has been closed.