What are the techniques recommended for handling case sensitivity in a query in the JS API?
The Query No Map sample is a perfect example - search on "CALIFORNIA" and it returns no results.
Is there a way to handle the situation where the user doesn't know the correct capitalisation required?
function execute(stateName) {
query.text = stateName;
queryTask.execute(query,showResults);
}
You could convert query.text to upper- or lower-case, but that doesn't help unless the actual value in the geodatabase matches. Is there a flag to ignore the case in a query?
Thanks,
Steve
query.text, as API stated, is "Shorthand for a where clause using "like". The field used is the display field defined in the map document. You can determine what the display field is for a layer in Services Directory". Use query.where instead so that you could convert both end to upper case:
function execute(stateName) {
query.where ="Upper(STATE_NAME) like '%" + stateName.toUpperCase() +"'%";
queryTask.execute(query,showResults);
}