Users filtering using 2 factors

Hi all, I have attempted to edit existing code I have on my website in order to allow users to search a different data set. I am so not great at coding and am having difficulty - it seems like it should work (to me) and yet…any ideas?

import wixData from ‘wix-data’ ;

$w . onReady ( function () {
$w ( “#input2” ). onChange (() => {
filterData ();
})

$w ( "#input1" ). onInput (() => { 
    filterData (); 
}) 

**function**  filterData () { 
    **let**  filterBuilder ; 
    **if**  ( $w ( "#input2" ). value ) { 
        **let**  address  =  $w ( "#input2" ). value ; 
        filterBuilder  =  wixData . filter (). gt ( "address" ,  $w ( "#input2" ). value ) 
    }  **else**  { 
        filterBuilder  =  wixData . filter (). contains ( "Userstate" ,  $w ( "#input1" ). value ) 
    } 

                    $w ( "#text29" ). text  =  "Oops! No matches found..." 
                    $w ( "#text30" ). text  =  "Search for another city near you to find matches." 
                } 
            }) 
    

$w ( "#repeater4" ). onItemReady ( **async**  ( $item ,  itemData ,  index ) => { 
    **var**  userState  =  itemData . userstate ; 
    $item ( "#text31" ). text  =  "Playgroup Name"   + itemData . lastname ; 
    $item ( "#text10" ). text  =  "Location"  +  itemData . address  +  " ("  +  itemData . UserState  +  ")" ; 
    $item ( "#text259" ). text  =  "Meeting Days/Times"  +  itemData . longAnswerField ; 
    $item ( "#text260" ). text  =  "Cost of Playgroup"  +  itemData . shortanswerfield ; 
    $item ( "#text261" ). text  =  "Contact/URL"  +  itemData . email ; 
     } 

});

Based on the code you provided, it seems like #input1 value will not be used to filter as long as #input2 has a value.

This is due to the use of a conditional on the value of #input2 which will always be true as long as it is has some string value.

I would check out the following Velo Example to see a working demo using multiple filters on a dataset.