I have an array like the following and I want to search only those values against gAssessorsCompanyAssociationsArray array where a user has entered something in any textbox and where any dropdown value is not "- Select One -". For example if a user has selected something in "Doctor Name" other than "- Select One -" then it should be part of my search against gAssessorsCompanyAssociationsArray array. If a user has entered something in "City" then it should be part of my search against gAssessorsCompanyAssociationsArray array.

I am storing if statement's expression is Profile_Filter variable and executing it using eval(which is not recommended).

My Array:
Code:
gAssessorsCompanyAssociationsArray[0] = new Object();   
gAssessorsCompanyAssociationsArray[0].DoctorName = gAssessorsInfoArray[j].DoctorName;   
gAssessorsCompanyAssociationsArray[0].DoctorLocation  = gAssessorsInfoArray[j].DoctorLocation;  
gAssessorsCompanyAssociationsArray[0].Specialty = gAssessorsInfoArray[j].Specialty; 
gAssessorsCompanyAssociationsArray[0].SubSpecialty = gAssessorsInfoArray[j].SubSpecialty;
gAssessorsCompanyAssociationsArray[0].City = gAssessorsInfoArray[j].City;   

gAssessorsCompanyAssociationsArray[1] = new Object();   
gAssessorsCompanyAssociationsArray[1].DoctorName = gAssessorsInfoArray[j].DoctorName;   
gAssessorsCompanyAssociationsArray[1].DoctorLocation  = gAssessorsInfoArray[j].DoctorLocation;  
gAssessorsCompanyAssociationsArray[1].Specialty = gAssessorsInfoArray[j].Specialty; 
gAssessorsCompanyAssociationsArray[1].SubSpecialty = gAssessorsInfoArray[j].SubSpecialty;
gAssessorsCompanyAssociationsArray[1].City = gAssessorsInfoArray[j].City;
My Code:
Code:
if($('#DoctorNameDropDown option:selected').text() != '- Select One -' || $('#DoctorLocationID').val() != '' || $('#SpecialtyDropDown option:selected').text() != '- Select One -' || $('#SubSpecialty').val() != '' || $('#City').val() != '')
        {               
            var Profile_Filter = '';

            if($('#DoctorNameDropDown option:selected').text() != '- Select One -')
            {                       
                Profile_Filter += 'gAssessorsCompanyAssociationsArray[i].UserID == $("#DoctorNameDropDown option:selected").val()';                                                         
            }

            if($('#DoctorLocationID').val() != '' && $('#DoctorLocationID').val() != 0)
            {
                if(Profile_Filter != '')                        
                    Profile_Filter += ' && ' + 'gAssessorsCompanyAssociationsArray[i].CompanyID == $("#DoctorLocationID").val()';
                else
                    Profile_Filter += 'gAssessorsCompanyAssociationsArray[i].CompanyID == $("#DoctorLocationID").val()';
            }

            if($('#SpecialtyDropDown option:selected').text() != '- Select One -')
            {               
                if(Profile_Filter != '')                        
                    Profile_Filter += ' && ' + 'gAssessorsCompanyAssociationsArray[i].AssessorSpecialty == $("#SpecialtyDropDown option:selected").val()';
                else
                    Profile_Filter += 'gAssessorsCompanyAssociationsArray[i].AssessorSpecialty == $("#SpecialtyDropDown option:selected").val()';
            }

            if($('#SubSpecialty').val() != '' && $('#SubSpecialty').val() != 0)
            {                       
                var SubSpecialty_Filter = '';
                var SubSpecialty = $('#SubSpecialty').val().split(';');                         

                for(var i = 0; i < SubSpecialty.length; i++)
                {
                    if(SubSpecialty[i] == '')
                    {
                        SubSpecialty.splice(i, 1);
                        i--;                
                    }                                           
                }                           

                if(SubSpecialty.length > 1)
                {                       
                    for(var j = 0; j < SubSpecialty.length; j++)
                    {
                        if(j == 0)
                        {
                            SubSpecialty_Filter += '(gAssessorsCompanyAssociationsArray[i].SubSpecialty.indexOf("' + SubSpecialty[j] + '") > -1';                                           
                        }
                        else
                        {
                            SubSpecialty_Filter += ' && gAssessorsCompanyAssociationsArray[i].SubSpecialty.indexOf("' + SubSpecialty[j] + '") > -1';                                        
                        }                                
                    }
                    SubSpecialty_Filter += ')';                     
                }
                else
                    SubSpecialty_Filter +=  '(gAssessorsCompanyAssociationsArray[i].SubSpecialty.indexOf("' + SubSpecialty[0] + '") > -1)'; 

                if(Profile_Filter != '')                        
                    Profile_Filter += ' && ' + SubSpecialty_Filter; 
                else
                    Profile_Filter += SubSpecialty_Filter;      
            }                       

            if($('#City').val() != '')
            {
                if(Profile_Filter != '')                        
                    Profile_Filter += ' && ' + 'gAssessorsCompanyAssociationsArray[i].CompanyCity == $("#City").val()';
                else
                    Profile_Filter += 'gAssessorsCompanyAssociationsArray[i].CompanyCity == $("#City").val()';
            }                   

            for(var i = 0; i < gAssessorsCompanyAssociationsArray.length; i++)
            {
                if(eval(Profile_Filter))
                {
                    gAssessorsIDSArray.push(gAssessorsCompanyAssociationsArray[i].UserID); 
                    gBookingsProfileArray.push(gAssessorsCompanyAssociationsArray[i]);                                      
                }               
            }
    }
