Options

Dataport export and decimals

PhennoPhenno Member Posts: 630
Hello ppl.

Does anybody knows how to export decimal into TXT file (via dataport) which has 2 decimal places mandatory?

By using FORMAT command I can only make it to display (or not to display) decimals places at all but cannot force it to display 2 decimal places even if they are zero value.

for example:
in my txt file i have to have:
1234,00
1234,80

But I get (respectively):
1234
1234,8

So, how can I format decimal number to always print out with 2 decimal places?


On reports and labels (table fields on forms) there is a property for formating such fields (2:2 is exactly what I need) but through code I am not able to do it.

Answers

  • Options
    David_CoxDavid_Cox Member Posts: 509
    Look at the format in the help files and type decimal, there is a lot you can do!

    you need to put the decimal value into a textVariable, look at the codeunit 8 there is a function there FormatCellasText which will show how to do this as well but for now!

    ValueAsText := FORMAT(Value,0,'<Precision,2:2><Standard Format,0>');
    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
  • Options
    PhennoPhenno Member Posts: 630
    David Cox wrote:
    Look at the format in the help files and type decimal, there is a lot you can do!

    you need to put the decimal value into a textVariable, look at the codeunit 8 there is a function there FormatCellasText which will show how to do this as well but for now!

    ValueAsText := FORMAT(Value,0,'<Precision,2:2><Standard Format,0>');


    Thank you very much... Actually, just a minut ago I found a same solution (in help file too).

    Anyhow, thnx!
  • Options
    billhwang2008billhwang2008 Member Posts: 32
    I'd like to say thanks for this post, it just helped me.
Sign In or Register to comment.