Anthony1312002
Programmer
As you can see below I have a text file that I'm trying to import. What I want to do is rip the customer's box number from the botton line, say 96022 as shown in the text file, and put it at the beginning of each line item for that customer and so on. Below the text file is the script I'm using to read the file. How can I get this to work?
Text File
Singles: 97 20,177 90 20,267 4,281,989.21 20,177 90 20,267 4,281,989.21 17,608 2,569
Multiples: 14 603 2 605 638,054.48 966 4 970 638,054.48 785 181
Checks Only: 26 928 21 949 384,530.02 928 21 949 384,530.02 0 928
Check & List: 2 11 0 11 74,152.68 33 0 33 74,152.68 0 33
Checks Only - Suspense: 11 121 1 122 393,600.29 121 1 122 393,600.29 0 121
------ --------- ------ --------- ---------------- --------- ------ --------- ---------------- --------- ---------
96022 World Com Totals: 150 21,840 114 21,954 5,772,326.68 22,225 116 22,341 5,772,326.68 18,393 3,832
Singles: 9 1,643 11 1,654 787,235.89 1,643 11 1,654 787,235.89 1,487 156
Multiples: 3 160 1 161 117,625.88 132 1 133 117,625.88 112 20
Checks Only: 7 144 3 147 229,297.14 144 3 147 229,297.14 0 144
Check & List: 3 7 0 7 20,471.42 20 0 20 20,471.42 0 20
Check Only Suspense: 5 35 1 36 45,908.37 35 1 36 45,908.37 0 35
------ --------- ------ --------- ---------------- --------- ------ --------- ---------------- --------- ---------
96026 BTI Totals: 27 1,989 16 2,005 1,200,538.70 1,974 16 1,990 1,200,538.70 1,599 375
Import Script
<%
'Declare variables
Dim objFile
Dim objText
Dim strTextLine
Dim sql, sql2
Dim CheckDated
Dim CheckDated2
Dim MyTest
'Create FileSystem Object
Set objFile = CreateObject("Scripting.FileSystemObject")
'Create=False (we are reading the file, not creating one)
Dim MyFile, MyFileNew
MyFile = Request.QueryString("RecordDate")
Set objText=objFile.OpenTextFile(MyFile)
'Write each line until the end of the text file,
'as long as opened file (objText) is not at the end
'(the do while not statement will read one line at a time)
'...
Do while not objText.AtEndOfStream
Dim MyDate, MyCustomer, MyChecksFull, arrayText
'assign a line to strTextLine
strTextLine=objText.ReadLine
'data=Split(strTextLine,vbTab)
data=Split(strTextLine)
'------------------------------------------
arrayText = Split(strTextLine," ")
'Splits the text file up into an array - use "," if the values are comma separated
Dim iCount
' For iCount = 1 to uBound(arrayText)
'------------------------------------------
'Write the line
Response.Write strTextLine
'Write an HTML break
Response.Write "<br>"
Loop
Response.Write "Your file has successfully been imported"
'close and erase the file from memory
objText.close
Set objText=nothing
%>
Text File
Singles: 97 20,177 90 20,267 4,281,989.21 20,177 90 20,267 4,281,989.21 17,608 2,569
Multiples: 14 603 2 605 638,054.48 966 4 970 638,054.48 785 181
Checks Only: 26 928 21 949 384,530.02 928 21 949 384,530.02 0 928
Check & List: 2 11 0 11 74,152.68 33 0 33 74,152.68 0 33
Checks Only - Suspense: 11 121 1 122 393,600.29 121 1 122 393,600.29 0 121
------ --------- ------ --------- ---------------- --------- ------ --------- ---------------- --------- ---------
96022 World Com Totals: 150 21,840 114 21,954 5,772,326.68 22,225 116 22,341 5,772,326.68 18,393 3,832
Singles: 9 1,643 11 1,654 787,235.89 1,643 11 1,654 787,235.89 1,487 156
Multiples: 3 160 1 161 117,625.88 132 1 133 117,625.88 112 20
Checks Only: 7 144 3 147 229,297.14 144 3 147 229,297.14 0 144
Check & List: 3 7 0 7 20,471.42 20 0 20 20,471.42 0 20
Check Only Suspense: 5 35 1 36 45,908.37 35 1 36 45,908.37 0 35
------ --------- ------ --------- ---------------- --------- ------ --------- ---------------- --------- ---------
96026 BTI Totals: 27 1,989 16 2,005 1,200,538.70 1,974 16 1,990 1,200,538.70 1,599 375
Import Script
<%
'Declare variables
Dim objFile
Dim objText
Dim strTextLine
Dim sql, sql2
Dim CheckDated
Dim CheckDated2
Dim MyTest
'Create FileSystem Object
Set objFile = CreateObject("Scripting.FileSystemObject")
'Create=False (we are reading the file, not creating one)
Dim MyFile, MyFileNew
MyFile = Request.QueryString("RecordDate")
Set objText=objFile.OpenTextFile(MyFile)
'Write each line until the end of the text file,
'as long as opened file (objText) is not at the end
'(the do while not statement will read one line at a time)
'...
Do while not objText.AtEndOfStream
Dim MyDate, MyCustomer, MyChecksFull, arrayText
'assign a line to strTextLine
strTextLine=objText.ReadLine
'data=Split(strTextLine,vbTab)
data=Split(strTextLine)
'------------------------------------------
arrayText = Split(strTextLine," ")
'Splits the text file up into an array - use "," if the values are comma separated
Dim iCount
' For iCount = 1 to uBound(arrayText)
'------------------------------------------
'Write the line
Response.Write strTextLine
'Write an HTML break
Response.Write "<br>"
Loop
Response.Write "Your file has successfully been imported"
'close and erase the file from memory
objText.close
Set objText=nothing
%>