Home General

RE: Formatting variable field as currency

edited June 2001 in General
I have a variable field on my report that I set equal to the sum of two
other fields in the dataset I'm reporting on. All works great until I set
the DisplayFormat of the variable field to $#,0.00;($#,0.00). This is the
same as the DisplayFormat used for some other currency fields (not variable
fields) in the report. After doing that, and then rerunning the report,
instead of seeing the value displayed there, I see the literal text $ , .
;($ , . ) instead of the numeric values. I'm obviously doing something
wrong here. What's the easiest way to get this variable field to be
formatted as a currency field?

Comments

  • edited June 2001
    Hi,

    try a ppVariable and format your field within the onCalc event.

    enjoy,
    Ron.

  • edited June 2001
    Using what method? Perhaps you could give an example.

    Also, does DisplayFormat work differently than it does for other,
    non-ppVariable fields? In other words, why can't I just use the
    DisplayFormat?

  • edited June 2001
    Code the TppVariable.OnCalc event handler as Mr. Eckersberger suggested. I
    just did it with RB 5.56 and it works fine. Make sure the variable's type
    is double or currency.
    procedure TForm1.ppVariable1Calc(Sender: TObject; var Value: Variant);
    begin

    ppVariable1.DisplayFormat := '$#,0.00;($#,0.00)';

    Value := 20.55;


    end;


    Cheers,


    Jim Bennett
    Digital Metaphors


  • edited June 2001
    Problem wasn't with my DisplayFormat...was that I had ppVariable's type set
    to STRING! Ooops...changed it to currency and now all is well. Thanks.

This discussion has been closed.