Apologies, i’m new to code, and I’m trying my best to work it through. I’ve got a number of searches i’m using through my website and i’m using setFilter to manage the results in a list. This works great so far, but now i’ve come up against a trickier scenario.
I have 2 datasets; Company and Services
Company [Name, Approved, Site (Reference)]
Services [Name, Price, Category, Company (Reference to Company)]
I want a search facility in one of my pages that provides the Services results in a list. However, one of the Search criteria I want to use is Site, and Site is in the Company Dataset and not the Services.
I have searched through, and looked at a few examples, but I just cannot get it to work how I want.
I have 2 criteria for my search that are both dropdown boxes; Site and Category.
Category works great
$w ( “#OwnerServices” ). setFilter ( wixData . filter ()
. contains ( “serviceCategory” , $w ( “#iCategory” ). value )
. eq ( “active” , true )
);
I am guessing that I need another query that will find records within Company where the Site matches the Site selected in the Search Criteria, and then the id can be used to filter the company reference in the Services query.
I hope some of this makes sense? It would be great to get some help, as once I see the code, I will make sure I understand it and I know I will be able to replicate it moving forward then. i just can’t get over this hurdle
Thanks
Dave