Report Field Format on the Report (negative amount)

gisongison Member Posts: 128
Dear all,

I got a requirement from our user.
They like to show the amount while it's negative number as (100) instead of -100

I saw there is a format property on the report field. Is it possible to leverage this property?
anyone got a idea would be thankful.

Comments

  • garakgarak Member Posts: 3,263
    u need only the absolute value without the sign or instead of the sign the () :?:

    like
    -333 --> 300
    or
    -333 --> (300)

    :?:
    Do you make it right, it works too!
  • gisongison Member Posts: 128
    this one
    -333 --> (300)
    333 --> 300

    so i think i cannot use ABS(number) function
  • reijermolenaarreijermolenaar Member Posts: 256
    Hi Gison,

    Then you will have to create a function in your report like this:
    PROCEDURE FormatNumber(YourNumber : Integer) : Text[250];
    BEGIN
      IF YourNumber >= 0 THEN
        EXIT(FORMAT(YourNumber))
      ELSE
        EXIT('(' + FORMAT(ABS(YourNumber)) + ')');
    END;
    
    And put in the SourceExpr of you textbox “FormatNumber(YourNumber)”

    Regards,
    Reijer Molenaar
    Object Manager
  • bbrownbbrown Member Posts: 3,268
    Hi Gison,

    Then you will have to create a function in your report like this:
    PROCEDURE FormatNumber(YourNumber : Integer) : Text[250];
    BEGIN
      IF YourNumber >= 0 THEN
        EXIT(FORMAT(YourNumber))
      ELSE
        EXIT('(' + FORMAT(ABS(YourNumber)) + ')');
    END;
    
    And put in the SourceExpr of you textbox “FormatNumber(YourNumber)”

    Regards,

    The problem here is that, since they are now text, columns of numbers will not line up properly on the decimal point.
    There are no bugs - only undocumented features.
  • SavatageSavatage Member Posts: 7,142
    Did you try Control Panel->Regional & Language Options->Regional Options->Customize->Dill down on Negative Number Format-> Change to (1.1) :-k
Sign In or Register to comment.