I have text file it is formatted as follows:
PN=1-DIM-CHANGE-T
MC=
QT=7
PD=1-DIMENSION CHANGE TALL
PL=250.00
PN=
MC=
QT=1
PD=1 TUB SINK
PL=0.00
Every PN to PL is a record.
I would like to strip away the PD=, PL= etc. and simply insert everything after into the SQL 2000 server.
I have gotten to the point where I can grab the portion that I need. But from this point on I have trouble.
Ideas?
<cffile action="READ" file="D:\db\test.txt" variable="doc" >
<cfset PNArray = ArrayNew(1)>
<cfset doc = Replace(doc,"#chr(13)##chr(10)#",",","ALL")>
<cfset Cnt = 0>
<cfloop list="#doc#" INDEX="line" delimiters=",">
<cfset cnt = cnt+1>
<cfset InCnt = 0>
<cfloop list="#line#" delimiters="=" index="itms">
<cfset InCnt = InCnt +1>
<cfif InCnt EQ 2>
<cfset PNArray[cnt] = #itms#>
</cfif>
</cfloop>
</cfloop>
<cfoutput>
<cfloop from=1 to="#cnt#" index="i">
#i#-#PNArray#<br>
</cfloop>
</cfoutput>
Thanks
PN=1-DIM-CHANGE-T
MC=
QT=7
PD=1-DIMENSION CHANGE TALL
PL=250.00
PN=
MC=
QT=1
PD=1 TUB SINK
PL=0.00
Every PN to PL is a record.
I would like to strip away the PD=, PL= etc. and simply insert everything after into the SQL 2000 server.
I have gotten to the point where I can grab the portion that I need. But from this point on I have trouble.
Ideas?
<cffile action="READ" file="D:\db\test.txt" variable="doc" >
<cfset PNArray = ArrayNew(1)>
<cfset doc = Replace(doc,"#chr(13)##chr(10)#",",","ALL")>
<cfset Cnt = 0>
<cfloop list="#doc#" INDEX="line" delimiters=",">
<cfset cnt = cnt+1>
<cfset InCnt = 0>
<cfloop list="#line#" delimiters="=" index="itms">
<cfset InCnt = InCnt +1>
<cfif InCnt EQ 2>
<cfset PNArray[cnt] = #itms#>
</cfif>
</cfloop>
</cfloop>
<cfoutput>
<cfloop from=1 to="#cnt#" index="i">
#i#-#PNArray#<br>
</cfloop>
</cfoutput>
Thanks