Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Steroids needed
Message
 
To
01/04/2003 10:12:23
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Miscellaneous
Thread ID:
00772404
Message ID:
00772502
Views:
17
I think you can do something like this; first make a cursor of all the distinct nstart and nend points for each type, and then count up the records in the original data.
CLOSE TABLES
USE results excl 
ZAP IN results
USE cetin.dbf
SELECT DISTINCT ;
	checkdate, xclusive, id1, id2, nstart AS nValue ;
	FROM cetin ;
UNION ;
	SELECT DISTINCT ;
	checkdate, xclusive, id1, id2, nend AS nValue ;
	FROM cetin ;
INTO CURSOR curValues ;
ORDER BY 1,2,3,4,5
SELECT curValues
SCATTER MEMVAR
m.id1 = m.id1+1		&& so first record doesn't match
SCAN
	IF m.checkdate=checkdate AND m.xclusive=xclusive AND;
	   m.id1=id1 AND m.id2=id2

		SELECT cetin
		COUNT FOR nstart<=m.nvalue AND nend>=curValues.nvalue ;
				AND checkdate=curValues.checkdate AND xclusive=curValues.xclusive ;
				AND id1=curValues.id1 AND id2=curValues.id2 ;
			TO lnCount

		INSERT INTO results (checkdate, xclusive, id1, id2, nstart,nend,ncnt) ;
			VALUES (curValues.checkdate, curValues.xclusive, ;
				curValues.id1, curValues.id2, m.nvalue, curValues.nvalue, lnCount)
	ENDIF
	SELECT curValues
	SCATTER MEMVAR
ENDSCAN

SELECT results
BROWSE
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform