function execute(stateName) { query.text = stateName; queryTask.execute(query,showResults); }
How would you write this if you wanted to query using a second attribute as well?
query.where ="STATE_NAME like '%" + stateName.toUpperCase() +"'% AND SECOND_ATTRIBUTE like %" + secondValue.toUpperCase() + "%"
Just to add to this - using Upper() in the query seems to slow it down dramatically.I found it much faster to convert the values to uppercase in the geodatabase (in an edit session within ArcMap), and simply use: query.where ="STATE_NAME like '%" + stateName.toUpperCase() +"'%"; Steve
query.where ="STATE_NAME like '%" + stateName.toUpperCase() +"'%";
query.where ="Upper(STATE_NAME) like '%" + stateName.toUpperCase() +"'%";
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
function execute(stateName) { query.where ="Upper(STATE_NAME) like '%" + stateName.toUpperCase() +"'%"; queryTask.execute(query,showResults); }
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.