Help filtering booleon values

I relooked at your code and was now actually following the logic.

Here’s a few things I spotted.

  1. In your export function storeDropdown_change ( event ) { you have:
$w("#dataset1").onReady( () => {

Remove the .onReady() line and its matching closing ‘}’. The user had made the selection from the dropdown, and by that time your data would have already loaded on the page. You’re going to change the record pointer on your dataset using the filter, so there is no use to use the onReady().

  1. Can you ensure that your 4 variables you are checking (‘Art’, ‘Community’, ‘Retail’, ‘Education’) are boolean in the table (collection). Since you are using .eq() to set your filter, the field type has to match exactly.

  2. Since using the setFilter() returns a promise (meaning it promises to set the filter at some point), You can wait for the setFilter() to complete before continuing. I use await to let it finish setting the filter before I continue. Alternatively, people also use .then() and do something after the filter has been set. If you use await or .then() you will have to change your main function line to:

export async function storeDropdown_change(event) {

Then you can use:

await w("#dataset1").setFilter(wixData.filter().eq("retail", true));

In one of the examples near the bottom of the API documentation, they show the example of using .setFilter() with a .then() clause.

Here’s the link to the API docs: