Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Filtering records by list box.
Message
From
12/05/2003 05:13:51
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00787216
Message ID:
00787220
Views:
17
>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!
create cursor temp (department c(fsize('department','searchtable')))
with .ListboxName
for ix=1 to .Listcount
 if .Selected[ix]
   insert into temp values (.List(ix) )
 endif
endfor

select * from SearchTable ;
 inner join temp on SearchTable.Department = temp.Department ;
 into cursor crsMatch
You might do that w/o a temp cursor too but w/o knowing how many items migh be selected max, this is better IMHO.
Cetin
Ç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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform