Round off decimal number 281.75 ,actual result I want 281.8

Hi all, There is a distance value =281.75 but I want to round off as result =281.8.

After decimal I need only 1 digit in round off example value =281.75 and the actual result i want =281.8.

Kindly help us. I tried so many times.

281.75
result =281.8
I also tried that one also Trunc(Number) + If(Number=Trunc(Number),0,1) ,but not getting actual result it showing as result=282 only.



Hi Yasmeen Shaikh,


you can  use javascript toFixed() to achieve Your requirement

http://jsfiddle.net/VsLp6/

check this fiddle


Thanks & Regards

Vignesh Prakash.

Hello Yasmeen,


Have you tried using the built-in function Round?

Here is a link of the doc: https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Math#Round


In your case you would define it as Round(value,1)


Hope this helps!

- Emman

Emman Si wrote:

Hello Yasmeen,


Have you tried using the built-in function Round?

Here is a link of the doc: https://success.outsystems.com/Documentation/11/Reference/OutSystems_Language/Logic/Built-in_Functions/Math#Round


In your case you would define it as Round(value,1)


Hope this helps!

- Emman

Yes I had already tried that built in math functionality for round number but not getting the actual result which i want as per required



Hi Vignesh,

Hope this will work

Thanks !!


Hi Yasmeen,

Also note that the Round action rounds to the nearest "even" integer in client and server actions (as per the documentation Emman linked to).

There is a MathUtils forge component that provides an additional action available for server actions Math_RoundAwayFromZero(n: decimal).  Although I notice it does not specify the number of decimal digits, but that will be updated shortly.

I hope this helps!

Kind regards,

Stuart

Stuart Harris wrote:

Hi Yasmeen,

Also note that the Round action rounds to the nearest "even" integer in client and server actions (as per the documentation Emman linked to).

There is a MathUtils forge component that provides an additional action available for server actions Math_RoundAwayFromZero(n: decimal).  Although I notice it does not specify the number of decimal digits, but that will be updated shortly.

I hope this helps!

Kind regards,

Stuart

Thanks a lot Harris