Skip to main content
April 24, 2022
Solved

Data Buffer in Stored Calc is not working during Condolidation

  • April 24, 2022
  • 1 reply
  • 0 views

Hi All - I am trying to copy Base accounts from Actual to Plan Scenario but it is not working when I try to consolidate but it is working when I perform force consolidate. Below is the code and any help would be appreciated.

 

If ((Not api.Entity.HasChildren()) And (api.Cons.IsLocalCurrencyforEntity())) Then
If api.Pov.Scenario.Name = "Plan" Then
api.Data.Calculate("S#Plan = Eval(S#Actual:O#Top:I#Top:U1#Total_CostCenter:U2#Total_ProfitCenter)","A#[Corp_US_Sales].Base",,,,,,,,,,,,AddressOf OnEvalDataBufferScrFilter)
Brapi.ErrorLog.LogMessage(si,"APIDATA")

End If
End If

Private Sub OnEvalDataBufferScrFilter(ByVal api As FinanceRulesApi, ByVal evalName As String, ByVal eventArgs As EvalDataBufferEventArgs)
Try
eventArgs.DataBufferResult.DataBufferCells.Clear()
For Each sourceCell As DataBufferCell In eventArgs.DataBuffer1.DataBufferCells.Values
'Only process cells that have data
If (Not sourceCell.CellStatus.IsNoData) Then
'Apply filtered source cells with data as the new Data Buffer Cells
Dim resultCell As New DataBufferCell(sourceCell)

'Set cells for Data Buffer
eventArgs.DataBufferResult.SetCell(api.SI,resultCell,False)
End If
Next

Catch es As Exception
Throw ErrorHandler.LogWrite(api.SI, New XFException(api.SI,es))
End Try

End Sub

 

Thanks

 

Best answer by EricOsmanski

You can modify the formula like this so you do not need the Eval. RemoveNoData will remove all no data cells from the source. In this formula though, you should specify a destination (left side) Origin, IC, U1, and U2.

If ((Not api.Entity.HasChildren()) And (api.Cons.IsLocalCurrencyforEntity())) Then
If api.Pov.Scenario.Name = "Plan" Then
api.Data.Calculate("S#Plan = RemoveNoData(S#Actual:O#Top:I#Top:U1#Total_CostCenter:U2#Total_ProfitCenter)","A#[Corp_US_Sales].Base")
'Brapi.ErrorLog.LogMessage(si,"APIDATA")

End If
End If

1 reply

April 25, 2022

You can modify the formula like this so you do not need the Eval. RemoveNoData will remove all no data cells from the source. In this formula though, you should specify a destination (left side) Origin, IC, U1, and U2.

If ((Not api.Entity.HasChildren()) And (api.Cons.IsLocalCurrencyforEntity())) Then
If api.Pov.Scenario.Name = "Plan" Then
api.Data.Calculate("S#Plan = RemoveNoData(S#Actual:O#Top:I#Top:U1#Total_CostCenter:U2#Total_ProfitCenter)","A#[Corp_US_Sales].Base")
'Brapi.ErrorLog.LogMessage(si,"APIDATA")

End If
End If

KrishnaAuthor
April 25, 2022

Thanks EricOsmanski. Appreciate your quick response and I have done this through the above method and I am trying to achieve the same using the EVAL. Do you know what am doing wrong ? 

 

Thanks 

Krishna

April 25, 2022

Your Eval looks fine - just unnecessary. I believe once you put in a destination Origin, IC, U1, and U2 it will solve your formula issue. 

Also, Force Consolidate and Consolidate are different actions. A consolidate will look at the Entity's CalcStatus before performing the action. If the CalcStatus is OK, it skips the Entity. A Force Consolidate will perform the action regardless of CalcStatus, so its something else to be aware of.