converting script from adTempus 3 to 4, vb.net script issue

Rob3 (8 posts)
December 3, 2018 10:19 PM
Accepted Answer

Hi, I'm converting some scripts from adTempus 3 to 4.5 which retrieve a value from a config file to control job variables in an adTempus sequence, this script validates properly in the new adTempus, however it always returns false regardless of what I update my flag to in the config.txt so I suspect something with the regEx reading my config file is incorrect somehow, any thoughts on what is wrong or needs to be updated for the adTempus 4 API for this? At a bit of a loss due to no errors or logging and my relatively limited knowledge of vb.net unfortunately.

Imports System
Imports System.Collections.Generic
Imports System.IO
Imports System.Text.RegularExpressions
Imports System.Collections
Imports ArcanaDevelopment.adTempus.ApplicationIntegration

Public Class UserScript
    Inherits ArcanaDevelopment.adTempus.ApplicationIntegration.UserScriptBase

    Public Overrides Function Run() As Object

        Dim fileName="E:/test/config/config.txt"

        Using reader=File.OpenText(fileName)
             Dim content=reader.ReadToEnd()

            Dim match=RegEx.Match(content,"09=T",RegExOptions.IgnoreCase)
            If Not match.Success Then
                Return False
            End If
        End Using

        Return True
    End Function
End Class

             
Rob3 (8 posts)
December 3, 2018 10:37 PM
Accepted Answer
Nevermind it seems to be working after all, I believe I was not importing all inlineFunctions originally or something but I can flip the flag in the config file and the return status is changing with the script now, please disregard.
Bill Staff (602 posts)
December 5, 2018 04:22 PM
Accepted Answer

Hi, Rob. I don't spot anything wrong with your script, so hopefully it's continuing to work correctly for you.

Your code will be returning True if the string "09=T" is found anywhere in the file. That's the behavior you want?

There's no need to use a Regular Expression here since you're not looking for any pattern. To simplify things you could use:

Using reader=File.OpenText(fileName)
Dim content=reader.ReadToEnd()
Return content.IndexOf("09=T",StringComparison.OrdinalIgnoreCase)>=0
End Using

Replies are disabled for this topic.