OSAdmin
Valued Contributor

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 

Version history
Last update:
‎09-15-2023 06:50 AM
Updated by:
Contributors