Skip to Content

Background: In EC Time Off one of the very common requirements is to round off the final result to nearest 0.5. Sample example given below

 

Final Result Rounded Result
1 1
1.2 1.5
1.4999 1.5
1.5 1.5
1.51 2
1.999 2
2 2

 

Solution: There is different ways to achieve the above result. One of the ways without any other lookup table/MDF is just multiply the Final Result with 2 & then round it up (Precision 0 & Threshold 0.01) & after that divide it by 2.

Sample Rule is below:

Explanation of the rule:

Final Result (accrualRuleVariables.Amount) Multiply by 2 Round() Divide by 2 (Rounded Result/Amount Posted)
1 2 2 1
1.2 2.4 3 1.5
1.4999 2.9998 3 1.5
1.5 3 3 1.5
1.51 3.02 4 2
1.999 3.998 4 2
2 4 2 2

 

So, it’s one the very useful but effective solution. I remember someone posted similar type of idea in the community portal long time back. Here I am adding the business rule snap shot with the explanation.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply