Trying to filter a dataset with button labels in a repeater

Forgive me, I am extremely new to all of this. I’m beginning to pick things up thanks to the forum… So thanks for that! Hope I can get a little advice on making this to work again. I stumbled on something that worked great while I was doing something else, and of course I thought it was sooo simple, that I’d remember and be able to use it weeks later when I needed to… …

I’ve got a repeater w/ just a buttons who’s labels are connected to a dataset1 titles… I need to use the individual button within the repeater to filter dataset2 on click. Then other elements on the page that are connected to dataset2 will change. Here is what I thought I remembered to do… It doesn’t work

$w.onReady(function () {
});
import wixData from 'wix-data';

export function button_click(event) {
 let $filter = $w("button").label;
    $w("#dataset2").setFilter(wixData.filter().contains('title', $filter))
}

Hello

TO get the value for each button you need to use getCUrrentItem Method for the repeater’s data set and then set the filter to the corresponding field in the result.

Best

Massa