******************************************************************** * Description.......: CodeCount - Used for generation of Coded Values report in Parcel Conversion * Calling Samples...: * Parameter List....: tcTable * Created by........: Tanya Lisyanaya 10/02/2001 02:31:08 PM * Modified by.......: Nadya Nosonovsky 12/26/2001 12:32:45 PM ******************************************************************** lparameters tcTable if empty(m.tcTable) or vartype(m.tcTable)<>"C" return "" && Quiet fail endif local i, laTransTables[11,2], lnReccount, lnRec, lcSearch, loTherm, lcCode, ; lcPrevOnEsc, lcPrevEscape, lcMsgTail, lnLen, k if !OpenTble(m.tcTable,"Property") return '' endif lnReccount = reccount('Property') *!* if not dbused('Lookups') *!* open data ("\redp\dbc\lookups\lookups") *!* endif *!* set data to Lookups *--- Create list of tables in the Lookups.dbc in an array. *lnTables = adbobjects(laTransTables,'table') laTransTables[1,1]="Amenities" laTransTables[1,2]="Amenity" laTransTables[2,1]="Basmnttype" laTransTables[2,2]="Basement" laTransTables[3,1]="Condition" laTransTables[3,2]="Condtion" laTransTables[4,1]="Extcover" laTransTables[4,2]="Extcover" laTransTables[5,1]="Fueltype" laTransTables[5,2]="Fueltype" laTransTables[6,1]="Heattype" laTransTables[6,2]="Heattype" laTransTables[7,1]="Lstsltype" laTransTables[7,2]="Saletype" laTransTables[8,1]="Parktype" laTransTables[8,2]="Parktype" laTransTables[9,1]="Roofmat" laTransTables[9,2]="Roofmat" laTransTables[10,1]="Rooftype" laTransTables[10,2]="Rooftype" laTransTables[11,1]="Stateuse" laTransTables[11,2]="Usage" create cursor al(code c(3), fullname c(30), quant i, ; fieldn c(20), tall i, tname c(50)) *--- Walk through the list of tables, opening them as we go. wait window "Please, wait while Code Field Statistics is being gathered..." nowait for i=1 to 11 select 0 =OpenTble("Lookups!"+laTransTables[i,2],,'shared noupdate','code') select (laTransTables[i,2]) scan scatter memvar fieldn=laTransTables[i,1] tname=m.tcTable tall= m.lnReccount *!* append blank *!* gather memvar insert into al from memvar endscan endfor select al index on fieldn+code tag FieldCode select Property lnRec=0 loTherm = newobject("thermometer", "wg.vcx","","Code Field Counts for: " + m.tcTable, m.lnReccount) loTherm.show() private plHalt * support user Escapes for interrupting the main loop lcPrevOnEsc = on('escape') && save previous Escape handler lcPrevEscape = set('escape') && previous Escape enablement state set escape on && enable escape handling plHalt = .f. && allow loop to run until this flag is toggled on escape plHalt = .t. && force immediate termination if user escapes * assemble fixed portion of status bar message outside of loop, for speed lcMsgTail = "/" + transform(m.lnReccount) + ". Wait or press Esc to cancel ..." set message to "" select Property scan for !m.plHalt lnRec=m.lnRec+1 if mod(m.lnRec,100) = 0 set message to 'Record # '+ transform(m.lnRec)+ m.lcMsgTail loTherm.update(m.lnRec) endif for i=1 to 11 lcCode = nvl(evaluate('Property.'+laTransTables[m.i,1]),'') if laTransTables[m.i,1] = 'Amenities' and len(alltrim(m.lcCode))>1 && Special case of Amenities field lcCode = alltrim(m.lcCode) lnLen = len(m.lcCode) for k =1 to m.lnLen lcCode = substr(m.lcCode,m.k,1) lcSearch = padr(laTransTables[m.i,1],20)+padr(m.lcCode,3) if seek(m.lcSearch,'al') replace al.quant with al.quant+1 else select al append blank replace code with m.lcCode, ; fullname with "**********", ; && Not found - invalid code quant with 1, ; fieldn with laTransTables[m.i,1], ; tname with m.tcTable ; tall with m.lnReccount select Property endif endfor else lcSearch = padr(laTransTables[m.i,1],20) + padr(m.lcCode,3) if seek(m.lcSearch,'al') replace al.quant with al.quant+1 else select al append blank replace code with m.lcCode, ; fullname with "**********", ; && Not found - invalid code quant with 1, ; fieldn with laTransTables[m.i,1], ; tname with m.tcTable ; tall with m.lnReccount select Property endif endif endfor endscan release m.loTherm on escape &lcPrevOnEsc if m.lcPrevEscape="OFF" set escape off endif set message to " " ** Close Lookups tables for i=1 to 11 use in select(laTransTables[m.i,2]) endfor select al delete for quant=0 replace fullname with "N/A" for empty(fullname) if vartype(oJC)="O" oJC.StepRecCount=reccount() endif return "al"So, if they are invalid codes, she inserts ********** info fullname.