Forum Discussion

BCG's avatar
BCG
New Contributor II
2 years ago

Share capital Elimination rule

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
  • ChristianW's avatar
    ChristianW
    Valued Contributor

    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. 

    • BCG's avatar
      BCG
      New Contributor II

      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...

  • ChristianW's avatar
    ChristianW
    Valued Contributor

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

    • BCG's avatar
      BCG
      New Contributor II

      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.
      • BCG's avatar
        BCG
        New Contributor II

        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.