Forum Discussion
Hi Nicolas - thanks for the reply. I looked at the article and that is just about batch posting. What I am looking to do is when you Click Complete Workflow on the Input Forms or Input Journals or after you upload a file on the Import step that it automatically processes the remaining steps (Validate, Process, Confirm etc). It look like that snipet would do that I just dont know how to call that snipet since this is standard OS functionality. I dont want to have to add a Workspace step to do it.
- ckattookaran3 years agoVIP
For some reason I like using
BRApi.Import.Process.ValidateTransformation
BRApi.Import.Process.ValidateIntersections
BRApi.Import.Process.LoadCube
BRApi.DataQuality.Process.ExecuteProcessCube
vs. the Harvest approach. It is more readable than the other approach. Here is a snippet that I use. This is been done from a Dashboard button, so in your case those cannot be used (assuming you are taking the approach of using an Event handler)
Private Function LoadToCube(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal args As DashboardExtenderArgs) As XFSelectionChangedTaskResult Try Dim selectionResult As New XFSelectionChangedTaskResult() Dim wfProfile As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk.ProfileKey) Dim wfProfileParent As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, wfProfile.ParentProfileKey) Dim timeName As String = TimeDimHelper.GetNameFromId(si.WorkflowClusterPk.TimeKey) Dim wfClusterPk As WorkflowUnitClusterPk = BRAPi.Workflow.General.GetWorkflowUnitClusterPk(si, $"{wfProfileParent.Name}.Event Load", "Plan_Weekly", timeName & "W1") 'Complete the IMPORT-VALIDATE-LOAD-PROCESS Workflow Steps 'Get the Workflow info so that we can determine which steps can be executed Dim wfInfo As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk, True) If Not wfInfo Is Nothing Then ' 'Check whether load transfrom is enabled If Not wfInfo.GetStep(StepClassificationTypes.DataLoadTransform) Is Nothing Then Dim impProcessInfo As LoadTransformProcessInfo = BRApi.Import.Process.ExecuteParseAndTransform(si, wfClusterPk, Nothing, Nothing, TransformLoadMethodTypes.ReplaceBackgroundAllTimeAllSourceId, SourceDataOriginTypes.FromDirectConnection, True) If impProcessInfo.Status = WorkflowStatusTypes.Completed Then 'Check whether validate transform is enabled ' perform validate transformation If Not wfInfo.GetStep(StepClassificationTypes.ValidateTransform) Is Nothing Then Dim valTranProcessInfo As ValidationTransformationProcessInfo = BRApi.Import.Process.ValidateTransformation(si, wfClusterPk, True) If valTranProcessInfo.Status = WorkflowStatusTypes.Completed Then ' perfomr validate intersection If Not wfInfo.GetStep(StepClassificationTypes.ValidateIntersection) Is Nothing Then Dim valIntersectProcessInfo As ValidateIntersectionProcessInfo = BRApi.Import.Process.ValidateIntersections(si, wfClusterPk, True) If valIntersectProcessInfo.Status = WorkflowStatusTypes.Completed Then 'Check whether we can load cube If Not wfInfo.GetStep(StepClassificationTypes.LoadCube) Is Nothing Then Dim lcProcessInfo As LoadCubeProcessInfo = BRApi.Import.Process.LoadCube(si, wfClusterPk) If lcProcessInfo.Status = WorkflowStatusTypes.Completed Then 'Check whether we can process cube If Not wfInfo.GetStep(StepClassificationTypes.ProcessCube) Is Nothing Then Dim pcProcessInfo As ProcessCubeProcessInfo = BRApi.DataQuality.Process.ExecuteProcessCube(si, wfClusterPk, StepClassificationTypes.ProcessCube, False) If Not pcProcessInfo.Status <> WorkflowStatusTypes.Completed Then selectionResult.Message = "Process cube failed." selectionResult.IsOK = False selectionResult.ShowMessageBox = True Return selectionResult Throw ErrorHandler.LogWrite(si, New XFUserMsgException(si, Nothing, Nothing, "Process cube failed.")) End If End If Else selectionResult.Message = "Load cube failed." selectionResult.IsOK = False selectionResult.ShowMessageBox = True Return selectionResult Throw ErrorHandler.LogWrite(si, New XFUserMsgException(si, Nothing, Nothing, "Load cube failed.")) End If End If Else selectionResult.Message = "Validate intersection failed." selectionResult.IsOK = False selectionResult.ShowMessageBox = True Return selectionResult Throw ErrorHandler.LogWrite(si, New XFUserMsgException(si, Nothing, Nothing, "Validate intersection failed.")) End If End If Else selectionResult.Message = "Validate Transformation failed." selectionResult.IsOK = False selectionResult.ShowMessageBox = True Return selectionResult Throw ErrorHandler.LogWrite(si, New XFUserMsgException(si, Nothing, Nothing, "Validate Transformation failed.")) End If End If Else selectionResult.Message = "Load and Transform failed." selectionResult.IsOK = False selectionResult.ShowMessageBox = True Return selectionResult Throw ErrorHandler.LogWrite(si, New XFUserMsgException(si, Nothing, Nothing, "Load and Transform failed.")) End If End If End If selectionResult.Message = "Cube loaded." selectionResult.IsOK = True selectionResult.ShowMessageBox = True Return selectionResult Catch ex As Exception Throw ErrorHandler.LogWrite(si, New XFException(si, ex)) End Try End Function
Related Content
- 4 years ago
- 3 years ago
- 9 months ago
- 11 months ago