Forum Discussion

Kashinath's avatar
Kashinath
New Contributor II
6 months ago

Data Buffer Mapping Related issues

Hi Community.

I have a rule that is using DataBuffer to copy data from 1 cube to another.The cubes have seperate dimensions. I have used DataBufferConvMapItems to map individual base dimensions . But I have some doubts regarding this :

Is there any sample code that helps solve this issue.?

Below is the complete code. Copying Data from Sales to Finance Cube. they both use separate entity dimensions , not extended ones.Sales have an LGL hierarchy from where we need to copy data , So For Eg :E#LGL190 data needs to be copied to E#190 in Finance. The rule is triggered using a customCalculate DM JOB  where the Data unit is Of Destination Finance cube."

 

Dim dataBufferConvInfo As New DataBufferConversionInfo
									
Dim dataBufferConvDimInfo As New DataBufferConvDimInfo
									
Dim dataBufferMapItem As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "F#SF_EndBal","F#EndBal", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapItem)								
									dataBufferConvInfo.FlowInfo = dataBufferConvDimInfo
								
									dataBufferConvDimInfo = New DataBufferConvDimInfo
									
Dim dataBufferMapAccount As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "A#Sales",  "A#40000", 1)

									
Dim dataBufferMapAccount2 As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember,"A#COGS","A#50000",1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapAccount)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapAccount2)
									dataBufferConvInfo.AccountInfo = dataBufferConvDimInfo
									
									dataBufferConvDimInfo = New DataBufferConvDimInfo
									
Dim	dataBufferMapU1Item As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD1#Top",  "UD1#None", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapU1Item)
									dataBufferConvInfo.UD1Info = dataBufferConvDimInfo
									
										
									dataBufferConvDimInfo = New DataBufferConvDimInfo
									
 Dim dataBufferMapU2Item As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD2#Top",  "UD2#Sales", 1)
									  dataBufferConvDimInfo.MapItems.add(dataBufferMapU2Item)
									dataBufferConvInfo.UD2Info = dataBufferConvDimInfo
									
									dataBufferConvDimInfo = New DataBufferConvDimInfo
									
Dim dataBufferMapU3Item As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD3#Top",  "UD3#None", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapU3Item)
									dataBufferConvInfo.UD3Info = dataBufferConvDimInfo
									
									dataBufferConvDimInfo = New DataBufferConvDimInfo
									
Dim dataBufferMapU4Item As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD4#Top",  "UD4#None", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapU4Item)
									dataBufferConvInfo.UD4Info = dataBufferConvDimInfo
									
									dataBufferConvDimInfo = New DataBufferConvDimInfo
									dataBufferMapItem = New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD5#Top",  "UD5#None", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapItem)
									dataBufferConvInfo.UD5Info = dataBufferConvDimInfo
									
									dataBufferConvDimInfo = New DataBufferConvDimInfo()
									
Dim dataBufferMapU6Item As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD6#Top",  "UD6#None", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapU6Item)
									dataBufferConvInfo.UD6Info = dataBufferConvDimInfo
									
									dataBufferConvDimInfo = New DataBufferConvDimInfo()
									
Dim	dataBufferMapU7Item As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD7#Top",  "UD7#None", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapU7Item)	
									dataBufferConvInfo.UD7Info = dataBufferConvDimInfo

									dataBufferConvDimInfo = New DataBufferConvDimInfo()
									
Dim	dataBufferMapU8Item As New DataBufferConvMapItem(DataBufferConvType.MapSourceMembersToFirstDestMember, "UD8#Top",  "UD8#None", 1)
									dataBufferConvDimInfo.MapItems.add(dataBufferMapU8Item)	
									dataBufferConvInfo.UD8Info = dataBufferConvDimInfo

Dim sourceDataBuffer As DataBuffer = api.Data.GetDataBufferUsingFormula("CB#Sales:S#"+ScenarioName+":E#LGL"+entityName+":V#Periodic:UD2#Top")

Dim destination As ExpressionDestinationInfo = api.Data.GetExpressionDestinationInfo("CB#"+CubeName+":S#"+ScenarioName+":E#"+entityName+":V#Periodic:UD2#Sales")
						

Is the Above Code Correct or any changes needed ?

the issue now is that Data in Top in the UD5 for Example is not copied to UD5#None in the destination , But None to None Data is getting copied.

api.Data.ConvertDataBuffer("Sales","Budget", databufferConvInfo, sourceDataBuffer)

This above  line is triggering an error saying "The Cube and Entity are invalid or Incompatible".

Tried Logging Source and Destination Buffer :

Source Buffer :

Dest Buffer :

 

Thanks a lot for the Help

  • TheJonG's avatar
    TheJonG
    Contributor III

    Hi - so I am having a bit of trouble following what the main issue is - is the Convert Data Buffer not working AND the UD5 is not copying correctly? 

    Are you getting the error after the Convert Data Buffer or on the Set Data Buffer? Is E#190 within the dimension that is assigned to the Finance Cube?

    For the UD5#Top to UD5#None conversion, you could do this fairly easily by moving UD5#Top to the source data buffer script which would move it to the common members and then change the common members to None. You could also do this by specifying UD5#None is the DestinationInfo script.

    Dim sourceBuff As DataBuffer = api.Data.GetDataBufferUsingFormula($"FilterMembers(Cb#Sales:S#Actual:U5#Top)",DataApiScriptMethodType.Calculate,True,DestinationInfoNone)
    
    					Dim dcPK As DataBufferCellPk = sourceBuff.CommonDataBufferCellPk
    					dcPk.UD5Id = DimConstants.None				
    					sourceBuff.CommonDataBufferCellPk.Equals(dcPK)