How to format decimal..?

voodoo
edited 2005-11-11 in Navision Attain
I have a decimal number(field in report) and I tried to use DecimalPlaces property of the field 0:0, because I need numbers before decimal separator:
example:
I have: 26,154.97 and I need: 26,154
and 0:0 doesn't do that.......after that I tried with ROUND:
SalesAmount[j] := ROUND(SalesAmount2[k],1,'>');
and with this I got 26,155.00
I know that i can cast it into integer, but is it possible to do with decimal?

Thanx
misha fka voodoo

Comments

  • Hi,

    try it with:

    SalesAmount[j] := SalesAmount2[k] DIV 1;

    br
    Josef Metz
    br
    Josef Metz
  • Or
    FORMAT(Amount,0,'<Sign><Integer Thousand>');
    

    But this leaves you with a text, not a decimal :?
  • Well... I tried with DIV but still have 26,154.00 :(

    Solution with format is ok, but after that I must cast it into decimal because must do some calculations
    misha fka voodoo
  • Why do you want to leave the .00 with calculations??? When the calculations are done the user does not see the value?

    Leaving the .00 is only usefull when presenting the value :?

    Or am I missing the point here :?:
  • Why do you want to leave the .00 with calculations??? When the calculations are done the user does not see the value?

    Leaving the .00 is only usefull when presenting the value :?

    Or am I missing the point here :?:

    I think that you didn't understand me, because I don't want to see anything after the decimal separator... that .00 i don't want to see :)
    misha fka voodoo
  • voodoo wrote:
    Well... I tried with DIV but still have 26,154.00 :(

    As far as I know there is no difference in calculating with 26,154.00 and 26,154

    In the database they are decimal values, the .00 is not stored in the database but only appears on presentation.

    The database contains 26154 (Or some weird BCD value)
  • voodoo wrote:
    Why do you want to leave the .00 with calculations??? When the calculations are done the user does not see the value?

    Leaving the .00 is only usefull when presenting the value :?

    Or am I missing the point here :?:

    I think that you didn't understand me, because I don't want to see anything after the decimal separator... that .00 i don't want to see :)

    try to change the Property "DecimalPlaces" to 0:0 in the output control.
    br
    Josef Metz
    br
    Josef Metz
  • voodoo wrote:
    Solution with format is ok, but after that I must cast it into decimal because must do some calculations

    ??? You need to do that only on output - and on output you do not do calculations...

    If you need do the calculations, you need to use ROund or DIV 1, after that, when you are presenting the value to the user, you need to use FORMAT or DecimalPlaces...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Ok, thank you all ;)
    misha fka voodoo