# Need to search data for a last name, and THEN

**URL:** <https://forum.kirupa.com/t/need-to-search-data-for-a-last-name-and-then/168280>\
**Category:** Uncategorized\
**Created:** [November 5, 2005, 8:24pm UTC](https://forum.kirupa.com/t/need-to-search-data-for-a-last-name-and-then/168280 "2005-11-05T20:24:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icebot](https://avatars.discourse-cdn.com/v4/letter/i/8491ac/32.png) [@icebot](https://forum.kirupa.com/u/icebot)\
**Post date:** [November 5, 2005, 8:24pm UTC](https://forum.kirupa.com/t/need-to-search-data-for-a-last-name-and-then/168280/1 "2005-11-05T20:24:39Z")

</div>

i need to be able to adjust the following code. I have too many people w/last names ending in “S,” so i have to break it up into 2 groups: last names Sa - Sl, and last names Sm - Sz.

code follows:

if(lastname[x].substring(1,0) == “A” || lastname[x].substring(1,0) == “B” || lastname[x].substring(1,0) == “C” || lastname[x].substring(1,0) == “D” || lastname[x].substring(1,0) == “E” || lastname[x].substring(1,0) == “F” || lastname[x].substring(1,0) == “G” || lastname[x].substring(1,0) == “H” || lastname[x].substring(1,0) == “I” || lastname[x].substring(1,0) == “J” || lastname[x].substring(1,0) == “K” || lastname[x].substring(1,0) == “L”){  
currentHALF = “1st”  
}   
else if(lastname[x].substring(1,0) == “M” || lastname[x].substring(1,0) == “N” || lastname[x].substring(1,0) == “O” || lastname[x].substring(1,0) == “P” || lastname[x].substring(1,0) == “Q” || lastname[x].substring(1,0) == “R” || lastname[x].substring(1,0) == “S” || lastname[x].substring(1,0) == “T” || lastname[x].substring(1,0) == “U” || lastname[x].substring(1,0) == “V” || lastname[x].substring(1,0) == “W” || lastname[x].substring(1,0) == “X” || lastname[x].substring(1,0) == “Y” || lastname[x].substring(1,0) == “Z”){  
currentHALF = “2nd”  
}

here’s what i currently have, but it’s not working:

else if(\_root.currentdatatype == “lastname” && \_root.currentdataID == “Sa” && lastname[x] == “S” + “a” && currentHALF == “1st”){  
tempLASTNAMEnormalized = “Sa”  
tempGRIDADDITION1 = “”  
tempGRIDADDITION2 = " (Last Names Beginning With Sa)"  
}

the data is accessed by selecting the options through a pulldown menu. any advice on how to do this would be much appreciated. i’m dealing with someone else’s code.
