>This is an idea of what I have come up with so far, comon, lets fix it! What I did here was:
>-snip-
>SELECT WORKPO
>COPY TO temp FOR po = varpo
>USE temp IN 0
>SELECT temp
>COUNT TO ct
>-snip-
>-keep in mind that WORKPO and HISTPO have the field "PO" indexed-
>
First, create a parameterized view of WorkPO as a permanent member of a DBC:
create SQL View V_WorkPO as Select * from WorkPO where PO = ?nPO
Then you can:
use WorkPO order PO
use HistPO in 0 order PO
use V_WorkPO in 0 Nodata
set relation to PO into HistPO
locate
do while !eof("WorkPO")
nPO = WorkPO.PO
requery("V_WorkPO")
wait window nowait "V_WorkPO has " ;
+ alltrim(str(reccount("V_WorkPO"),6,0)) ;
+ " record[s]."
select HistPO
if NOT eof("HistPO")
... blah...blah...blah
endif
select WorkPO
skip while PO = nPO
enddo
Using the parameterized view will cut processing time down significantly. Better than copying to Temp table.
>wait window 'TEMP has more 1 records'
>SELECT histpo
>SEEK varpo
>IF FOUND()
> COUNT FOR po = varpo
> IF _tally = ct
> SELECT temp
> SEEK varpo
> SELECT histpo
> SEEK varpo
> FOR i = 1 TO _tally
> IF class = varclass AND ;
> fund = varfund AND ;
> udds = varudds AND ;
> amount = varamount AND ;
> fy = varfy AND ;
> activity = varactivity AND ;
> account = varaccount
> SELECT temp
> DELETE
> ELSE
>
> ENDIF
> ENDFOR
>
> ELSE
>
> ENDIF
>ELSE
> *APPEND to HISTPO
> SELECT workpo
> REPLACE which WITH '3'
>ENDIF
Mark McCasland
Midlothian, TX USA