>Wait WINDOW "Populating CENSUS ZONE Table from Census ED Data..." NOWAIT NOCLEAR >*________________ >Select CENEDZONE && Census ED - Zone link table >SCAN > lnRecNo = lnRecNo + 1 > lcED_Area_ID = ED_AREA_ID > lnPercAlloc = PERC_ALLOC > If CENEDZONE.ZONE <> lnZoneNo && Finished totting for last zone no > Select CENSUSZN > If not INDEXSEEK( lnZoneNo) && If not already got > Append BLANK in CENSUSZN && Create new Census Zone rec > EndIf not SEEK() > Replace ZONE with lnZoneNo in CENSUSZN > Replace VAR_ID with Thisform.nVarID in CENSUSZN > FOR lnFieldNo = 3 to lnFieldCount && For all fields in CENSUSZN rec, bar ZONE, VAR_ID > lcFieldName = ALLTRIM( FIELD( lnFieldNo)) > >* Round result to correct integer no. of people in each category >* ______________________________________________________________ > Replace &lcFieldName with INT( ROUND( laFieldTots( lnFieldNo-2), 0)) in CENSUSZN > ENDFOR > = TABLEUPDATE(.T.) > laFieldTots = 0 && Clear array for next rec > lnZoneNo = CENEDZONE.ZONE && next new zone no > EndIf CENEDZONE.ZONE <> lnZoneNo > > If SEEK( lcED_Area_ID, "CENSUSED", "ED_AREA_ID") && if find parent ED in CENSUSED > Select CENSUSED > FOR lnFieldNo = 3 to lnFieldCount && For all fields in CENSUSED rec, bar ED_AREA_ID & PERC_ALLOC > lcFieldName = ALLTRIM( FIELD( lnFieldNo)) > laFieldTots( lnFieldNo-2) = laFieldTots( lnFieldNo-2) + &lcFieldName * lnPercAlloc / 100 > ENDFOR > EndIf SEEK() > Select CENEDZONE >ENDSCAN > >Select CENSUSZN && Last rec after loop >If not SEEK( lnZoneNo) && If not already got > Append BLANK in CENSUSZN && Create LAST Census Zone rec >EndIf not SEEK() >Replace ZONE with lnZoneNo in CENSUSZN >Replace VAR_ID with Thisform.nVarID in CENSUSZN >FOR lnFieldNo = 3 to lnFieldCount && For all fields in CENSUSZN rec, bar ZONE, VAR_ID > lcFieldName = ALLTRIM( FIELD( lnFieldNo)) > Replace &lcFieldName with INT( ROUND( laFieldTots( lnFieldNo-2), 0)) in CENSUSZN >ENDFOR > = TABLEUPDATE(.T.) > >