bk0615
2 years agoNew Contributor
Logging message to error log for first iteration of the business rule
I am launching a business rule through a Data Management job for all the base entities of certain rollup, i.e, TopEntity.base. As expected, the code loops through all the base entities and executes the code. I want to log the POV passed in for troubleshooting purposes. When I log the message, it logs it for each iteration of the code. Is there a way to only log the message for the first iteration of the code to avoid logging multiple entries to the log? As a workaround, I have hard-coded a specific entity, but if I can avoid hard-coding that would be ideal. Below is the code snippet:
#Region "Clear_Calculated_Data"
If args.CustomCalculateArgs.FunctionName.XFEqualsIgnoreCase("ClearCalculatedData") Then
Dim sTime As String = api.Pov.Time.Name
Dim sScenario As String = api.Pov.Scenario.Name
Dim sEntity As String = api.Pov.Entity.Name
'Logging Info for Troubleshooting Purposes - Using Single Entity so message is not logged multiple times
If sEntity = "Ent_005" Then
Brapi.ErrorLog.LogMessage(si, "Data Clear: Time: " & sTime & ",Scenario: " &sScenario)
End If
api.Data.ClearCalculatedData(True,True,True,True,"A#TotNS_Adj, A#TotCOG_Adj",,,,,,,,,,"U7#Inp",)
End If
#End Region