DataManagementEventHandler CalculationType

rsantap
New Contributor II

Hello,

 

Has anyone used the DataManagementEventHandler business rule before and identified the CalculationType of the DM (i.e. Force Calculate, Consolidate...)? And also the Data Unit and the POV of the DM?

 

Colud anyone share an example?

 

Thanks in advance,

1 ACCEPTED SOLUTION

FredLucas
New Contributor III

Hi,


As you know, there are different types of DataManagement Steps (e.g.: Calculate,  Custom Calculate, Execute Business Rule, etc.). Each of them works slightly different from a DataManagementEventHandler point of view.
From your question I assume you are interested in the Calculate type of DM step so I'm posting a quick example where it shows how to identify the CalculationType and DataUnit(s) Note: POV does not apply for this Calc Type.

Select Case args.OperationName()
	
	Case Is = BREventOperationType.DataManagement.ExecuteStep				
		If args.isBeforeEvent Then 'Check that is Before Event
				
			If args.inputs(0).GetType Is GetType(DataMgmtStepMetadataInfo) Then 'Check args 0 is of type DataMgmtStepMetadataInfo
				Dim dmStepMetadataInfo As DataMgmtStepMetadataInfo = DirectCast(args.inputs(0), DataMgmtStepMetadataInfo)	
				Dim dmCalcDef As DataMgmtCalculateDefinition = dmStepMetadataInfo.CalculateDefinition 
				If dmCalcDef IsNot Nothing Then 'Check that is a Calculate Type step
					
					If dmCalcDef.CalculationType = CalculationType.ForceCalculate Then 'Check that is a Force Calculate calculation type step
						'Note: You can use IntelliSense to see the full list of CalculationTypes.
						
						
						' Get DataUnit(s) info:
						Dim cbInfo As CubeInfo = dmStepMetadataInfo.CubeInfo
						Dim CubeName As String = cbInfo.Cube.Name
						Dim entList As List(Of MemberInfo) = dmStepMetadataInfo.EntityInfos
						Dim parentList As List(Of MemberInfo) = dmStepMetadataInfo.ParentInfos
						Dim consList As List(Of MemberInfo) = dmStepMetadataInfo.ConsInfos
						Dim scenarioList As List(Of MemberInfo) = dmStepMetadataInfo.ScenarioInfos
						Dim timeList As List(Of MemberInfo) = dmStepMetadataInfo.TimeInfos
						
						
						'brapi.ErrorLog.LogMessage(si,"Force Calculate Check")
						
					End If
					
				End If
			End If

		End If
End Select


Hope this helps.

Also do please note that this API is not officially documented by OS so there is a chance it could suffer changes in future releases without prior notice.

View solution in original post

1 REPLY 1

FredLucas
New Contributor III

Hi,


As you know, there are different types of DataManagement Steps (e.g.: Calculate,  Custom Calculate, Execute Business Rule, etc.). Each of them works slightly different from a DataManagementEventHandler point of view.
From your question I assume you are interested in the Calculate type of DM step so I'm posting a quick example where it shows how to identify the CalculationType and DataUnit(s) Note: POV does not apply for this Calc Type.

Select Case args.OperationName()
	
	Case Is = BREventOperationType.DataManagement.ExecuteStep				
		If args.isBeforeEvent Then 'Check that is Before Event
				
			If args.inputs(0).GetType Is GetType(DataMgmtStepMetadataInfo) Then 'Check args 0 is of type DataMgmtStepMetadataInfo
				Dim dmStepMetadataInfo As DataMgmtStepMetadataInfo = DirectCast(args.inputs(0), DataMgmtStepMetadataInfo)	
				Dim dmCalcDef As DataMgmtCalculateDefinition = dmStepMetadataInfo.CalculateDefinition 
				If dmCalcDef IsNot Nothing Then 'Check that is a Calculate Type step
					
					If dmCalcDef.CalculationType = CalculationType.ForceCalculate Then 'Check that is a Force Calculate calculation type step
						'Note: You can use IntelliSense to see the full list of CalculationTypes.
						
						
						' Get DataUnit(s) info:
						Dim cbInfo As CubeInfo = dmStepMetadataInfo.CubeInfo
						Dim CubeName As String = cbInfo.Cube.Name
						Dim entList As List(Of MemberInfo) = dmStepMetadataInfo.EntityInfos
						Dim parentList As List(Of MemberInfo) = dmStepMetadataInfo.ParentInfos
						Dim consList As List(Of MemberInfo) = dmStepMetadataInfo.ConsInfos
						Dim scenarioList As List(Of MemberInfo) = dmStepMetadataInfo.ScenarioInfos
						Dim timeList As List(Of MemberInfo) = dmStepMetadataInfo.TimeInfos
						
						
						'brapi.ErrorLog.LogMessage(si,"Force Calculate Check")
						
					End If
					
				End If
			End If

		End If
End Select


Hope this helps.

Also do please note that this API is not officially documented by OS so there is a chance it could suffer changes in future releases without prior notice.

Please sign in! rsantap