Question

I'm using Microsoft Navision 2009. I'm creating report that includes several number with decimal separator (double/float number in C#).

I'm stuck at the point where I want to display every number with two digits after decimal point.

Ex:

if number is 100, I want to display 100.00 if number is 100.5, I want to display 100.50 if number is 100.55, I want to display 100.55 if number is 100.505; i want to display either 100.51 or 100.50

Thank you in advance;

Language that I'm using is C/AL

Was it helpful?

Solution

Don't be lazy. Read essential manuals. Format function is your best friend in Nav.

strsubstno(text01,format(100.10,0,'<Precision,2:2><Standard Format,0>')) Third argument of Format is actually the format of result text. <Precision,2:3> means that if first argument is decimal it will have from 2 to 3 (minimum 2 and maximum 3) digits in decimal part. <Standard Format,0> means that the rest of format will be standard.

More here!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top