Satyapal77
1 day agoNew Contributor
Business Rule: Copy data from one cube to another with different cube dimensions
Hello,
I have following two cubes in onestream:
- Volumes
- Detail
All the cube dimensions are the same except for UD1. For volumes, UD1 cube dimension is VintageDim and for detail its FunctionTotal.
I am trying to copy data from "Volumes" cube to "Detail" Cube through a Business Rule. I am running this business rule from Data Management Step. The rule runs perfectly but it doesn't copy the data. I don't get any error too. Please can someone help to understand the issue?
Public Sub CopyData()
Try
'Define the source and target information
Dim sourceCube As String = "Volumes"
Dim targetCube As String = "Detail"
Dim sourceScenario As String = api.Pov.Scenario.Name
'1. Pull data from the source cube (Volumes)
'Using a formula to capture the desired data unit
Dim sourceDb As DataBuffer = api.Data.GetDataBufferUsingFormula($"Cb#{sourceCube}:S#{sourceScenario}:A#Product_Sales")
'2. Convert the data buffer to match the target cube's dimensionality
'This handles the automatic mapping of extended members between the cubes
Dim convertedDb As DataBuffer = api.Data.ConvertDataBufferExtendedMembers(targetCube, sourceScenario, sourceDb)
'3. Set the converted data into the target cube (Detail)
Dim destInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("")
api.Data.SetDataBuffer(convertedDb, destInfo)
Catch ex As Exception
brapi.ErrorLog.LogMessage(si, "EXCEPTION: " & ex.Message)
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Sub
Thank you