Select to view content in your preferred language

Case sensitive query task

3334
3
01-27-2011 07:48 AM
MikeJun
Emerging Contributor
I have query task to seach first name however users have to type first letter as upper case just like value in the attribute table. For example, they have to type like 'John' not 'john'. Is there way that users can type either upper or lower case?

<esri:Query id="queryFname" text="%{qTextFname.text}%" where="FName like '%{qTextFname.text}%'">
Tags (2)
0 Kudos
3 Replies
ReneRubalcava
Esri Frequent Contributor
If it's just the one name you're worried about you could do this
var qName:String = qTextFname.text.toLowerCase();
var len:int = qName.length;
var ucase:String = qName.charAt(0).toUpperCase();
var temp:String = qName.substr(1, len);
var newName:String = ucase + temp;

AS3 doesn't have a simple capitalize function.

OOh, found a regex method to do it for multiple words
http://stackoverflow.com/questions/860394/flex-capitalize-words-in-string
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Mike,

   If you want to do it all inline in the mxml then this works:

<esri:Query id="queryFname" where="Upper(FName) like Upper('%{qTextFname.text}%')"> 


You should not use text="something" and where="something" at the same time.
0 Kudos
MikeJun
Emerging Contributor
Rene, thanks for the quick response.

Robert, thanks a lot again. simple and work great as usual.
0 Kudos