Skip to content
+1-888-319-3663

COMMUNITY FORUM

Error in Map pre task 'BUILDFILE': expression expected

Habib Salim asked 6 months ago
Hello
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
        sb.AppendLine(“SUBSID_INV_NUMBER,AR_CLIENT,BLANK,InvDate,InvAmt,Field1,Field2,Field3,FileName”)
 
        ‘ 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 & “””,”)
                Next
                sb.Append(“””” & prefix & “”””)
                sb.Append(vbCrLf)
            Next
            ‘move sourcefile to an archive
            fi.MoveTo(ArchiveFolder & fi.Name, True)
        Next
        ‘overwrite existing file with my new data – Smartconnect will read this file using odbc
        System.IO.File.WriteAllText(DestFile, sb.ToString())
 
Return True
Answers
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.