How to put decimal places on a var
DarkHorse
Member Posts: 389
Dear sirs, I've a code that shows a message that shows and import, this import came from the division from two fields. The code is similar to:
importvar:=(Item."import1")/(Item."import2");
MESSAGE:='You must sum '
+FORMAT(importvar)+' to the cost';
The problem is that the message shows a lot of decimals, dependes of the import, and I want that it only shows 2 decimal places. The import1 and import2 fields are decimal type and have 0 decimal places in their properties, but I don't know how to do the same on the var. Any idea please?.
Thanks in advance.
importvar:=(Item."import1")/(Item."import2");
MESSAGE:='You must sum '
+FORMAT(importvar)+' to the cost';
The problem is that the message shows a lot of decimals, dependes of the import, and I want that it only shows 2 decimal places. The import1 and import2 fields are decimal type and have 0 decimal places in their properties, but I don't know how to do the same on the var. Any idea please?.
Thanks in advance.
0
Comments
-
Hi,
You can use formatting instructions. For example, you can format your message like this:
MESSAGE:='You must sum '
+FORMAT(importvar, 0, '<Precision,2:2><Standard Format,0>' )+' to the cost';
This will show only 2 decimal places.
Damir0 -
Fantastic!!; it works perfectly.
Thank you very much for your help.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 333 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