I am trying to validate the point type for a tag say a digital tag. The condition verifies the point type of the tag and if it is digital then it will execute the calculation and otherwise log an error message. I am running the below code while debugging and testing it is working fine and writing "Calc Failed" in the output tag as expected. But when I am scheduling the calculation it is showing the calculated value. Ideally it should write "Calc Failed" in the output tag.
Here is the code snippet:
PreviousDaysValues_1 = Input_Tag.Values("y", "t", 0)
TempVar = Input_Tag.PointType
If Not (TempVar = 101) Then
LogPIACEMessage(mlErrors, " datatype is not appropriate for the input tag of:" & Output_Tag.Tag, MyBase.Name)
Output_Tag.Value = "Calc Failed"
'Checking for the No. Of Values in input tag for the previous day
If (PreviousDaysValues_1.Count = 0) Then
LogPIACEMessage(mlErrors, "No previous day values present in the tag:" & Input_Tag.Tag, MyBase.Name)
Output_Tag.Value = "No data"
Output_Tag.Value = Input_Tag.TimeNE(Today.AddDays(-1), Today, "SYSOK")
Catch ex As Exception
LogPIACEMessage(mlErrors, " Calculation failed for the tag:" & Output_Tag.Tag, MyBase.Name)