aorange
4 days agoNew Contributor III
Data Quality Event Handler Rule
Hello,
I recently had help modifying a rule so it would only run once for a multi year scenario, now I am having an issue trying to run the rule on other scenarios.
How would I tell this rule to ignore the time condition for the budget scenario. The data management job set up on the workflow profile won't currently run due to line of code added:
' NEW CHECK TO ONLY RUN ON THE START YEAR OF WF RANGE TIME.
If I remove it, then the calculation doesn't work for my forecast scenario properly. I basically somehow need to tell it to ignore that line for the budget scenario.
Below is the full code.
Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DataQualityEventHandlerArgs) As Object
Try
'Define a switch to control event processing, since many of these are reference examples we do not want them to run all the time
Dim processEvents As Boolean = False
'Set the default return values
Dim returnValue As Object = args.DefaultReturnValue
args.UseReturnValueFromBusinessRule = False
args.Cancel = False
'Evaluate the operation type in order to determine which subroutine to process
Select Case args.OperationName
Case Is = BREventOperationType.DataQuality.ProcessCube.NoCalculate
'Execute a Data Management job after process cube runs
Me.XFR_HandleProcessCubeNoCalculate(si, globals, api, args)
'Case Is = BREventOperationType.DataQuality.Certify.FinalizeSetCertifyState
'Send an email after a workflow profile executes its certification
'Me.XFR_HandleFinalizeSetCertifyState(si, globals, api, args)
End Select
Return returnValue
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
#Region "ProcessCube.NoCalculate Helpers"
Private Sub XFR_HandleProcessCubeNoCalculate(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As Object, ByVal args As DataQualityEventHandlerArgs)
'------------------------------------------------------------------------------------------------------------
'Reference Code: XFR_HandleProcessCubeNoCalculate
'
'Description: Run a DataMgmt Sequence after the workflow process cube task is run.
' Note: the DataMgmt sequence name is assigned to a Workflow Profile CalcDef filter field
' so this event does not have to be modified, the user can simply edit the CalcDef grid
' for a workflow profile and this business rule will execucte the specified sequence.
'
'Usage: Used to supplement the standard "ProcessCube" functionality associated with a
' workflow profile by allowing a DataManagement sequence to be executed for the workflow profile
' as well.
'
'Created By: Tom Shea
'Date Created: 1-30-2013
'------------------------------------------------------------------------------------------------------------
Try
'Get the DataUnitInfo from the Event arguaments so that we can get the name of the DataManagement sequence to process.
Dim calcInfo As DataUnitInfo = DirectCast(args.Inputs(2), DataUnitInfo)
If Not calcInfo Is Nothing Then
'Make sure that a Sequence name as assigned to the filter value of the Calc Definition of the executing Workflow Profile
If calcInfo.FilterValue <> String.Empty Then
' NEW CHECK TO ONLY RUN ON THE START YEAR OF WF RANGE TIME
If timedimhelper.GetYearFromId(calcInfo.DataUnitIds.TimeId).Equals(timedimhelper.GetYearFromId(brapi.Finance.Scenario.GetWorkflowStartTime(si,calcInfo.DataUnitIds.ScenarioId)))
'Now, execute the DataMgmt Sequence that was specified in the FilterValue (In a background thread)
BRApi.Utilities.ExecuteDataMgmtSequence(si, calcInfo.FilterValue, Nothing)
End If
End If
End If
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Sub
#End Region
End Class
End Namespace
Any help would be greatly appreciated.
Thank you!