Round the result of an Allocation Method in People Planning

Ioana
New Contributor II

Is there a way to round the result of an Allocation Method?

I am calculating a value that has the formula |Wage| / 150000, but I would like to have in the Plan the result of ROUND(|Wage| / 150000, -2)

Thanks,

Ioana

1 REPLY 1

OS_Pizza
Contributor III

1. Create a XFBR rule to round of the value.

Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DashboardStringFunctionArgs) As Object
			Try
				If args.FunctionName.XFEqualsIgnoreCase("Roundoff") Then
					Dim valueToRound As Double =  Wage / 150000 '<-- Value to round
				    Dim numDecimals As Integer = 2       '<-- Number of digits to round
				
					Return Math.Round(valueToRound,numDecimals)
				End If

				Return Nothing

2. Use the XFBR expression in the allocation method -

XFBR(Rulename,Roundoff,Wage=|Wage|)

-------------------------------------------------------------------------------------------------------
If the answer helped you, Please give kudos and mark the answer as accepted solution 🙂