******************************************************************** * Description.......: Update_Cheshire - removes duplicates and does other manipulations * Calling Samples...: * Parameter List....: * Created by........: Nadya Nosonovsky 08/30/2002 04:09:05 PM * Modified by.......: ******************************************************************** use cheshire in 0 alias Scan_File order map15 select Scan_File copy to cheshire_new with cdx use cheshire_new in 0 alias Update_File again local lcMap, lcLoc, lnAss1, lcCd1, ; lcCd2, lcCd3, lcCd4, lcCd5, lcCd6, ; lnRecno, lcString, llAllow, lnElements, lnI, lcNewString, lcTemp local array laOriginal[1] lcMap="" lcString = "" lcLoc = "" select Scan_File scan for Flag='D' if Ass1<> 0 lnRecno = recno() endif if map15<>m.lcMap if m.llAllow goto m.lnRecno in Update_File replace CD1 with m.lcCd1, ; CD2 with m.lcCd2, ; CD3 with m.lcCd3, ; CD4 with m.lcCd4, ; CD5 with m.lcCd5, ; CD6 with m.lcCd6 in Update_File delete for recno()<>m.lnRecno and map15 = m.lcMap and Ass1=0 in Update_File endif lcMap = map15 lcString = iif(not empty(CD1),CD1+chr(13),"") + ; iif(not empty(CD2),CD2+chr(13),"") + ; iif(not empty(CD3),CD3+chr(13),"") + ; iif(not empty(CD4),CD4+chr(13),"") + ; iif(not empty(CD5),CD5+chr(13),"") + ; iif(not empty(CD6),CD6,"") lcLoc = Loc for m.lnI=1 to 6 store evaluate('Scan_File.CD'+transform(m.lnI)) to ('lcCD'+transform(m.lnI)) next else if m.lcLoc<>Loc && Address is different, don't do replacements llAllow = .f. else if (not empty(CD1) and not trim(CD1) $ m.lcString) or ; (not empty(CD2) and not trim(CD2) $ m.lcString) or ; (not empty(CD3) and not trim(CD3) $ m.lcString) or ; (not empty(CD4) and not trim(CD4) $ m.lcString) for lnI=1 to 4 lcTemp = trim(evaluate('Scan_File.CD'+transform(m.lnI))) if not empty(m.lcTemp) and not m.lcTemp $ m.lcString lcString = m.lcTemp + chr(13) + m.lcString endif next lnElements = alines(laOriginal, m.lcString) =asort(laOriginal) lcString ="" for lnI=1 to m.lnElements lcString = m.lcString +chr(13)+ laOriginal[m.lnI] store laOriginal[m.lnI] to ('lcCD'+ transform(m.lnI)) next endif endif endif endscan