Data Buffer
Hi - I am trying to execute the below code but it is not taking the prior month actual data. Could you please let me know what am doing wrong? It is copying only the current month.
Dim SrcDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("FilterMembers(V#YTD:F#EndBalInput:S#Actual:T#2026M11,[A#[BalanceSheet].Base],[U1#[Total_CostCenter].Base])")
srcdataBuffer.LogDataBuffer(api, "Results",10)
Dim Acct As String = String.Empty
Dim UD1 As String = String.Empty
Dim UD2 As String = String.Empty
Dim UD3 As String = String.Empty
Dim UD4 As String = String.Empty
Dim UD5 As String = String.Empty
Dim UD6 As String = String.Empty
Dim UD7 As String = String.Empty
Dim UD8 As String = String.Empty
Dim f As String = String.Empty
Dim Inc As String = String.Empty
Dim Org As String = String.Empty
Dim ResultDb As New DataBuffer
For Each Cell As DataBufferCell In SrcDataBuffer.DataBufferCells.Values
If Cell.CellAmount > 0 Then
'If Cell.CellStatus.IsNoData = True Then
Acct = Cell.DataBufferCellPk.GetAccountName(api)
UD1 = Cell.DataBufferCellPk.GetUD1Name(api)
UD2 = Cell.DataBufferCellPk.GetUD2Name(api)
UD3 = Cell.DataBufferCellPk.GetUD3Name(api)
UD4 = Cell.DataBufferCellPk.GetUD4Name(api)
UD5 = Cell.DataBufferCellPk.GetUD5Name(api)
UD6 = Cell.DataBufferCellPk.GetUD6Name(api)
UD7 = Cell.DataBufferCellPk.GetUD7Name(api)
UD8 = Cell.DataBufferCellPk.GetUD8Name(api)
f = Cell.DataBufferCellPk.GetFlowName(api)
Org = Cell.DataBufferCellPk.GetOriginName(api)
Inc = Cell.DataBufferCellPk.GetICName(api)
Dim ResultsCell As DataCell
ResultsCell = api.Data.GetDataCell("V#YTD:S#Actual:T#2026M10:" & "F#" & f & ":" & "I#"& Inc & ":" & "O#" & Org & ":" & "A#" & Acct & ":" & "U1#" & UD1 & ":" & "U2#" & UD2 & ":" & "U3#" & UD3 & ":" & "U4#" & UD4 & ":" & "U5#" & UD5 & ":" & "U6#" & UD6 & ":" & "U7#" & UD7 & ":" & "U8#" & UD8)
Brapi.ErrorLog.LogMessage(si, "flow" & f & "Orgin" & Org & "IC" & Inc & "Account" & Acct & "U1" & UD1 & "U2" & UD2 & "U3" & UD3 & "U4" & UD4 & "U5" & UD5 & "U6" & UD6 & "U7" & UD7 & "U8" & UD8 & ResultsCell.CellAmountAsText)
Dim ResultsCellf As New DataBufferCell(cell)
ResultsCellf.CellAmount = Cell.CellAmount + ResultsCell.CellAmount
ResultDb.SetCell(api.SI,ResultsCellf,False)
End If
Next
Dim d As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("V#YTD:F#EndBalInput:A#" & Acct & ":U1#" & UD1)
'Dim d As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("A#" & Acct & ":U1#" & UD1)
api.Data.SetDataBuffer(ResultDb,d)
