Skip to content


Error in Map pre task 'BUILDFILE': expression expected

Habib Salim asked 6 months ago
i am getting 3 errors when validating a pre-map script file.  I am converting a
 Error in Map pre task ‘BUILDFILE’: expression expected
Error in Map pre task ‘BUILDFILE’: Type ‘StringBuilder; is not defined
what am i missing?
here is my script:

        Dim sourceFolder As String = “C:\temp\ZZ”
        Dim ArchiveFolder As String = “C:\temp\ZZ\Success\”
        Dim DestFile As String = “C:\temp\ZZ\SrcFile\ZebraData.csv”
        ‘ stringbuilder to hold the data
        Dim sb As New StringBuilder()
        ‘ create a new header row
        ‘ get each sourcfile in folder
        For Each fi As FileInfo In New DirectoryInfo(sourceFolder).GetFiles(“*.txt*”)
            Dim prefix As String = fi.Name.Substring(0, fi.Name.IndexOf(“_”))
            Dim srcFile As New Object
            ‘read all data in file into an object
            srcFile = System.IO.File.ReadAllLines(fi.FullName)
            ‘read each line in file, split the comma-separated values, reassemble as quoted values
            For Each line As Object In srcFile
                For Each str As String In line.ToString().Split(“,”)
                    sb.Append(“””” & str & “””,”)
                sb.Append(“””” & prefix & “”””)
            ‘move sourcefile to an archive
            fi.MoveTo(ArchiveFolder & fi.Name, True)
        ‘overwrite existing file with my new data – Smartconnect will read this file using odbc
        System.IO.File.WriteAllText(DestFile, sb.ToString())
Return True
Patrick Roth Staff answered 6 months ago
Like the File system calls, you have to fully qualify your reference to the stringbuilder class.
Dim sb As New Sytem.Text.StringBuilder()

If you would like to submit an answer or comment, please sign in to the eOne portal.