Updating Aggregate Query Results to match filter parameters on Change Event

@yisrael-wix I adapted my filter function and inserted to each of my query functions with partial success. I am able to get some of the totals to update when a unique combination of checkboxs are checked.

But I cannot get the total count results to update when I check a single checkbox on its own…only when I check off a combination. And the resulting totals that do change are not accurate.

Here is an example of a function that is producing updated results, but not accurately or consistently with each check box. The dropdown aspect produces zero changes in the query results…see code below. This function is called with each export onchange event I have set up…just so you are aware.

Can you advise on if my filter is set up properly here? I am seeking to calculate the total number of items that match the dropdown and checkbox conditions.

export function Sum_projects(){
wixData.query( “Portfolio” )
.eq( “showInTotals” , true )
.or(
wixData.query( “Portfolio” )
.eq( “state” , $w( “#dropdown1” ).value)
)
.or(
wixData.query( “Portfolio” )
.eq( “underConstruction” , $w( “#checkbox2” ).checked)
)
.or(
wixData.query( “Portfolio” )
.eq( “nowLeasing” , $w( “#checkbox2” ).checked)
)
.or(
wixData.query( “Portfolio” )
.eq( “garrettResidentialManaged” , $w( “#checkbox3” ).checked)
)
.or(
wixData.query( “Portfolio” )
.eq( “disposition” , $w( “#checkbox4” ).checked)
)
.find()
.then( (results) => {
let projectTotals = results.totalCount;
$w( ‘#projectsTotal’ ).value = projectTotals;
} );
}