Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Filtering records by list box.
Message
De
12/05/2003 10:21:17
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00787216
Message ID:
00787315
Vues:
18
Mark,
For small sets this would work. But might hit the maximum command line length with large sets.
Cetin

>I would put a button by your listbox that says "DoQuery"
>In its click(), I would iterate through your list and make a delimited filter string:
>
>Public G_FilterStr   && Persistent scope.  This isn't tidy OOP but it works
>G_FilterStr="|"
>with thisform.list1
>For i=1 to .listcount
>  if .selected(i)
>    G_FilterStr=G_FilterStr + .list(i) + "|"
>  endif
>endfor
>endwith
>set filt to atc(trim(department),G_FilterStr) > 0
>Browse Nowait Normal
>
>that's all you need.
>
>if the values of T1...TLast can potentially be subvalues of each other (for example, "USELESS","VERYUSELESS", then the field would need have delimiters applied to guarantee correct results:
>set filt to atc("|"+trim(department)+"|",G_FilterStr) > 0
>

>
>
>
>>Hi
>>
>>I have a form with a list box which has several values i.e. T1, T2, T3 ..........T7. This list box is not connected to any table. The values are added manually. I have a table from a database application which has thousands of records. One of those fields is called department and contained within the field are the values T1 or T2 or T7 etc.
>>
>>What I would like to do is to use the list box on my form (multiple select) and then click a button to find those records that match what I have selected in the list box. For example if I select T2 and T7 then it would list those records that have T2 and T7 in the department field. I suppose I need some looping statement to do this. Can anybody start me down the right path.
>>
>>Thankyou very much!
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform