Error Running BR

Marco
Contributor

Hi team,

We are encountering an error when running a button that involves a Data Management (DM) step to a Business Rule (BR). The error message is as follows: "Summary: Error processing Data Management Step 'SAVE_DRIVERS'. Unable to execute Business Rule 'PLP_HLFPLPCopyAdminDriver'. Error processing script 'S#[Forecast 2024M4]:O#Forms:A#SalaryWorkdays= S#ForecastInput:O#Forms:A#SalaryWorkdays'."

This process is run on a monthly basis, and this is the first time we have encountered this error. We have also tested it in our test environment during the same period and did not encounter any errors.

We are unsure of what may be causing this issue and would appreciate any assistance in resolving it.

This is the BR:

Imports System
Imports System.Data
Imports System.Data.Common
Imports System.IO
Imports System.Collections.Generic
Imports System.Globalization
Imports System.Linq
Imports Microsoft.VisualBasic
Imports System.Windows.Forms
Imports OneStream.Shared.Common
Imports OneStream.Shared.Wcf
Imports OneStream.Shared.Engine
Imports OneStream.Shared.Database
Imports OneStream.Stage.Engine
Imports OneStream.Stage.Database
Imports OneStream.Finance.Engine
Imports OneStream.Finance.Database

Namespace OneStream.BusinessRule.Finance.PLP_HLFPLPCopyAdminDriver
	Public Class MainClass
		Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs) As Object
			Try
				Select Case api.FunctionType
					
					Case Is = FinanceFunctionType.CustomCalculate
						If args.CustomCalculateArgs.FunctionName.XFEqualsIgnoreCase("CopyPLPAdminDrivers") Then
							'Set variables
							Dim strPeriod As String = api.Pov.Time.Name
							Dim strEntity As String = api.Pov.Entity.Name
							Dim strScenario As String = api.Pov.Scenario.Name
							Dim strSrcScenario As String = "ForecastInput"
							Dim strYear = strPeriod.Substring(0,4)
							Dim strGlobalyr As String = BRApi.Workflow.General.GetGlobalTime(si).ToString
							Dim intactMth As Integer
							
							'Put brackets around scenario because of space
							strScenario = "[" & strScenario & "]"
							
							'Define forecast month
							Dim intfcstMth As Integer
							intfcstMth = BRApi.Dashboards.Parameters.GetLiteralParameterValue(si, False, "PLN_FcstStartMth")
							
							intactMth = intfcstMth - 1
							
							'Parsing current Month and Year based on POV Time period
							Dim intcurrMth As Integer
							intcurrMth = Mid(strPeriod,InStr(strPeriod,"M")+1,2)
							
							'Check if substring of scenario is forecast
							Dim strsubScn As String = strScenario.Substring(0,8)
							
												
							'Check scenario
							If strsubScn.XFEqualsIgnoreCase("Forecast") Then
								intfcstMth = intfcstMth
								
							Else If strsubScn.XFEqualsIgnoreCase("Budget")  Then
								intfcstMth = 13

							Else
								intfcstMth = intfcstMth
							
							End If
	

							'Clear data
							api.Data.ClearCalculatedData("Cb#[HLFPLP]:S#" & strScenario & ":T#" & strPeriod & ":O#Forms:A#SalaryWorkdays", True, True, True)
							api.Data.ClearCalculatedData("Cb#[HLFPLP]:S#" & strScenario & ":T#" & strPeriod & ":O#Forms:A#SalaryWeeks", True, True, True)
						
							'Calculate Data for Labor
							Dim dbfAccount As String

							'Workdays
							dbfAccount = "SalaryWorkdays"
							api.Data.Calculate("S#" & strScenario & ":O#Forms:A#" & dbfAccount & "= S#" & strSrcScenario & ":O#Forms:A#" & dbfAccount)
							
							
							'Workweeks
					        dbfAccount = "SalaryWeeks"
							api.Data.Calculate("S#" & strScenario & ":O#Forms:A#" & dbfAccount & "= S#" & strSrcScenario & ":O#Forms:A#" & dbfAccount)
							

		
						End If

				End Select

				Return Nothing
			Catch ex As Exception
				Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
			End Try
		End Function
	End Class
End Namespace

 

1 ACCEPTED SOLUTION

RobbSalzmann
Valued Contributor

Your code looks like a straight copy from one scenario to another.

Have you considered using a data management copy data step for this?

View solution in original post

4 REPLIES 4

RobbSalzmann
Valued Contributor

Your code looks like a straight copy from one scenario to another.

Have you considered using a data management copy data step for this?

Thank you Robb, this worked!

Steven
Contributor

Marco, I would check the obvious spelling of the Scenarios: "Forecast 2024M4" & ForecastInput

AND Account: "SalaryWorkdays"

then I would try to create a TEST BR, and just run that api.Data.Calculate(S#[Forecast 2024M4]:O#Forms:A#SalaryWorkdays= S#ForecastInput:O#Forms:A#SalaryWorkdays)

Koemets
Contributor

What's the scenario that you set in the DM in question?