In other words, I want to run a wixData.query but only with the .hasSome property that meets the specified if criteria. If the criteria is not met, the wixData.query should run without that specific .hasSome.
So for example, if ck1 length is not > 0 and ck2 through ck6 is > 0, then the wixData.query runs without the .hasSome(ck1FN, ck1) property and with all the other .hasSome properties.
I don’t want to run the wixData.query separatelly for each .hasSome property. The .hasSompe properties have to be chained and run within one wixData.query function.
Ok, so now you have an array of objects (query results) and you need to go through them one by one and check which ones had anything found, right? Then you need to collect this results as a new array of objects that you can feed to the repeater.
So, lets create a function to do this.
function createRepeaterData(array) {
}
This function is going to receive the result from the query, then it is going to filter only the objects that had totalCount bigger than 0 (the ones with results in it):
After that, we have an array of objects with arrays of objects with the items property we need (deep nested objects that we need to access). We’ll use .map() (high order function) to access this property and return a new array of objects.