Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select statement with count
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00786834
Message ID:
00787072
Vues:
20
I would do it this way:

WITH thisform.pageframe1.page3
with .List1
.Rowsource="chgnotce"
.RowsourceType=8
endwith

thisfoem.addproperty("List2src["+trans(.List1.ListCount)+",2]","")
sele (.list1.Rowsource)
FOR ia= 1 to .List1.ListCount
.List2src[ia,1]=.List1.list[ia,1]
lccom="count for not empty("+.List1.list[ia,1]+") to this.List2src[ia,2]"
&lccom
endfor

with .List2
.RowsourceType=5
.Rowsource="thisform.List2src"
.ColumnCount=2
endwith
endwith

>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***************
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform