Question: BR to trigger Cube Load in Batch

DiegoRomero
New Contributor II

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)

2 REPLIES 2

NicolasArgente
Valued Contributor

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

 

 

 

 

 

Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.

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