dropdown.selectedIndex is blank

Hi, I’m an experienced programmer but am learning velo/java. I have two dropdowns that I use to create a filter on a dataset for a repeater. The user can select year and/or park. Year defaults to current year and park defaults to All.

Here’s the issue: I set dropdownPark selected index to 0 in the OnReady section but then this value is not recognized in the following export function. Below is my code for this page and I’ve highlighted pertinent lines. This seems to be the way to have two dropdowns filtering one dataset. Please correct me if I’m wrong. Text115 is only to see results of if/else statement but I probably should use the console.

When running the page, if I change the year dropdown to say 2023, the if/else does not recognize the park.selectedindex even though I set it to 0 in the onReady section. FYI, both dropdowns are connected to the same dataset so that only data in the dataset is available for selection.

//
import wixUsers from 'wix-users';
import wixLocation from 'wix-location';
import wixData from 'wix-data';

const today = new Date();
let user = wixUsers.currentUser;
let year = Number(today.getFullYear());

$w.onReady(function () {
    // set defaults
    $w("#dataset1").setFilter(wixData.filter().eq('year',year));
    $w("#dataset1").setPageSize(12)
    $w("#dropdownPark").selectedIndex = 0;              // SETS DROPDOWNPARK SELECTED INDEX TO 0
    $w("#dropdownYear").value = year.toString();  //display current year

    // refresh totals at bottom of page
    setInterval(function() {
    let count = $w("#dataset1").getTotalCount();
    $w("#text114").text = count.toString();
    }, 1000);

})

export function dropdownYear_change(event) {
// reset filter
resetFilter();
}

export function dropdownPark_change(event) {
// reset filter
resetFilter();
}

export function resetFilter() {
// reset filter
let campout = $w("#dropdownPark").value;
let year = Number($w("#dropdownYear").value);

if ($w("#dropdownPark").selectedIndex === 0) {
    $w("#text115").text = 'Park if/else = if';                          //I WOULD EXPECT THIS WOULD BE EXECUTED
    if ($w("#dropdownYear").selectedIndex === 0) { // park = 0, year = 0
        $w("#dataset1").setFilter(wixData.filter().gt('year',1900));
    }
    else { //park = 0, year not 0
        $w("#dataset1").setFilter(wixData.filter().eq('year',year));
    }
}
else { // park not 0
    $w("#text115").text = $w("#dropdownPark").value;                     // BUT THIS IS EXECUTED
    if ($w("#dropdownYear").selectedIndex === 0) { //park not 0, year = 0
        $w("#dataset1").setFilter(wixData.filter().eq('title',campout));
    }
    else { // park and year not 0
        $w("#dataset1").setFilter(wixData.filter().eq('title',campout).and (wixData.filter().eq('year',year) ));
    }
}
}

Your assistance is greatly appreciated.