The OneStream Community is temporarily frozen until June 29th due to the ongoing maintenance. Please read the blog post here to learn more.

Forum Discussion

ChristianW's avatar
ChristianW
Icon for OneStream Employee rankOneStream Employee
4 years ago
Solved

Copy data from another cube (with different dimensionality)

Is there an easy way, to copy data from one cube to another (with different dimensionality)
  • ChristianW's avatar
    4 years ago

    Yes, there are some function in the financial business rules api to support this:

    api.Data.ConvertDataBuffer
    api.Data.ConvertDataBufferExtendedMembers

    With the first function, you define the mapping between the cubes on your own, the second one uses the extended dimension definition for the mapping.

  • ChristianW's avatar
    4 years ago

    Here is a sample for ConvertDataBufferExtendedMembers

    Dim sourceDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("cb#CubeName:A#All")
    targetDataBuffer = api.Data.ConvertDataBufferExtendedMembers("CubeName", "ScenarioName", sourceDataBuffer)
    Dim expDestInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo($"C#{api.Pov.Cons.Name}")
    	
    api.Data.SetDataBuffer(targetDataBuffer , expDestInfo)

    Here is a sample for ConvertDataBuffer

    Dim dataBufferConvInfo As New DataBufferConversionInfo
    	
    Dim dataBufferConvDimInfo As New DataBufferConvDimInfo
    Dim dataBufferMapItem As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD1#Top.Base",  "UD1#None", 1)
    dataBufferConvDimInfo.MapItems.add(dataBufferMapItem)
    dataBufferConvInfo.UD1Info = dataBufferConvDimInfo
    
    dataBufferConvDimInfo = New DataBufferConvDimInfo()
    dataBufferMapItem = New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD2#Top.Base",  "UD2#None", 1)
    dataBufferConvInfo.UD2Info = dataBufferConvDimInfo
    	
    Dim sourceDb As DataBuffer = api.Data.GetDataBufferUsingFormula("cb#CubeName:A#All")
    Dim targetDb As databuffer = api.Data.ConvertDataBuffer("CubeName", "ScenarioName", dataBufferConvInfo, sourceDb)
    	
    Dim expDestInfo As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo($"C#{api.Pov.Cons.Name}")
    	
    api.Data.SetDataBuffer(targetdb, expDestInfo)