Showing posts with label Navision. Show all posts
Showing posts with label Navision. Show all posts

Rounding decimal values In Dynamics NAV

 As Navision is a financial system, it's obvious that most of the time we need to handle decimal values, and rounding decimals is a very important part of it. When we are converting high-value currency to low-value currency, a small decimal can make a big difference



Name

Type

AmountToRound

Decimal

RoundToNearest

Decimal

RoundToUp

Decimal

RoundToDown

Decimal



AmountToRound:=345.8689999999;

 RoundToNearest:=ROUND(AmountToRound,0.01,'=');

 RoundToUp:=ROUND(AmountToRound,0.01,'>');

 RoundToDown:=ROUND(AmountToRound,0.01,'<');

Continue Reading...

Duration Data Type in Dynamics NAV

 Represents the difference between two DateTimes. This value can be negative. It is stored as a     64-bit integer. The integer value is the number of milliseconds during the duration.

The following are examples of durations:

DATETIME-DATETIME=DURATION

DATETIME-DURATION=DATETIME

DATETIME+DURATION=DATETIME


This example is run on a computer with the Current Format in the Regional and Language

VariableDataType
DateTime1DateTime
Datetime2DateTime
DurationDuration

DateTime1 := CREATEDATETIME(010109D, 080000T); // January 1, 2009 at 08:00:00 AM DateTime2 := CREATEDATETIME(050509D, 133001T); // May 5, 2009 at 1:30:01 PM Duration := DateTime2 - DateTime1; MESSAGE(FORMAT(Duration));  


Continue Reading...