Skip to main content
Newcomer
May 21, 2023

Share capital Elimination rule

  • May 21, 2023
  • 2 replies
  • 0 views

Hi Experts,

I have to eliminate Equity and write elimination portion to NCI account. as part of this firstly i am testing with one of the equity accounts i.e "Sharecapital". For this i have written a rule as below and when i execute no errors as well no results. i do not see any reversal entry in C#Elimination.O#Elimination of source buffer value.

Kindly evaluate and help me if i am missing anything in the rule. even i do not see any record in the source buffer log. but there are records at C#Share for A#Sharecapital account.

 

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:C#Elimination")
Dim SourceBufferFilter As DataBuffer = Api.Data.GetDataBufferUsingFormula("FilterMembers(O#Top:C#Share:F#CLOSING,[A#[CAPITAL].Where(Text1 <> "")]")
 
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)'Save the data into destination.
End Sub

    2 replies

    OneStream Employee
    May 21, 2023

    I‘m not in front of my PC to test it, but I‘m sure, your use of filtermembers creates the problem.

    Can you try this:

    Api.Data.GetDataBufferUsingFormula("O#Top:C#Share:F#CLOSING:A#CAPITAL")

    I also wouldn’t use c#share necessarily as a source for the elimination. It won‘t work, when you need to do an at equity pick up.

    BTW, you can only use the [ and ] brackets once, nesting them isn‘t supported. 

    BCGAuthor
    Newcomer
    May 21, 2023

    i modified as you suggested =>Dim SourceBufferFilter As DataBuffer = Api.Data.GetDataBufferUsingFormula("FilterMembers(O#Top:F#CLBAL,A#CAPITAL)")

    still does not reverse the values in C#Elimination taking from C#Share

    Do i need to do any settings in consolidation alogorthm type - Standard/custom/share store/orgby...

    OneStream Employee
    May 21, 2023

    You have to specify the consolidation dimension, if not, it uses C#Elimination and this dataunit is still empty. Please use C#Translated. 

    BCGAuthor
    Newcomer
    May 22, 2023

    Hi ChristianW,

    Have modified it accordingly, still I am facing an issue. can you please evaluate the script

    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.
    BCGAuthor
    Newcomer
    May 22, 2023

    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.