>* Handle the ones with no match. >UPDATE NewBills ; > SET MissExg = 0, ; > NewPath = "Missing Exchange"; > WHERE FileName NOT IN (SELECT AccountNo FROM Master) >>
>* Handle the ones with no match. > >cPath = ADDBS(tDirectory+pBillmonth+'-'+ALLTRIM(STR(pbillyear)))+'Missing Exchange\' > >* Handle the ones with no match. > UPDATE New_Bills ; > SET MissExg = 0, ; > NewPath = FORCEPATH(FORCEEXT(FileName, "PS"),m.cPath) ; > WHERE FileName NOT IN (SELECT AccountNo FROM Master) >>
cPath = ADDBS(tDirectory+pBillmonth+'-'+ALLTRIM(STR(pbillyear))) * Handle the ones that match first. UPDATE NewBills ; SET MissExg = 1, ; NewPath = FORCEPATH(FORCEEXT(FileName, "PS")+"\" + ALLTRIM(Master.Exchange), m.cPath) ; FROM Master ; WHERE NewBills.FileName = Master.AccountNo * Handle the ones with no match. UPDATE NewBills ; SET MissExg = 0, ; NewPath = FORCEPATH(FORCEEXT("Missing Exchange", "PS")+"\" + ALLTRIM(Master.Exchange), m.cPath) ; WHERE FileName NOT IN (SELECT AccountNo FROM Master)The "m." indicates that I'm referring to a variable, not a field. Using it is a best practice to ensure that you get the results you expect. When you use a name in code that could be either a variable or a field, VFP first looks for a field. If there's no such field in the current workarea, then it checks for a variable. Putting "m." in front says look only for a variable. It's pretty much the same idea as putting the alias for a table in front of a field name, as I did with "Master.Exchange".