- All Categories
- 73 General
- 73 Announcements
- 66.5K Microsoft Dynamics NAV
- 18.6K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 115 Navision DOS
- 854 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 615 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 271 Dynamics CRM
- 109 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 993 SQL General
- 384 SQL Performance
- 34 SQL Tips & Tricks
- 34 Design Patterns (General & Best Practices)
- Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.7K General
- 1.1K General Chat
- 1.6K Website
- 79 Testing
- 1.2K Download section
- 23 How Tos section
- 259 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions

Options

Aravindh_Navision
Member Posts: **258**

Hi Friends,

I have 3 decimal fields in report.

Say A, B and C where C = A + B.

I am multiplying A, B and C with 1.235025 (ERV = exchange rate value) and the results are store in D,E and F respectively.

Then my answer should be: D = E + F. The problem I'm facing here is all these D, E, F fields are automatically rounding off. But I don't want those field to round-off. Instead I should get the exact value with 2 decimal places. How to proceed with it?

The code I wrote is as follows:

I have 3 decimal fields in report.

Say A, B and C where C = A + B.

For example: A = 50310.06; B = 3521.70; C = 53831.76

I am multiplying A, B and C with 1.235025 (ERV = exchange rate value) and the results are store in D,E and F respectively.

Then my answer should be: D = E + F. The problem I'm facing here is all these D, E, F fields are automatically rounding off. But I don't want those field to round-off. Instead I should get the exact value with 2 decimal places. How to proceed with it?

The code I wrote is as follows:

ERV := 1.235025; D := ROUND((A * ERV),0.01,'<'); E := ROUND((B * ERV),0.01,'<'); F := ROUND((C * ERV),0.01,'<');

I'm getting the output as: D := 62134.19 [50310.06 * 1.235025] E := 4349.38 [3521.70 * 1.235025] F := 66483.59. [53831.76 * 1.235025]. The right answer should be: D := 62134.18 E := 4349.38 F := 66483.56

0

## Comments

774First some clarifications:

ERV = 1.238237

or1.235025?D = E + F

orF = D + E?Never stop learningVan Vugt's dynamiXs

Dutch Dynamics Community

774Microsoft Dynamics NAV Classic

D = 62.134,18

E = 4.349,38

F = 66.483,56

OK

So what's the problem?

BTW: this is the code I have created ina codeunit: with all variables of data type

DecimalNever stop learningVan Vugt's dynamiXs

Dutch Dynamics Community

258lvanvugtfor your reply. Below are my answers...1. ERV := 1.235025;

2. F = D + E

258774Never stop learningVan Vugt's dynamiXs

Dutch Dynamics Community

1,125F = D + E and

F' = ROUND(C * ERV)

Are you sure, the values you gave us are the actual values or might this be the true values rounded for display?

258The examples that I have given here are the real ones. This I am doing for Invoice. If even .02 difference occurs, it will be questioned in auditing.

359Check this option also if the calculation in question is getting the values from table fields..