>>local lcccTown, lnRank, lcFieldsAdd >>k=0 >>do while k> k=m.k+1 && Increment count >> for i=m.lnStart to m.lnEnd step m.lnStep && Two ranking (by Num and by Vol) >> select ('curAll'+transform(m.k)) >> set order to tag tag(m.i) descending && Reverse order NumAll, VolAll, NumPur, etc. >> lcccTown=ccode+town >> lnRank=0 >> scan for !m.llHalt >> lnCount=m.lnCount+1 >> >>** Update status message >> if mod(m.lnCount,100) = 0 >> set message to 'Record # '+transform(m.lnCount)+m.lcMsgTail >> endif >> >>** Update thermometer >> if mod(m.lnCount,m.lnUpdateNumber) = 0 >> loTherm.update(m.lnCount) >> endif >> >> scatter name loTemp >> with loTemp >> lcSearchExpr=.ccode+.town >> if seek(m.lcSearchExpr, 'curSumAll'+transform(m.k), 'cctown') >> select ('curSumAll'+transform(m.k)) >> do case >> case m.i=1 && NumAll >> lcExt='All' >> lnTotal=YtdNumAll && for all lenders in this town >> if m.lnTotal>0 && Should be always >0 >> .MksNumAll=round((.YtdNumAll/m.lnTotal)*100,2) >> else >> .MksNumAll=0 >> endif >> lcFieldsAdd='MksNumAll, RankNumAll' >> >> case m.i=2 && VolAll >> lcExt='All' >> lnTotal=YtdVolAll && for all lenders in this town >> if m.lnTotal>0 && Should be always >0 >> .MksVolAll=round((.YtdVolAll/m.lnTotal)*100,2) >> else >> .MksVolAll=0 >> endif >> lcFieldsAdd='MksVolAll, RankVolAll' >> >> case m.i=3 && NumPur >> lcExt='Pur' >> lnTotal=YtdNumPur && for all lenders in this town >> if m.lnTotal>0 && Should be always >0 >> .MksNumPur=round((.YtdNumPur/m.lnTotal)*100,2) >> else >> .MksNumPur=0 >> endif >> lcFieldsAdd='MksNumPur, RankNumPur' >> >> case m.i=4 && VolPur >> lcExt='Pur' >> lnTotal=YtdVolPur && for all lenders in this town >> if m.lnTotal>0 && Should be always >0 >> .MksVolPur=round((.YtdVolPur/m.lnTotal)*100,2) >> else >> .MksVolPur=0 >> endif >> lcFieldsAdd='MksVolPur, RankVolPur' >> >> case m.i=5 && NumRef >> lcExt='Ref' >> lnTotal=YtdNumRef && for all lenders in this town >> if m.lnTotal>0 && Should be always >0 >> .MksNumRef=round((.YtdNumRef/m.lnTotal)*100,2) >> else >> .MksNumRef=0 >> endif >> lcFieldsAdd='MksNumRef, RankNumRef' >> >> case m.i=6 && VolRef >> lcExt='Ref' >> lnTotal=YtdVolRef && for all lenders in this town >> if m.lnTotal>0 && Should be always >0 >> .MksVolRef=round((.YtdVolRef/m.lnTotal)*100,2) >> else >> .MksVolRef=0 >> endif >> lcFieldsAdd='MksVolRef, RankVolRef' >> endcase >> endif >> if left(.lender,4)='MISC' or .lender='SELLER' >>** Nothing >> else >> lnRank=m.lnRank+1 >> store m.lnRank to ('loTemp.Rank'+iif(mod(m.i,2)=1,'Num','Vol')+m.lcExt) >> endif >> if .ccode+.townm.lcccTown >> lcccTown= .ccode+.town >> if left(.lender,4)='MISC' or .lender='SELLER' >> lnRank=0 >> else >> lnRank=1 >> store m.lnRank to ('loTemp.Rank'+iif(mod(i,2)=1,'Num','Vol')+m.lcExt) >> endif >> endif >> lcSearchExpr=m.lcSearchExpr+.lender >> endwith >> select OutTable >> if seek(m.lcSearchExpr,'OutTable','ccttlndr') >>** We're now on the right record >> else >> append blank >> endif >> gather name loTemp fields ccode, town, Lender, LndrName, county, ; >> city, State, ; >> YtdNumAll, YtdVolAll, PtdNumAll, PtdVolAll, ; >> YtdNumPur, YtdVolPur, PtdNumPur, PtdVolPur, ; >> YtdNumRef, YtdVolRef, PtdNumRef, PtdVolRef, ; >> &lcFieldsAdd >> endscan >> next>>