Time member driven by Workflow Scenario

calvinbruch
New Contributor

I am trying to create a business rule which returns a time member driven by the Workflow scenario member. My forecast scenario members are structured as Jan_Fcst, Feb_Fcst...Dec_Fcst. For instance, Dynamic time filter, Year = WFYear and period based on Scenario, eg Jan_Fcst = 20**M1, May_Fcst = 20**M5. Does anyone have a snippet or suggestion on how I can go about doing this? Also, I was going to use it as an XFBR rule and I don't know how to run the BR by itself in order to look at the error log for help testing this rule. Any help is much appreciated.

1 REPLY 1

Omkareshwar
Contributor II

Hi Calvin,

You can use this syntax to call the XFBR business rule. 

BRString(YourRuleName, YourFunctionName)

You can use this syntax to debug BRapi.ErrorLog.LogMessage(si, "Message You want to print on the errorlog", "")

				If args.FunctionName.XFEqualsIgnoreCase("YourFunctionName") Then
					Dim myWorkflowUnitPk As WorkflowUnitPk = BRApi.Workflow.General.GetWorkflowUnitPk(si)
					Dim wfYear As Integer = BRApi.Finance.Time.GetYearFromId(si, myWorkflowUnitPk.TimeKey)
					Dim wfScenarioName As String = ScenarioDimHelper.GetNameFromID(si, si.WorkflowClusterPk.ScenarioKey)

					If wfScenarioName.XFContainsIgnoreCase("Jan")
						Return $"{wfYear}M1"
					Else If wfScenarioName.XFContainsIgnoreCase("Feb")	
						Return $"{wfYear}M2"
					End If 
					
				End If

You can use the above function for your use case you can modify it as per your specific requirement.

 

Thanks, Omkareshwar

Archetype Consulting  

 

Thanks, Omkareshwar
Archetype Consulting