Forum Discussion
Hello,
Going back to a simple example of seeding from an extended dimension:
Dim destinationInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo(String.Empty)
Dim sourceDataBuffer As DataBuffer = api.Data.GetDataBuffer(DataApiScriptMethodType.Calculate,"S#DetailedSourceScenario",destinationInfo)
Dim convertedDataBuffer As DataBuffer = api.Data.ConvertDataBufferExtendedMembers("AnotherCube", "AnotherScenario", sourceDataBuffer)
api.Data.SetDataBuffer(convertedDataBuffer, destinationInfo)
Onto your specific questions
Q1) How do I filter the source members (like the member filters in api.data.calculate)
A1) You do it in the GetDataBuffer expression. Remember that if you need to filter like U1#[XXX].Base then use the GetDataBufferUsingFormula along with a FilterMembers() . There are some examples in the Design & Reference Guide.
Q2) What's the equivalent of the onEvalDataBuffer that you get in api.data.calculate ?
A2) You can simply do a for each loop in the DataBuffer that you opened up in the first line, and loop over the data buffer cells in exactly the same way as you would be doing in the onEvalDataBuffer argument.
Regards
Chris
- royari3 years agoContributor
I followed the instructions above. I am trying to copy data from Actuals to 4_32_forecast scenario. Actual is extended to lower level detail. Forecast is higher level What am I doing wrong below
Dim startingBuffer As String = "S#Actual:I#None"
Dim filter1 As String = "[O#[Top]]"
Dim filter2 As String = "[A#[GMACM].base]"
Dim destinationInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo(String.Empty)
Dim sourceDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("FilterMembers(" & startingBuffer & ", " & filter2 & ", " & filter2 & ")")
If Not sourceDataBuffer Is Nothing Then
'Use ConvertDataBufferExtendedMembers when copying from one scenario to another scenario that has extended members
Dim destDataBuffer As DataBuffer = api.Data.ConvertDataBufferExtendedMembers(api.Pov.Cube.Name, "4_32_Forecast", sourceDataBuffer)
For Each sourceCell As DataBufferCell In sourceDataBuffer.DataBufferCells.Values
If (Not sourceCell.CellStatus.IsNoData) Then
Dim resultCell As New DataBufferCell(sourceCell)
destDataBuffer.SetCell(api.DbConnApp.SI, resultCell)
End If
Next
api.Data.SetDataBuffer(destDataBuffer, destinationInfo)
End If
'
End If
'End If 'Function is SeedForecast
End SelectReturn Nothing
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
Related Content
- 3 years ago
- 11 months ago
- 3 years ago