Share capital Elimination rule

BCG
New Contributor II

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
9 REPLIES 9

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

JackLacava
Honored Contributor

You're filtering by various dimension types (Origin, Cons, Flow, Account) and then in the target destination info you only specify one of them (Origin). The system by default will have marked all members for those dimensions as Common when you used GetDataBufferUsingFormula without extra parameters, and then when you go back to save that buffer, it doesn't know what to use as target members for the dimensions not in the destination info.

I guess what you want, in your case, is to pass the changeIdsToCommonIfnotUsingAll parameter as False, so that source dimensionality is preserved and you can save those datacells back where they came from.

BCG
New Contributor II

Hi JackLacava,

I have set all the common members now. But my C#Share of capital account is not getting eliminated but calculation/Consolidation was successful - Kindly help me in this regard.

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

BCG
New Contributor II

Hi Exports,

Can I expect some replies on the rule which i have shared above

JackLacava
Honored Contributor

Please keep in mind that these forums are not a replacement for official OneStream Support or training. People (including admins) will respond if and when they have the time and inclination to do so - there is no obligation on anyone to participate or solve problems in any given timeframe.

If you have urgent issues, feel free to contact OneStream Support and they'll be happy to assist.