Hi ChristianW,
Have modified it accordingly, still I am facing an issue. kindly you please evaluate the script if i am missing some thing to make this work
Rule >>>>
Case Is = FinanceFunctionType.ConsolidateShare
Dim entity As String = api.pov.entity.Name
Dim entityID As String = api.pov.entity.MemberID
Dim Pown As Decimal = api.entity.percentOwnership(entityID)
Dim Pcon As Decimal = api.entity.PercentConsolidation(entityID)
Dim pmin As Decimal = Pcon-Pown
Dim vMethod As OwnershipType = api.Entity.OwnershipType(entityID)
If Pown > 50.0 And Pown < 100.0 AndAlso vMethod.ToString = "FullConsolidation" Then
api.ExecuteDefaultShare() ' Default share calculation.
End If
Case Is = FinanceFunctionType.ConsolidateElimination
Dim entity As String = api.pov.entity.Name
Dim entityID As String = api.pov.entity.MemberID
Dim Pown As Decimal = api.entity.percentOwnership(entityID)
Dim Pcon As Decimal = api.entity.PercentConsolidation(entityID)
Dim pmin As Decimal = Pcon-Pown
Dim vMethod As OwnershipType = api.Entity.OwnershipType(entityID)
If Pown > 50.0 And Pown < 100.0 AndAlso vMethod.ToString = "FullConsolidation" Then
Call NCIElim(si,globals,api,args,pmin)
End If
api.ExecuteDefaultElimination()' Default Intercompany eliminations
End Select
'Sub Procedure
Private Sub NCIElim(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs,ByVal pmin As Decimal)
Dim ResulDataBuf As DataBuffer = New DataBuffer()
Dim DestinationInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("O#Elimination")
Dim SourceBufferFilter As DataBuffer = Api.Data.GetDataBufferUsingFormula("FilterMembers(C#Translated:O#Top:F#CLBAL:A#ShareCapital)")
SourceBufferFilter.LogDataBuffer(api,"records",100)
For Each sourceCell As DataBuffercell In SourceBufferFilter.DataBufferCells.Values
Dim ResultElse As New DataBuffercell(sourceCell) 'Copying the modified buffer cell to new result cell
ResultElse.CellAmount = ResultElse.CellAmount * - 1
If (Not sourceCell.CellStatus.IsNoData) Then
ResulDataBuf.setcell(si,ResultElse,True) ' Set result cell result buffer to save this later to destination
End If
Next
api.Data.setdatabuffer(ResulDataBuf,DestinationInfo)
End Sub
Getting below error :
Unable to execute Business Rule 'SubsidiaryRule'. Error processing script 'O#Elimination'. Error saving Data Buffer cells. Please make sure that all common members are resolved when using Finance Formulas and Formula Variables. This can occur when attempting to combine and save Unbalanced Data Buffers.