Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count of columns with value
Message
From
18/08/2008 07:05:58
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Count of columns with value
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01339464
Message ID:
01339464
Views:
60
Hi
I want to get the count of the column with specific value.
In the following example Ihave to know how many columns with 'Y' (value can be 'Y' or empty)
create cursor mycursor (yellow c(1), grin c(1), blue c(1),total i)
insert into mycursor (yellow,grin,blue) values ('','Y','Y')
insert into mycursor (yellow,grin,blue) values ('Y','','Y')
insert into mycursor (yellow,grin,blue) values ('Y','Y','Y')
insert into mycursor (yellow,grin,blue) values ('','Y','')
insert into mycursor (yellow,grin,blue) values ('Y','','Y')
insert into mycursor (yellow,grin,blue) values ('','Y','Y')
insert into mycursor (yellow,grin,blue) values ('Y','','')

select mycursor
scan
	replace mycursor.total with ?&&count of columns with 'Y' value (0/1/2/3)
endscan
Thank you
Chaim
Next
Reply
Map
View

Click here to load this message in the networking platform