Hi, The best way to do it would be creating an index on Account field. Next loop thru the and use the update_recordset to bulk update each accountnumber.
Best regards Carsten F. Frandsen --- In [email protected], "Jim Dimarzio" <[EMAIL PROTECTED]> wrote: > > Hello, > Can anyone tell me which way is the most efficient and quicker > method to replace a field in an AX table with information from a > text file: Is it quicker to have an outer while select loop run > through each row (1million rows) then run through 100 lines in a > text file in a while container loop? Or the other way around? It is > taking hours to run this the way I have it here. Here is a snippet > of code that does this, the objective is the text file has 100 rows > of 'old GL account' "," 'new GL account' Any help is greatly > appreciated! : > > while select forupdate ProjTransPosting (From AX Table) > { > inFile = new TextIO(s_path,"r"); > inFile.inRecordDelimiter('\n'); > inFile.inFieldDelimiter(','); > con = inFile.read(); > aFound = false; > > while (con && aFound == false) (READ from Text file) > { > oldCOA = conpeek(con,1); > newCOA = conpeek(con,2); > if (ProjTransPosting.Account == oldCOA) > { > ProjTransPosting.Account = newCOA; > ProjTransPosting.update(); > aFound = true; > } > else > con = inFile.read(); > } > } >

