Skip to main content
October 12, 2023

Question: BR to trigger Cube Load in Batch

  • October 12, 2023
  • 1 reply
  • 0 views

Reaching out to the community to see if someone has created a BR to trigger cube loads in a batch or sequence for several WF. Found this snippet but unsure how to use it: 

Dim objLoadCubeProcessInfo As LoadCubeProcessInfo = BRApi.Import.Process.LoadCube(si, wfClusterPk)

1 reply

October 13, 2023

Hi DiegoRomero 
Please have a look at GolfStream. You should find there a business rule called BFRM_SolutionHelper.
In this BR you should find what you want. You can test it also from the dashboard that works with it. I think it should help you a lot. (see extract below)
Nic

 

Line 26 : You will find your LoadCube

 

 

 

	Public Function AutoCompleteLoadAndProcessWF(ByVal si As SessionInfo, ByVal wfPlanClusterPk As WorkflowUnitClusterPk, ByVal wfImportChildSuffix As String) As Boolean
		Try		
			Dim completed As Boolean = False
			
			'If a suffix was not provided, just exit sub
			If Not String.IsNullOrWhiteSpace(wfImportChildSuffix) Then 							
				'Get the workflow unit PK and process the workflow	
				Dim wfProfile As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, wfPlanClusterPk.ProfileKey)
				Dim wfProfileParent As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, wfProfile.ParentProfileKey)
				Dim wfImportChildName As String = wfProfileParent.Name & "." & wfImportChildSuffix
				Dim scenarioName As String = ScenarioDimHelper.GetNameFromId(si, wfPlanClusterPk.ScenarioKey)
				Dim timeName As String =  TimeDimHelper.GetNameFromId(wfPlanClusterPk.TimeKey)											
				Dim wfChildClusterPk As WorkflowUnitClusterPk = BRAPi.Workflow.General.GetWorkflowUnitClusterPk(si, wfImportChildName, scenarioName, timeName)
			
				'Execute IMPORT-VALIDATE-LOAD-PROCESS workflow
				If Not wfChildClusterPk Is Nothing Then
					Dim impProcessInfo As LoadTransformProcessInfo = BRApi.Import.Process.ExecuteParseAndTransform(si, wfChildClusterPk, "", Nothing, TransformLoadMethodTypes.Replace, SourceDataOriginTypes.FromDirectConnection, True)
					If impProcessInfo.Status = WorkflowStatusTypes.Completed Then
						'Validate Transformation (Mapping)
						Dim valTranProcessInfo As ValidationTransformationProcessInfo = BRApi.Import.Process.ValidateTransformation(si, wfChildClusterPk, True)
						If valTranProcessInfo.Status = WorkflowStatusTypes.Completed Then
							'Validate Intersections
							Dim valIntersectProcessInfo = BRApi.Import.Process.ValidateIntersections(si, wfChildClusterPk, True)
							If valTranProcessInfo.Status = WorkflowStatusTypes.Completed Then
								'Load the cube
								Dim lcProcessInfo = BRApi.Import.Process.LoadCube(si, wfChildClusterPk)
								If lcProcessInfo.Status = WorkflowStatusTypes.Completed Then
									BRApi.DataQuality.Process.ExecuteProcessCube(si, wfChildClusterPk, StepClassificationTypes.ProcessCube, False)
									completed = True
								End If	
							End If
						End If									
					End If	
				Else
					BRApi.ErrorLog.LogMessage(si, StringHelper.FormatMessage(Me.m_MsgAutoLoadWFProfileDoesNotExist, wfImportChildName, scenarioName, timeName))		
				End If			
			End If
			
			Return completed
			
		Catch ex As Exception
			Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
		End Try			
	End Function

 

 

 

 

 

October 16, 2023

Thanks Nicolas, will try it out and comment with the results!