Forum Discussion

ZubairCSC's avatar
ZubairCSC
New Contributor II
6 months ago

Cash Flow business rule is not working for other Cube using the same dimension

Hi All,

We have an application implemented with horizontal extensibility. We are trying to implement vertical extensibility now. We are leveraging all the dimensions we have used in horizontal extensibility except we have created new entity and account dimension along with the new cubes. 

We are using the same flow dimension and same members of rollforwards and cash flow.

We have uploaded the data successfully and got the TB but when we are trying to implement cash flow then we are having below error.

 

I checked all the code. This code works for my other cube which is using totally separated dimension and also separate flow dimension having separate members for rollforwards and cash flow.

My question is can we use same flow dimension, rollforwards and cash flow member for different cube if we are already using those for one of the cube to get the cash flow statement done?

I am pasting the code below for your reference. This is the exact code which is working perfectly for horizontal extensibility and also use for different cube having total different dimensions but when I am trying to execute this code for vertical extensibility (after making necessary changes in the token) then I am getting above error.

'Cashflow Rules on U1 DataType "CFStmtCalc"  Actual Scenario only.
 
#Region "Variables"
Dim accountType As String = String.Empty
Dim acctText1 As String = String.Empty
Dim flowMember As String = String.Empty
Dim cfFlowMember As String  = String.Empty
Dim x As Integer
Dim flowMemberID As Integer
Dim balSheetCashAcctsId As Integer = api.Members.GetMemberID(DimType.Account.Id, "Cash")
'Dim destinationInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("")
'Write to I#None:U1#CFStmtCalc:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None
Dim destinationInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("O#Import:I#None:U1#CFStmtCalc_OKL_GAAP:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None")
Dim resultDataBuffer As New DataBuffer
Dim acctFlow As List(Of String)
Dim acctFlowFields As List(Of String)
 
'Used for "Adjustments to reconcile net income to net cash used in operating activities"
Dim Target As String = ":O#Import:I#None:U1#CFStmtCalc_OKL_GAAP:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None"
Dim TargetNoU1 As String = ":O#Forms:I#None:U2#None:U3#None:U4#None:U5#None:U6#None:U7#None:U8#None"
Dim Source As String = ":O#Top:I#Top:U1#Top:U2#Top:U3#Top:U4#Top:U5#Top:U6#Top:U7#Top:U8#Top"
 
#End Region
 
'Run for all Entities in USD only and Elimination not needed.  ActualTB Scenario only.
If api.Pov.Scenario.Name = "Actual" Then
  If TimeDimHelper.GetYearFromId(api.Pov.Time.MemberId) > 2020 Then
If api.Cons.IsLocalCurrencyForEntity Or api.Cons.IsForeignCurrencyForEntity Then
 
' Bring in Beginning Cash and Ending Cash to the Cashflow hierarchy in Flow
api.data.calculate("F#CF_BegCash" & Target & " = RemoveZeros(F#BegBal" & Source &")","A#CashTot.Base")
api.data.calculate("F#CF_EndCash" & Target & " = RemoveZeros(F#EndBal" & Source &")","A#CashTot.Base")
 
' Bring in Net Income to the Equity Rollforward
'1107 api.Data.Calculate("A#3500:F#RF_EQ_NetInc:U1#Manual" & TargetNoU1 & " = RemoveZeros(A#NetInc:F#EndBal:V#YTD" & Source &")")
'1107 api.Data.Calculate("A#3500:F#RF_EQ_NetInc" & Target & " = RemoveZeros(A#NetInc:F#EndBal:V#YTD" & Source &")")
 
' Adjustments to reconcile net income to net cash used in operating activities
api.Data.Calculate("A#RetEarnCurr:F#CF_NetInc" & Target & " = RemoveZeros(A#NetInc:F#EndBal:V#YTD" & Source &")")
' api.Data.Calculate("A#Dividends:F#CF_DivInc" & Target & " = RemoveZeros(A#DivInc:F#EndBal:V#YTD" & Source &")")
api.Data.Calculate("A#AccumDepr:F#CF_Depr" & Target & " = RemoveZeros(A#DeprExp:F#EndBal:V#YTD" & Source &")")
api.Data.Calculate("A#AccumAmort:F#CF_Amort" & Target & " = RemoveZeros(A#AmortExp:F#EndBal:V#YTD" & Source &")")
' api.Data.Calculate("A#APIC:F#CF_StkComp" & Target & " = RemoveZeros(A#StockBasedCo:F#EndBal:V#YTD" & Source &")")
' api.Data.Calculate("A#RetEarnCurr:F#CF_PIKInt" & Target & " = RemoveZeros(A#IntExpPIK:F#EndBal:V#YTD" & Source &")")
 
