Topic: How to filter combobox results based on database calculated field?

hi,
I have a calculated field in my database which is returned sold or available as text.
I have another combo box which shows all records from that table.
I need to know how can I filter every SOLD items to prevent showing them in my combobox?

Many many thanks smile

Re: How to filter combobox results based on database calculated field?

Also, this is my calculated field query:

(CASE 
WHEN (SELECT b.id_bestand 
    FROM positionen b 
    WHERE b.id_bestand=bestand.id) != 0 
THEN "Verkauft" ELSE "auf Lager" END)        

Re: How to filter combobox results based on database calculated field?

Hi,
The easiest way is to attach the criteria to the 'filter' property of the comboboxes rather than write any scripts.
In your example, you can either filter for quantity = 0 (Verkauft) or > 0 (Auf Lager) or filter by the calculated field itself.
Please see the screen shot in the attached example and the attached example itself;  obviously you could only show the item in the combobox rather than the quantity or the status as well - it just makes it easier to test.
Derek.

Post's attachments

Attachment icon cbfilter.zip 491.39 kb, 193 downloads since 2023-03-13 

Re: How to filter combobox results based on database calculated field?

Thank you Derek, you made my day