Is It Possible To Have This Code Working With Dataset?

Hello, I tried hard but couldn’t have the same working with dataset filter, not query.
I will be very glad if someone can help me.
Here are the codes:

Code with query, that works:

import wixData from 'wix-data'
$w.onReady(function () {
   $w('#searchButton').onClick(function () {
       wixData.query("RepertoireList")
           .contains("songName", $w("#searchInput").value)
           .or(wixData.query("RepertoireList")
               .contains("artistName", $w("#searchInput").value))
           .find()
           .then((results) => {
let resultsItems = results.items;
               console.log(resultsItems);
                 $w('#resultsTable').rows = resultsItems;
           })
   })
})

The same code, changed for working with dataset, not working

import wixData from 'wix-data'

$w.onReady(function () {
    $w('#searchButton').onClick(function () {
        $w("#dataset2").setFilter(wixData.filter()
            .contains("songName", $w("#searchInput").value)
            .or($w("#dataset2").setFilter(wixData.filter()
                .contains("artistName", $w("#searchInput").value)))
            .find()
            .then((results) => {
 let resultsItems = results.items;
                    console.log(resultsItems);
                    $w('#resultsTable').rows = resultsItems;
                )

            })

    })

})

Thanks In Advance!!!

Greetings,

Be sure and review the specific documentation for filtering datasets. I noticed a couple things in your code:

  • Set filter does not return a result like a query does. What you would do instead is connect the table to the dataset, and when you filter it, the “narrowed result” will show in the dataset-connected table.

  • When you use “and” or “or”, you need to reference the dataset only once, at the beginning.
    Your code should look something like this:

   $w("#dataset2").setFilter(wixData.filter()
        .eq("songName", $w("#searchInput").value)
        .or(
            wixData.filter()
            .eq("artistName", $w("#searchInput").value)
        )
    )
    .then(() => {
        console.log("it is filtered");
    })

Dear @tony-brunsman
Thank you very much, it works as needed.
You are the best, thanks again!!!