Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Something Weird
Message
De
10/08/2005 23:33:07
 
 
À
10/08/2005 22:49:24
Francis Albert Militante
Fortune Medicare Incorporated
Pasig, Philippines
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01039761
Message ID:
01040079
Vues:
20
I would rather use a query to get dates and than apply them.
SELECT  branch_cd, mem_yy, memseq_no, ;
		MAX( IIF(Amount=100, Pd_FrDate, {}) AS dPdFrDate, ;
		MAX( IIF(Amount=100, Pd_ToDate, {}) AS dPdToDate ;
	FROM PayEHO ;
	GROUP BY 1,2,3 ;
	ORDER BY 1,2,3 ;
	INTO CURSOR crsDates READWRITE
INDEX ON branch_cd + STR(mem_yy) + STR(memseq_no) TAG temp
SET ORDER TO TO temp
	
SELECT MasterEHO
SET RELATION TO branch_cd + STR(mem_yy) + STR(memseq_no) INTO crsDates
GO TOP
SCAN FOR FOUND("crsDates")
	REPLACE Pd_FrDate WITH crsDates.dPdFrDate, ; 
			Pd_ToDate WITH dPdToDate 
ENDSCAN
SET RELATION TO
It could be even faster if you set relation from crsDates to MasterEHO, SCAN crsDates and update dates in MasterEHO but I don't know what indexes you've on MasterEHO

>Here are the codes:
>select MasterEHO
>go top
>do while not eof()
>  scatter memvar blank
>  scatter memvar
>
>  key = m.branch_cd + allt(str(m.mem_yy)) + allt(str(m.memseq_no))
>
>  select PayEHO
>  seek ( key )
>  if found() then
>    scan rest while branch_cd=m.branch_cd and mem_yy=m.mem_yy and memseq_no=m.memseq_no
>      nPayCounter = nPayCounter + 1
>
>       if Amount>=100 then
>         dPdFrDate = Pd_FrDate
>         dPdToDate = Pd_ToDate
>       endif
>    endscan
>  endif
>
>  select MasterEHO
>  if nPayCounter>0 then
>    replace Pd_FrDate with dPdFrDate
>    replace Pd_ToDate with dPdToDate
>  else
>    replace Pd_FrDate with ctod('')
>    replace Pd_ToDate with ctod('')
>  endif
>  skip
>enddo
>Note:
> When I run these codes on a single or a few records I can extract the last paid date but when I try to run using the whole table records, there are some records that extracts the second to the last paid date instead of the last paid date.
>
> I hope you get my meaning I try to explain it as best I can.
>
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform