I am trying to create an effective OR-filter in combination with a loop, but can’t find an end-solution.
Generating an AND-filter with the help of a loop is no problem, but how it works if you want to generate an or-filter with a loop?
Example:
if(filterMode==="AND"){console.log("AND-filter-running")
for (var i=0;i<data.length;i++) {
query = query.eq(data[i].datafield, data[i].value)
}
}
else{console.log("OR-filter-running")
for (var i=0;i<data.length;i++) {
query.or(query.eq(data[i].datafield, data[i].value))
}
}
What i want to achieve is, to have at the end all selected values to be shown in a table or repeater or just an simple ARRAY.
Selected values:
[value-1, value-2, value-3, value-4, value-5]