Yes everything is possible.
Yes, everything is possible, but that will take some programming work.
In your case, your request goes beyond a helping-situation and is turning into a SERVICE.
But anyways i will give you some tips.
How to generate a dynamic-multi-filter?
-
I would suggest you to work with - → Wix-Data (do not include any datasets into your project), if you want to generate a totaly dynamic and free of any boundary filter-engine.
-
Also i would suggest you to generate your filtering-engine on - - > BACKEND, why???
a) Better performance.
b) More security for your data.
c) Less code on your frontend, which would make coding more difficult and decreace a good overview of your code.
-
There are different ways of how to generate your filter and also different levels of how DYNAMIC your filter-engine will be at the end.
I myself, at current time am using just one Mega-Query for almost everything and in almost every usecase.
- I would suggest you to generate a similar query, which is able to switch over different DBs → fully automaticaly.
I am working currently on such an MEGA-QUERY - → called → iQuery (intelligent-query).
If you want to get more information about that running project, you can contact me.
Ok, back to your problem…
Normaly all you have to do is to feed your query on the backend with the right data from your frontend. On backend you do the queries and filterings, or what ever else you want to do. The backend then sends desired data back to frontend.
Some example… (just some ideas, not a working solution!!!)
import wixData from 'wix-data'
import { getData } from 'backend/xxxxxxxxxxxxx.jsw'
$w.onReady(()=>{
$w('#mySTARTbuttonIDhere').onClick(()=>{
start_FilterEngine();
});
})
async function start_FilterEngine() {
let query = []
let myCollections = ["Collection1", "Collection2", "Collection3"]
let FIELD1 = "field1", let VALUE1 = "value1"
let FIELD2 = "field2", let VALUE2 = "value1"
let FIELD3 = "field3", let ARRAY3 = ["value1", "value2", "value3"]
let res = getData(myCollections, FIELD1, VLAUE1, FIELD2, VALUE2, FIELD3, ARRAY3);
console.log(res);
}
BACKEND:
export async function getData(collections, FIELD1, VLAUE1, FIELD2, VALUE2, FIELD3, ARRAY3) {
return Promise.all([
query(collections[0]).limit(1000).eq(FIELD1, VALUE1).find(),
query(collections[1]).limit(1000).contains(FIELD2, VALUE2).find(),
query(collections[2]).limit(1000).hasSome(FIELD3, ARRAY3).find(),
]).then((res) => { return res })
.catch((err)=>{return err});
}
Just to give you an approximative example-code-skeleton.
UPGRADE AND EXPAND the example and generate your Multi-Filter!
Good luck!