I am used round functionality, If I directly assign the expression of value Round(3.7) correct answer is displayed Ans4. But If I using the local variable(Number) assignment Number=3.7,then I assigned the expression of value Round(Number) answer is not displayed correctly. Ans 3. Anyone can help me pls

Please check the datatype of the variable (Number). I believe you are declaring it as an Integer, so the variable would store the value 3 only, so rounding or no rounding, you will get the answer as 3.

If you change the data type to Decimal, you will achieve what you are looking for.

Please check the datatype of the variable (Number). I believe you are declaring it as an Integer, so the variable would store the value 3 only, so rounding or no rounding, you will get the answer as 3.

If you change the data type to Decimal, you will achieve what you are looking for.

Please check the datatype of the variable (Number). I believe you are declaring it as an Integer, so the variable would store the value 3 only, so rounding or no rounding, you will get the answer as 3.

If you change the data type to Decimal, you will achieve what you are looking for.

Regards

Hai Amal

I need another clarification. I have to set the odd number .5 for example Round(11.5) correct answer is displayed Ans 12. but If I am set the even number .5 for example Round(12.5) I got 12. Actually correct answer is 13 right.Can u pls help me.

Check what data type is your variable? In above it is decimal.

Hai

I need another clarification. I have to set the odd number .5 for example Round(11.5) correct answer is displayed Ans 12. but If I am set the even number .5 for exampleRound(12.5)I got 12. Actually correct answer is 13 right.Can u pls help me

QUoted from this document: https://success.outsystems.com/Documentation/10/Reference/OutSystems_Language/Logic/Built-in_Functions/Math#Trunc

In expressions in client-side and server-side logic, applies the method round half to even (rounds to the nearest integer, 0.5 rounds to the nearest even integer).

So, if it is exactly 0.5, it will be rounded to EVEN number. 12.5 will be 12 (12 is even, 13 is odd); 13.5 will be 14 (14 is even, 13 is odd), etc.

to round up, just use expression like this:

Round(If(x-Trunc(x)=0.5, x + 0.1, x)) where x is a variable that is assigned your value, like 12.5.