' Calculations to bring Balance Sheet movements to Cashflow activity
' Data buffer with all BS accounts which have a proper Text1 field CF mapping
Dim sourceDataBuffer As DataBuffer = api.data.GetDataBufferUsingFormula("RemoveZeros(FilterMembers(E#OKL_GAAP:O#Top:I#Top:U1#Top:U2#Top:U3#Top:U4#Top:U5#Top:U6#Top:U7#Top:U8#Top,[A#BalanceSheet_OKL_GAAP.Base.Where(Text1 Contains 'CF_')]))",,False) 
 
If sourceDataBuffer.DataBufferCells.Count > 0 Then
For Each sourceCell As DataBufferCell In sourceDataBuffer.DataBufferCells.Values
If (Not sourceCell.CellStatus.IsNoData) And (sourceCell.CellAmount <> 0.00) Then
 
acctText1 = api.Account.Text(sourceCell.DataBufferCellPk.AccountId,1) 'Text 1 of the account
accountType = api.Account.GetAccountType(sourceCell.DataBufferCellPk.AccountId).Name 'Account type of the account (Asset, Liability)
 
If acctText1.XFContainsIgnoreCase(":") Then
 
' Could be multiple CF members for one BS account so need to split them up if there is a ',' found in Text1
acctFlowFields = StringHelper.SplitString(acctText1, ",", StageConstants.ParserDefaults.DefaultQuoteCharacter)
 
If acctFlowFields.Count > 0 Then
 
    For x = 1 To acctFlowFields.Count
 
    acctFlow = StringHelper.SplitString(acctFlowFields(x - 1), ":", StageConstants.ParserDefaults.DefaultQuoteCharacter)
    flowMember = acctFlow(0) 'Source:  this is source flow member
cfFlowMember = acctFlow(1) 'Destination:  this is the CF account in the Flow member
flowMemberID = api.Members.GetMemberId(DimType.Flow.Id, flowMember)
 
' If the flow we are processing is a base member of the source flow member 
If api.Members.IsBase(api.Pov.FlowDim.DimPk, flowMemberID, sourceCell.DataBufferCellPk.FlowId) Then
 
Dim resultCell As New DataBufferCell(sourceCell)
 
' Set the Destination Cell
resultCell.DataBufferCellPk.FlowId = api.Members.GetMemberId(Dimtype.Flow.Id, cfFlowMember)
 
If api.Pov.Cons.MemberId = DimConstants.Elimination Then
 
Else
resultCell.DataBufferCellPk.OriginId = DimConstants.Import
End If
 
' If it is not a Cash account
If (Not api.Members.IsBase(api.Pov.AccountDim.DimPk, balSheetCashAcctsId, sourceCell.DataBufferCellPk.AccountId)) Then
If accountType.XFEqualsIgnoreCase("Asset") Then
resultCell.CellAmount = sourceCell.CellAmount * -1
ElseIf accountType.XFEqualsIgnoreCase("Liability") Then 
resultCell.CellAmount = sourceCell.CellAmount
End If
Else 'If it is a Cash account
resultCell.CellAmount = sourceCell.CellAmount
End If
 
resultDataBuffer.SetCell(si, resultCell, True)
 
Exit For
End If 'Flow is Base Member or Not
 
Next
 
End If 'As long as more than 1 field
 
End If 'If acctText1.XFContainsIgnoreCase(":") Then
 
End If 'If (Not sourceCell.CellStatus.IsNoData) And (sourceCell.CellAmount <> 0.00) Then
Next 'For Each sourceCell As DataBufferCell In sourceDataBuffer.DataBufferCells.Values
 
resultDataBuffer.LogDataBuffer(api, "resultDataBuffer1", 10000)
api.Data.SetDataBuffer(resultDataBuffer, destinationInfo)
 
End If 'If sourceDataBuffer.DataBufferCells.Count > 0
 
End If 'If api.Cons.IsLocalCurrencyForEntity
  End If' TimeDimHelper.GetYearFromId(api.Pov.Time.MemberId) > 2020
End If' api.Pov.Scenario.Name = "Actual"

 

  • TheJonG's avatar
    TheJonG
    Contributor III

    Hi - this is somewhat hard to troubleshoot without seeing the app but the issue is likely due to some different dimensionality in the cubes. You mentioned that you are using a different account dimension in the new cube you are trying to execute these rules from. In your code, there are several instances where you are calling out specific accounts which presumably would not exist in the new cube. This could be your issue.