Dataport export and decimals

Phenno
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.
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.
0
Answers
-
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.com0 -
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!0 -
I'd like to say thanks for this post, it just helped me.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions