Incorrect Syntax?

  • In addition to checking to see if the file exists:

    Function Main()

    Dim fso 'File system object

    Set fso = CreateObject("Scripting.FileSystemObject")

    IF (fso.FileExists("L:\VRU\XFEROUT\accttabl.txt")) THEN

    Main = DTSStepScriptResult_ExecuteTask

    ELSE

    Main = DTSStepScriptResult_DontExecuteTask

    END IF

    End Function

    which works fine, I also wanted to add something to the workflow properties which would cancel the task if the text file is empty:

    Function Main()

    dim fso

    dim x

    dim v

    set fso = CreateObject("Scripting.FileSystemObject")

    set x = fso.OpenTextFile("C:\Test.txt")

    Do While x.AtEndOfStream <> True

    v = x.ReadLine

    Loop

    x.Close

    IF IsNull(v) Then

    Main = DTSStepScriptResult_DontExecuteTask

    ELSE

    Main = DTSStepScriptResult_ExecuteTask

    End If

    End Function

    However, even if the file is empty it still executes the step. Is there something wrong with the syntax here?

  • Instead of "IF IsNull(v) Then"

    Try using "If v = "" then"

  • you know, I could swear I did that exact same thing before. I was changing some other things though at the same time though to. Maybe I got mixed up. It's always good to have a second set of eyes to figure things out. Thanks, that was it.

    -Pat

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply