BR Rule - BR api Error log
Hello All, OS experts - Greetings !
I am trying to complete the following code to extract the year and month from a given date. To help with validation and debugging, I've enabled BRAPI.ErrorLog.LogMessage to display the variable outputs in the error log.
However, for some reason, it is not displaying any values in the error log. I would greatly appreciate any insights into what might be wrong with the code. Here is the code I am working with:
Dim vDate As String = args.NameValuePairs.XFGetValue("Date")
' e.g., "01/01/2025" (MM/DD/YYYY format)
' Log the retrieved Date for debugging
BRAPI.ErrorLog.LogMessage(si, "vDate: " & vDate)
' Ensure vDate is not null or empty before proceeding
If Not String.IsNullOrEmpty(vDate) Then
' Extract the year (last 4 characters) from vDate and convert to an integer
Dim vYear As Integer = CInt(vDate.Substring(6, 4))
BRAPI.ErrorLog.LogMessage(si, "vYear: " & vYear)
' Extract the month (first 2 characters) from vDate and convert to an integer
Dim vMonth As Integer = CInt(vDate.Substring(0, 2))
BRAPI.ErrorLog.LogMessage(si, "vMonth: " & vMonth)
Else
BRAPI.ErrorLog.LogMessage(si, "vDate is null or empty!")
End If
Thank you in advance.
