Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select statement with count
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00786834
Message ID:
00786945
Views:
27
Hello Yuri,

Can you please tell me.

I am using the following code to show all the field names in the first list box.

And in the second list box i am showing how many times this field is being used in the table i have 20,000 records. i am trying to find the count for each field. means how frequently are the fields used.

but in the second list box i am getting the same number for all the fields the number is right for the first field and the same is being repeated for the rest of the fields count.
I am doing this:

select count("+col1+") as total;
from chgnotce where not empty("+col1+") and Deleted() = .f. into cursor temp

select cuList2
append from dbf("temp")
use in select("temp")

**************************Code Start**************************************
If not used("chgnotce")
use chgnotce
endif
with thisform.pageframe1.page3.List1
.Rowsource="chgnotce"
.RowsourceType=8
endwith


CREATE CURSOR cuList2 (Total N(5))

for n = 1 to thisform.pageframe1.page3.list1.listcount
col1 = thisform.pageframe1.page3.list1.listitem(n,1)

select count("+col1+") as total;
from chgnotce where not empty("+col1+") and Deleted() = .f. into cursor temp

select cuList2
append from dbf("temp")
use in select("temp")
endfor


WITH thisform.pageframe1.page3.list2
.RowSourceType = 2 && Alias
.RowSource = "cuList2"
.Requery()
.refresh()
.setfocus()
ENDWITH

********************************************END***************
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform