@tony-brunsman Solved thanks for your help anyway
//Exercise filter
export function FilterByExercise(){
let ppl = ;
let exerciseType = ;
let equipmentType = ;
let muscleGroup = ;
// Get the indexes of all the checkboxes checked in that group
let selectedppl = $w(“#pushPullcheckboxgroup”).selectedIndices;
let selectedexerciseType = $w(“#exerciseTypecheckboxgroup”).selectedIndices;
let selectedequipmentType = $w(“#equipmentCheckboxgroup”).selectedIndices;
let selectedmuscleGroup = $w(“#muscleGroupcheckboxgroup”).selectedIndices;
let filter = wixData.filter();
// Now, loop through the checked items and add each field to the array and apply filter
if (selectedppl.length > 0){
for ( var i = 0; i < selectedppl.length; i++) {
ppl.push($w(‘#pushPullcheckboxgroup’).options[selectedppl[i]].value);
}
}
if (ppl.length > 0) {
filter = filter.hasSome(“ppl”, ppl);
}
if (selectedexerciseType.length > 0){
for ( var i2 = 0; i2 < selectedexerciseType.length; i2++) {
exerciseType.push($w(‘#exerciseTypecheckboxgroup’).options[selectedexerciseType[i2]].value);
}
}
if (exerciseType.length > 0) {
filter = filter.hasSome(“exerciseType”, exerciseType);
}
if (selectedequipmentType.length > 0){
for ( var i3 = 0; i3 < selectedequipmentType.length; i3++) {
equipmentType.push($w(‘#equipmentCheckboxgroup’).options[selectedequipmentType[i3]].value);
}
}
if (equipmentType.length > 0) {
filter = filter.hasSome(“equipmentType”, equipmentType);
}
if (selectedmuscleGroup.length > 0){
for ( var i4 = 0; i4 < selectedmuscleGroup.length; i4++) {
muscleGroup.push($w(‘#muscleGroupcheckboxgroup’).options[selectedmuscleGroup[i4]].value);
}
}
if (muscleGroup.length > 0) {
filter = filter.hasSome(“muscleGroup”, muscleGroup);
}
$w("#trainingCollectiondataset").setFilter(filter)
.then(() => {
console.log("count after", $w("#trainingCollectiondataset").getTotalCount());
$w("#numberOfexercisesinputbox").value = "Number of exercises available"+ " " + $w("#trainingCollectiondataset").getTotalCount()
})
. **catch** ((err) => {
console.log(err);
});
}
// Filetr each time you click a check box in a group
export function pushPullcheckboxgroup_change(event) {
FilterByExercise();
}
export function exerciseTypecheckboxgroup_change(event) {
FilterByExercise();
}
export function equipmentCheckboxgroup_change(event) {
FilterByExercise();
}
export function muscleGroupcheckboxgroup_change(event) {
FilterByExercise();
}
// Filter one last time on click of the drop down
export function exerciseDropdown_click(event) {
FilterByExercise();
}