I'm very new to foxpro so please be kind.
What I'm attempting to do is select a group of records and count on a particular field within those records. Then update a particular field on a particular record within a table. All of this sits inside of a do while loop with a counter to go through all the records. I'm able to do this in sql without any problems but very little translates over well from sql to foxpro.
DO WHILE maxid >= curid
SELECT era_proj_actuals
locate for id1 = curid
curprog = prog_id
curservcat = serv_cat
cur1yrstartdt = oneyrstartdt
cur1yrenddt = oneyrenddt
curconno = conno
IF curservcat in ('00015', '00016', '00017', '00018', '00019', '00043', '00044', '00047', '00048') then
curactenc = (select COUNT(act_id) from ai_enc where conno = curconno and serv_cat = curservcat and 'program' = curprog and act_dt <= curoneyrstartdt and act_dt >= curoneyrenddt)
UPDATE era_proj_actuals SET act_enc = curactenc WHERE id1 = curid
ENDIF
curid = curid + 1
enddo
What I'm attempting to do is select a group of records and count on a particular field within those records. Then update a particular field on a particular record within a table. All of this sits inside of a do while loop with a counter to go through all the records. I'm able to do this in sql without any problems but very little translates over well from sql to foxpro.
DO WHILE maxid >= curid
SELECT era_proj_actuals
locate for id1 = curid
curprog = prog_id
curservcat = serv_cat
cur1yrstartdt = oneyrstartdt
cur1yrenddt = oneyrenddt
curconno = conno
IF curservcat in ('00015', '00016', '00017', '00018', '00019', '00043', '00044', '00047', '00048') then
curactenc = (select COUNT(act_id) from ai_enc where conno = curconno and serv_cat = curservcat and 'program' = curprog and act_dt <= curoneyrstartdt and act_dt >= curoneyrenddt)
UPDATE era_proj_actuals SET act_enc = curactenc WHERE id1 = curid
ENDIF
curid = curid + 1
enddo