Finance Business Rule: Helper Function
This is an example of helper function that could be placed either in a Member Formula (in the Helper Functions section) or in a Business Rule (before the End Class line). Functions and subs allow developers to isolate chunks of code that will be repeatedly executed in other code.
'Substitute MyFunction for Helper Function name, and the type of returned
' object at the end of the Function line; this exmple returns a DataBufferCell.
'sourceCell is a parameter passed in, in this case a DataBufferCell;
' replace with name and type of the objects you want to pass.
'resultAccountId is another parameter passed, in this case an Account ID. Replace as necessary.
Private Function MyFunction( ByVal api As FinanceRulesApi, _
ByVal sourceCell As DataBufferCell, _
ByVal resultAccountId As Integer) _
As DataBufferCell
'This function will generate a Data Buffer Cell object which can be used on an Eval function
Dim ud2Name As String = String.Empty
Dim ud2Member As Member = api.Members.GetMember(DimType.UD2.Id, sourceCell.DataBufferCellPk.UD2Id)
If Not ud2Member Is Nothing Then
ud2Name = ud2Member.Name
End If
Return sourceCell
End Function
Source: Snippet Editor: Finance - Business Rules - General
Updated 2 years ago
Version 3.0