PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Filtering one combo box with another
Filtering one combo box with another
Débuté par Chris L, 22 sep. 2004 05:24 - 8 réponses
Posté le 22 septembre 2004 - 05:24
I’m one of those obstinate cusses who finds it difficult to seek help from others, preferring instead to spend hours battling through problems.
However, I’m held up at the moment by something which seems a fairly routine problem but is nevertheless defying my efforts. I’m sure it’s no problem to some of you so I’m hoping you’ll be able to help me.
The essential problem comes down to filtering one combo box with the results of another.
Combo box 1 is filled from a file VENUE. I used the wizard to set this up. It displays the VenueName and returns VenueID. No problems – this works fine.
The next file is MEETING. This is linked to VENUE by VenueID.
For any given venue, there are a number of meetings – the meeting required is chosen by date. I want a combo box to display the dates available for any given venue.
I’ve tried various pieces of code with little success. I tried setting up a query for this but no luck there. I did make some progress with Hfilter but this worked for the first choice of venue but did not work for subsequent choices.
I’d really appreciate any specific help anyone can give me. In particular I need to know what I should put in each combo if anything or if there are any specific settings for each combo.
Thanks in advance
Chris L
Melbourne, Oz
Posté le 22 septembre 2004 - 09:08
Hello Chris,
Make sure that your Search Item in the MeetingComboBox is set to VenueID.
On the Row Selection code for the VENUE combo box, try the following code
MeetingComboBox..filter=VenueComboBox
Provided that you have your MeetingComboBox displaying the time column and that your Search item is set to Venue ID, this should do it.
And don't worry, there isn't one of us who hasn't been stuck for inordinate amounts of time on one issue or another.
HTH,
Marc
I’m one of those obstinate cusses who finds it difficult to seek help from others, preferring instead to spend hours battling through problems.
However, I’m held up at the moment by something which seems a fairly routine problem but is nevertheless defying my efforts. I’m sure it’s no problem to some of you so I’m hoping you’ll be able to help me.
The essential problem comes down to filtering one combo box with the results of another.
Combo box 1 is filled from a file VENUE. I used the wizard to set this up. It displays the VenueName and returns VenueID. No problems – this works fine.
The next file is MEETING. This is linked to VENUE by VenueID.
For any given venue, there are a number of meetings – the meeting required is chosen by date. I want a combo box to display the dates available for any given venue.
I’ve tried various pieces of code with little success. I tried setting up a query for this but no luck there. I did make some progress with Hfilter but this worked for the first choice of venue but did not work for subsequent choices.
I’d really appreciate any specific help anyone can give me. In particular I need to know what I should put in each combo if anything or if there are any specific settings for each combo.
Thanks in advance
Chris L
Melbourne, Oz
Posté le 22 septembre 2004 - 09:19
Hi Chris,
If you put the hfilter statement, followed by the listdisplay(meetings_list) in the row_selection of the venues combo, plus the meetings file in the meetings_list combo is indexed by venueId then the filtering works.
Clive
Posté le 22 septembre 2004 - 10:57
Make sure that your Search Item in the MeetingComboBox is set to VenueID.
On the Row Selection code for the VENUE combo box, try the following code
MeetingComboBox..filter=VenueComboBox
Provided that you have your MeetingComboBox displaying the time column and that your Search item is set to Venue ID, this should do it.
And don't worry, there isn't one of us who hasn't been stuck for inordinate amounts of time on one issue or another.
HTH,

Marc
I've just tried this and unfortunately it doesn't work. I've followed your instructions but what I end up with in the Meeting Combo box is a list of all the dates on file, not filtered in any way. I'll give Clive's suggestion a bash now.
Thanks for the response
Chris
Posté le 22 septembre 2004 - 11:13
Hi Chris,
If you put the hfilter statement, followed by the listdisplay(meetings_list) in the row_selection of the venues combo, plus the meetings file in the meetings_list combo is indexed by venueId then the filtering works.
Clive

It works! That ListDisplay statement did the trick.
Now I'd just like to tidy it up a little.
I pick a venue, say Warrnambool. There's one date for this, say 25/9/2004, which I can select when I drop down the Meeting combo box.
Now I go and pick another venue, say Toowoomba. Here there are a couple of dates, 28/9/2004 and 2/10/2004. These dates appear when I drop down the combo box. But when I initially select Toowoomba, the date from Warrnambool still remains in the Meeting combo box, a possible source of confusion. I can get round this by blanking it out when a new Venue selection is made but what I'd really like is for the Meeting box to show the first date (or better still, last date) whenever a new venue is chosen.
Is this possible?
Many thanks for your help so far.
Chris
Posté le 22 septembre 2004 - 12:23
Hi Chris,
If you put the hfilter statement, followed by the listdisplay(meetings_list) in the row_selection of the venues combo, plus the meetings file in the meetings_list combo is indexed by venueId then the filtering works.
Clive
It works! That ListDisplay statement did the trick.

Now I'd just like to tidy it up a little.
I pick a venue, say Warrnambool. There's one date for this, say 25/9/2004, which I can select when I drop down the Meeting combo box.
Now I go and pick another venue, say Toowoomba. Here there are a couple of dates, 28/9/2004 and 2/10/2004. These dates appear when I drop down the combo box. But when I initially select Toowoomba, the date from Warrnambool still remains in the Meeting combo box, a possible source of confusion. I can get round this by blanking it out when a new Venue selection is made but what I'd really like is for the Meeting box to show the first date (or better still, last date) whenever a new venue is chosen.
Is this possible?
Many thanks for your help so far.
Chris

Try listselectplus(meeting_list,1) after the listdisplay()
Cheers,
Clive
Posté le 22 septembre 2004 - 12:36
Try listselectplus(meeting_list,1) after the listdisplay()
Cheers,
Clive

I've been fiddling around and just discovered that ListSelectPlus provides the magic ingredient. I'd just returned to the Forum to note this when I found you'd beaten me to it!
I also found the ..Occurrence property for lists and combos so now if there's only one date for a venue, this is what goes in the meeting combo but if there is more than one date then I can open up the combo (ComboOpen) to show all the dates.
Meny thanks for your help (once again), Clive. I really must make more use of this Forum for solving problems!
Cheers. Catch up with you sometime.
Chris
Posté le 22 septembre 2004 - 16:46
Meny thanks for your help (once again), Clive. I really must make more use of this Forum for solving problems!
Cheers. Catch up with you sometime.
Chris

Good to hear from you again, Chris
Perhaps another Windevorkshop would be useful?
Regards,
Clive
Posté le 23 septembre 2004 - 04:16
Good to hear from you again, Chris
Perhaps another Windevorkshop would be useful?
Regards,
Clive

Definitely! It's two years since our last workshop and we're well overdue. There are a few more WD users in this part of the world so we should be able to have an interesting day or weekend.

After more than a year out of action, I'm now finding I am able to do some programming, at least in small doses. While I'm nowhere near fully recovered, I have actually been able to produce a small but useful program for someone else. This program connects to the Internet, loads up a page then parses it, pokes the data in various files and with one more keypress, prints out the data in the appropriate form. What used to take the user three hours or more now takes five minutes or less. This exercise has been further proof for me of just how beautiful this latest version of WinDev is!
I'll catch up with you privately and talk further.
Cheers
Chris