Contains() Help using it with products

Hi, I am trying to filter my dataSet that is hooked up to my products. I want to filter the dataSet by checking the product description for items I have selected in my dropdown.

I used this code on my other collection that worked fine but it doesn’t use the products, it might be because it has nested objects or being returned in an array? how do i target the description field in the products?

$w(" #partData ").setFilter(wixData.filter().contains(‘description’, $w(’ #dwnMake ').value))
I get no errors it just doesn’t filter the dataSet.

Please help!!!

P.S i have searched but cannot find the solution, and I have read the rules @brett-haralson !!!

rather than just say search the forum, why don’t you point someone in the right directions it’s not very community/helpful of you to say search the form and read the rule then close the thread!!

This is a better post and it has more info. Thank you :slight_smile: Certainly not trying to be rude, just making sure the posts have adequate information to get answered (like this one).

First, lets make your code more readable

$w("#partData").setFilter(
  wixData.filter()
  .contains('description', $w('#dwnMake').value)
);

From what you said, #partData seems to be the id of your dataset, #dwnMake is the id of your dropdown. If this is not the case please double check and correct the ids.

How are you calling this function? Have you created an event handler which calls this function?

Do you have a field key ‘description’ in your database?

As Shan says, looks ok, but have you put it within an event? Ie

$w(“#dwnMake”).onChange(() => {
//Filter here
})