>>*This Program Will Update New_bill.dbf with New Target Path >>SELECT New_bills >>LOCATE >>SCAN WHILE .NOT. EOF() >>F=Filename >>SELECT Master >>LOCATE FOR accountno=F >>IF FOUND()=.T. >>E=ALLTRIM(Exchange) >>ME=1 && Denotes that the exchgange is Not missing >>ELSE >>E="Missing Exchange" >>ME=0 && Denotes that the exchange is Missing >>ENDIF >> >>SELECT New_bills >>P='&tDirectory'+'&pBillmonth'+'-'+ALLTRIM(STR(pbillyear))+'\'+E+'\'+STR(filename)+'.ps' >>Replace Newpath WITH P >>Replace Missexg WITH ME >>Disp_percent=Alltrim(Str(Recno()/RecordsForSelectA*100)) >>Wait Wind "Step-3 [Updating Target Path Information..."+Disp_percent+"%"+" Completed]" Nowait >>ENDSCAN >>RETURN >>>>
>local llMaster >Select New_bills >Scan > > llMaster = Seek(New_bills.Filename, 'Master', 'accountno') && assuming you have INDEX ON accountno TAG accountno > && you can also SET RELATION TO Filename INTO Master IN New_bills - seek() will be done automatically > && either way, you need an [INDEX ON accountno TAG accountno] to optimize (aka 'rushmorize') the relation between New_bills and Master tables > > Replace ; && a single REPLACE is always faster than 2! > NewPath With ''; && It's always more explicit and safe to use a prefix (alias for fields, 'm' for variables) > + m.tDirectory; > + m.pBillmonth; > + '-' + Alltrim(Str(m.pbillyear)); > + '\' + Iif(m.llMaster, Alltrim(Master.Exchange), "Missing Exchange"); > + '\' + Str(Filename); > + '.ps'; > MissExg With Iif(m.llMaster; && ME > , 1; && Denotes that the exchange is Not missing > , 0; && Denotes that the exchange is missing > ) > > if Recno()%100 = 0 > Wait Wind ''; && this instruction is veeery time consuming - better execute it once in a while > + "Step-3 [Updating Target Path Information..."; > + Alltrim(Str(Recno()/RecordsForSelectA*100)); > + "%"; > + " Completed]"; > Nowait > endif >Endscan >Return >