Adding a filter to a dynamic page

Hi, I’ve been trying to filter content on my dynamic page with no success… Basically I have a page with over a hundred awards and I want to have 2 filters: by award (gold, bronze, silver) and by year (. Ideally, they’d be dropdowns. I can’t figure out how to do it. Any help would be appreciated :smile:

Thanks!

Try to generate your code step by step…

First get the current ITEM-DATA of your current selected DYNAMIC-ITEM on your DYNAMIC-PAGE connected by a DYNAMIC-DATASET.

$w.onReady(()=>{
$w(‘#dynamicDataset’).onReady(()=>{
let currentItemData = $w(‘#dynamicDataset’).currentItem;
console.log("Current-Dynamic-Item-Data: " currentItemData);
});
});

Then put some filter onto your DYNAMIC-DATASET…

So you are looking for an AWARD-FILTER…
But first question would be, your DB-Field where you have stored all the AWARDS, which kind of TYPE is this DB-Field?

  1. ARRAY ?
  2. OBJECT?
  3. Stringified-Array?
  4. something else?

I assume it will be an ARRAY and your DB-FIELD will be generated as SELECTION-TAGS (TAGS).

In this case you will need → hasSome();
…or…-------------------------------> has All();

read this post, it will open your eyes and will teach you a lot about FILTER-ENGINE and how it works…