Mark,
I want to put this program into a mass update but the T array needs to be available to every record in the mass update.
The program works with the first record, but then the array is killed when the record changes to the next one.
I put ' Var T as array(5000, 5) as string' in the Global Code section so it would not be killed between records, but now I'm freezing up.
Here's the program that is in a 'general area' of Mass Update:
var vfilehandle as int var vfilesize as int var vline as string = "" var x as int =1 var vrecord as string = "" var nn as int var vall as string var vresults as int var vfile as string
if @formresultsetcurrentposition("admin") = 1 then { if fileExists("C:\temp\shawimport.txt") then writeln("Found it")
vfilehandle = fileopen("c:\temp\shawimport.txt") vfilesize= filesize(vfilehandle) fileseek(vfilehandle, 0)
while (filepos(vfilehandle)) < (vfilesize) { filereadln(Vfilehandle, vline) t[x,1] = split(vline, ",") + "," t[x,1] = t[x,1] + split(vline, ",") + "," t[x,1] = t[x,1] + split(vline, ",") + "," t[x,2] = split(vline, ",") //all with no spaces t[x,3] = split(vline, ",") //size t[x,4] = vline //stock number x=x+1 } z=x-1 fileclose(vfilehandle) }//end of file open
vrecord = COLLECTION + pattern + color vrecord = @replace(vrecord, " ", "") vrecord = @replace(vrecord, "-", "") vrecord = @replace(vrecord, "'", "") writeln("Vrecord = " + vrecord)
x=1 writeln("about to scroll through lines since x = " + x + " and z = "+z)
while x <= z { //writeln("Comparing :" + t[x,1] + " against " + vrecord)
if t[x,2] = vrecord then { nn=@formnewrecord("Variants") formfieldvalue("Variants", "mfgr", nn, "Shaw2") formfieldvalue("variants", "variant Name", nn, t[x,3]) formfieldvalue("Variants", "part number", nn, t[x,4]) writeln("Found "+ collection + " " + pattern + " " + color + " on line "+x) t[x,1] = "" t[x,2] = "" t[x,3] = "" t[x,4] = "" } x=x+1 } //keep looping till end
writeln("processing record " + @formresultsetcurrentposition("admin") )
vrecord = ""
if @formresultsetcurrentposition("admin") = @formresultsettotal("Admin") { writeln("NOW writing results") vresults = fileopen("C:\temp\results.txt")
x=1
while x <= z { if t[x,1] <> "" then { filewrite(vresults, t[x,1]) filewrite(vresults, t[x,3]) filewrite(vresults, ",") filewriteln(vresults, t[x,4]) } x=x+1 }// loop to write file
fileclose(vresults) }//end of last record.
Edit: The globalCode section contains: var z as int VAR t as array [5000,4] of string
|