My HTML:
Code:
<table>
                <tbody>                  
                    <tr>                
                        <td> Doctor Name :</td>               
                        <td>
                            <select id='DoctorNameDropDown'>
                                <option selected = '' value=''>- Select One -</option>
                            </select>
                        </td>
                        <td> Doctor Location :</td>
                        <td>                           
                            <div style="position:relative;height:100%;display:block;z-index:95;" id="DoctorLocationlookupdiv">
                                <div onclick="this.style.display='none'" style="position:absolute;left:0;top:0;z-index:94;display:none;background:#FFFFFF" id="DoctorLocationResultdiv"></div>
                                <input type="text" onkeyup="dyn_companysearch(event,this.value,document.getElementById('DoctorLocationResultdiv'),document.getElementById('DoctorLocationlookupdiv'),document.getElementById('DoctorLocationID'),this,1,102946,'1918')" autocomplete="off" class="Lookup" onblur="this.className='Lookup';setDynamicSearchValue(dynsearch_highlight_row);clearDynamicSearch(false);" style="width: 150px;"  id="DoctorLocationtxt">
                            </div>
                            <input type="hidden" id="DoctorLocationID" value="">                                
                        </td>               
                    </tr>           

                    <tr>                
                        <td> Specialty :</td>               
                        <td>                     
                            <select id="SpecialtyDropDown"><option selected = '' value=''>- Select One -</option><option value="Addictions">Addictions</option><option value="Anaesthesiology">Anaesthesiology</option></select>                        
                        </td>
                        <td> Sub Specialty :</td>
                        <td>                         
                            <input id="SubSpecialty" type="hidden" value="" name="SubSpecialty">
                            <div id="lookupdiv_1271728" class="ajaxLookUpContainer">
                                <div id="resultdiv_1271728" class="ajaxLookUpResult" onclick="this.style.display='none'"></div>
                                <input id="d_cf_1271728" class="Large" type="text" onkeyup="dyn_fieldoptionsearch(event,this.value,document.getElementById('resultdiv_1271728'),document.getElementById('lookupdiv_1271728'),document.getElementById('SubSpecialty'),this,1271728,1)" autocomplete="off" onblur="setDynamicSearchValue(dynsearch_highlight_row);clearDynamicSearch(false);" onclick="toTextBoxEnd(this)" value="" name="d_cf_1271728" size="100" title="" style="width: 150px;">
                                <input type="hidden" value="WUZ2DVMBfUhGdEREV15LUF0DBnFae11bD1RTbDEDBgQ3Bws~" name="sec_cf_1271728">
                            </div>                              
                        </td>             
                    </tr>                       
                    <tr>                
                        <td> City :</td>                
                        <td>
                            <input type="text" id="City">  
                        </td>
                        <td></td>
                        <td>                             
                        </td>             
                    </tr>                                               

                    <tr>                        
                        <td colspan='4' align='center'> <input type='button' onclick='GetBookings();' value='Get Bookings'> </td> 
                    </tr>
                </tbody>
            </table>