I am working on an app to be able to search for products by a list of attributes and a category. I currently am using Firestore and have documents where the attributes are in a list of strings (data.Products.attributeList, ex. “attributeList”: [“moisturizing”,“parabenFree”, “vegan”]) and the category is an object (data.Products.category, ex: “category”: “lotion”).
The front-end of the app is set up with checkboxes to select attributes. When selected, they are written to pageVars.attributeSearchList which is a list of texts. The category is a dropdown menu that writes to pageVars.searchCategory. The expected output is a list of data.Products documents that includes all items in the attributeSearchList and category.
I am struggling to write a Formula to display results based on the inputs and wondering if this type of formula is even possible. I first focused on just trying to get results populated based on the pageVars.attributeSearchList but am not getting output. I think I should be using MAP and SELECT, but don’t seem to be creating the right formula. I’m very new to Appgyver and new to noSQL db. I’m open to changing the documents if that helps make this work.
I think I need something like this: MAP(pageVars.attributeSearchList, SELECT(data.Products, IS_IN_ARRAY(item.attributeList, not sure how to reference the pageVars.attributeSearchList) && pageVars.category == item.category))
I’ve also tried modifying the suggested formulas here with no success. I believe I have to do something similar, search list in list, but my data structure is a bit different as my data list is an object in the document.
TIA for any help.