How to Split the Decimal Value into integer and decimal part

gulamdastagirgulamdastagir Member Posts: 411
Hello

In the navision Standard report #2 there is a field called Amount and suppose its showing "99.50" Dollars.

Is there a way we can split this into two text boxes one displaying 99 Dollars and the Other 50 Cents

Thanks,
gd
Regards,

GD

Comments

  • SteveOSteveO Member Posts: 164
    You can place 2 textboxes on your report (or actually an additional 1 because there is 1 there already)

    Make sure they both have the same Source Expression. In the Format property for the 1 you want to display integers type <Integer> in the other textbox's Format property type <Decimals>

    That's it.
    This isn't a signature, I type this at the bottom of every message
  • krikikriki Member, Moderator Posts: 9,118
    And in case you want it in variables:
    integer part := decDecimal DIV 1;
    decimal part := decDecimal MOD 1;
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • David_CoxDavid_Cox Member Posts: 509
    Try this

    MESSAGE('%1',99.50 DIV 1); //= 99
    MESSAGE('%1',99.50 MOD 1 * 100); // = 50

    So the source for the textboxes with decimal places set to 0
    AMOUNT DIV 1
    AMOUNT MOD 1 * 100
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • gulamdastagirgulamdastagir Member Posts: 411
    SteveO Posted: Thu Aug 24, 2006 2:43 am Post subject:


    You can place 2 textboxes on your report (or actually an additional 1 because there is 1 there already)

    Make sure they both have the same Source Expression. In the Format property for the 1 you want to display integers type <Integer> in the other textbox's Format property type <Decimals>

    That's it.


    Iam sorry it doesnt work,i already tried that before i made a post
    Regards,

    GD
  • David_CoxDavid_Cox Member Posts: 509
    edited 2006-08-24
    SteveO Posted: Thu Aug 24, 2006 2:43 am Post subject:


    You can place 2 textboxes on your report (or actually an additional 1 because there is 1 there already)

    Make sure they both have the same Source Expression. In the Format property for the 1 you want to display integers type <Integer> in the other textbox's Format property type <Decimals>

    That's it.


    Iam sorry it doesnt work,i already tried that before i made a post

    In the source for the textbox try FORMAT(Amount,0,'<Integer>') and FORMAT(Amount,0,'<Decimal>')

    But that gives 0.50 so FORMAT(Amount,0,'<Decimal>') * 100
    Analyst Developer with over 17 years Navision, Contract Status - Busy
    Mobile: +44(0)7854 842801
    Email: david.cox@adeptris.com
    Twitter: https://twitter.com/Adeptris
    Website: http://www.adeptris.com
  • gulamdastagirgulamdastagir Member Posts: 411
    THIS WORKS THANKS KRIKI AND DAVID
    David Cox Posted: Thu Aug 24, 2006 2:59 am Post subject:


    Try this

    MESSAGE('%1',99.50 DIV 1); //= 99
    MESSAGE('%1',99.50 MOD 1 * 100); // = 50

    So the source for the textboxes with decimal places set to 0
    AMOUNT DIV 1
    AMOUNT MOD 1 * 100


    kriki Posted: Thu Aug 24, 2006 2:50 am Post subject:


    And in case you want it in variables:
    Code:
    integer part := decDecimal DIV 1;
    decimal part := decDecimal MOD 1;
    Regards,

    GD
  • SteveOSteveO Member Posts: 164
    Hi gulamdastagir,

    I'm curious to find out why you said using the Format property does not work? As I have tested it and it does work, admittedly it does produce .50 as opposed to just 50 (unless this is what you where refering to?).

    Just in case
    FORMAT(Amount,0,'<Decimal>') * 100
    

    wont work because the FORMAT will have converted the expression to a string and string * 100 does not compute.
    This isn't a signature, I type this at the bottom of every message
Sign In or Register to comment.