PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → How to set a filter on a combobox
How to set a filter on a combobox
Débuté par J. Flietstra, 07 sep. 2005 11:25 - 5 réponses
Posté le 07 septembre 2005 - 11:25
How can i set a filter on a combobox...
I want to set a filter on a combobox depending on a value choose from a other combobox
Posté le 07 septembre 2005 - 13:24
How can i set a filter on a combobox...
I want to set a filter on a combobox depending on a value choose from a other combobox

1) use a query to fill your combo
2) filter the query, e.g. hFilter(myQuery, "myItem = " + myOtherComboValue), or myOtherComboValue..DisplayedValue
3) re-display combo (ListDisplay for file combos, FileToMemoryList for memory combos)
As the query is in memory, filtering is very quick even with relatively large lists.
Regards
mat
Posté le 07 septembre 2005 - 13:48
1) use a query to fill your combo
2) filter the query, e.g. hFilter(myQuery, "myItem = " + myOtherComboValue), or myOtherComboValue..DisplayedValue
3) re-display combo (ListDisplay for file combos, FileToMemoryList for memory combos)
As the query is in memory, filtering is very quick even with relatively large lists.
Regards
mat

Here is a screenshot... this explains the situation..
On the right you have 2 listboxes.. 'maingroep/hoofdgroep' and 'subgroup/subgroepen'
When i click on a maingroup the subgroups below is diplayed correctly (with a hfilter)
But when i add a new stock record in the big listbox... the subgroup dropdown contains no data, or wrong data.. this depends on my first selection..
Posté le 07 septembre 2005 - 15:33
Here is a screenshot... this explains the situation..
On the right you have 2 listboxes.. 'maingroep/hoofdgroep' and 'subgroup/subgroepen'
When i click on a maingroup the subgroups below is diplayed correctly (with a hfilter)
But when i add a new stock record in the big listbox... the subgroup dropdown contains no data, or wrong data.. this depends on my first selection..


First of all, how do you include a screenshot in your message ?
You didn't say that your combo was part of a table. If your main group is already selected when you enter a new stock, all you should need to do is re-display your table combo. I'm not very familiar with combos in tables and imagine that you have to activate the filter when entering the combo and deactivate when leaving it. Since the sub group table combo and list potentially contain different values, you need to use a different data source (e.g. two identical queries). When refreshing display, you might have to add the table row number, using TableSelect, in square brackets, something like ListDisplay(myTable.myCombo[TableSelect(myTable])). When refreshing combo display, you probably also have to re-assign the original field value.
Regards
mat
Posté le 07 septembre 2005 - 16:34
>First of all, how do you include a screenshot in your message ?
There is a image-url on the answer page... i have uploaded my image to my own website...
You didn't say that your combo was part of a table. If your main group is already selected when you enter a new stock, all you should need to do is re-display your table combo. I'm not very familiar with combos in tables and imagine that you have to activate the filter when entering the combo and deactivate when leaving it. Since the sub group table combo and list potentially contain different values, you need to use a different data source (e.g. two identical queries). When refreshing display, you might have to add the table row number, using TableSelect, in square brackets, something like ListDisplay(myTable.myCombo[TableSelect(myTable])). When refreshing combo display, you probably also have to re-assign the original field value.

That's the right way.. it works..
First do the normal filter on the file
and second do a listdiplay of the table/control field
thankx...
Posté le 07 septembre 2005 - 17:00
>First of all, how do you include a screenshot in your message ?
Hi Mat
It is easy.
Put your image in a web spaces (ie.your web site if you have one)
Then put the url in the "image-url" of your message.
Hope in this help
Gianni