Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

COUNT to Dimension ARRAY ? 2

Status
Not open for further replies.

David Higgs

Programmer
May 6, 2012
390
GB
I have the following code in my application which works as required.

Is there a way of COUNTing into my Dimension ARRAY wagi(10) instead of first storing it in wagi_count and then storing it into my Dimension ARRAY wagi(10) ?

Code:
PUBLIC ARRAY wagi(10)

SELECT COUNT(*) FROM csrWAGI_wkd where Date_160 > ctod("01-01-2017") INTO ARRAY wagi_count 	
STORE wagi_count TO wagi(1)

SELECT COUNT(*) FROM csrWAGI_wkd where Date_80 > ctod("01-01-2017") INTO ARRAY wagi_count 	
STORE wagi_count TO wagi(2)

SELECT COUNT(*) FROM csrWAGI_wkd where Date_60 > ctod("01-01-2017") INTO ARRAY wagi_count 	
STORE wagi_count TO wagi(3)

SELECT COUNT(*) FROM csrWAGI_wkd where Date_40 > ctod("01-01-2017") INTO ARRAY wagi_count 	
STORE wagi_count TO wagi(4)

Regards,

David.

Recreational Developer / End User of VFP.
 
That makes sense, David. So what you have got is the code that I originally suggested, but with UNION ALL instead of plain UNION. I can see now that that overcomes the problem of getting the counts in order, but without having to resort to an extra column in the array.

Mike








__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
It is indeed based on your code Mike, with as you say, the UNION Statement as suggested by Chris. Far neater than my original code.

In each ARRAY, I use several in my application, I have 10 COUNTS in each. I just used 4 COUNTS as an example.



Regards,

David.

Recreational Developer / End User of VFP.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top