Select to view content in your preferred language

Problem with query expression when using a File geodatabase

1214
9
Jump to solution
01-18-2013 07:37 AM
ionarawilson1
Deactivated User
I have a web map app with a search tool with one text input for company's name, one dropdown menu for county and two drop down menus for industry and industry type. I previously had my geodatabase in a SDE environment but after upgrading to ArcGIS Server 10.1, I decided to use a file geodatabase because it is easier. However my query expressionf for the company is not working properly anymore.

Here is the code snippet:

 var expr:String = "";   if (qText.text != "") {  // for the text with apostrophe be recognized on the query qText.text = qText.text.replace("'","''") expr = "Company Like '%" + qText.text + "%' AND Status_not = ' '" ;   } 


So, do you guys have any idea in how to make this work again with a file geodatabase?

If I search for "tem", it does not bring me the companies that start with "Tem" anymore, just the ones that have tem somewhere in their name. If I search for Caesar's or Cae, it does not bring me the company with that name, but if I search for aes, it will bring that company and others that have aes somewhere in their name. Thank you for any help!!!
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Ionara,

   Simply use this:

expr = "Upper(Company) Like Upper('%" + qText.text + "%') AND Status_not = ''" ;

View solution in original post

0 Kudos
9 Replies
AnthonyGiles
Honored Contributor
Ionara,

I think the wildcard for file geodatabases is * not %, have you tried that,

Regards

Anthony
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Anthony,

   No the * is for Personal Geodatabases not File GDB. I am not sure what Ionara's issue is.
0 Kudos
ionarawilson1
Deactivated User
I found out the problem but still don't have a solution. It is because of case sensitivity. In my database I have names partly in Upper case like "AES Custom Woods" or "AGE Industries, Inc", and "NAPCO" (all in upper case" and also like this "Temple-Inland Forestry Company". How can I change the query to accomodate all the options? Thank you for any help!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ionara,

   Simply use this:

expr = "Upper(Company) Like Upper('%" + qText.text + "%') AND Status_not = ''" ;
0 Kudos
T__WayneWhitley
Honored Contributor
...a bit of a workaround, but for now you could replace your current exp with:

expr = "Company Like '%" + qText.text + "%' AND Status_not = ' ' OR Company Like '" + qText.text + "%' AND Status_not = ' ' OR Company Like '%" + qText.text + "' AND Status_not = ' '"

It's ugly, but will work I think.

EDIT:
Please disregard, didn't know it was due to case.
0 Kudos
ionarawilson1
Deactivated User
Robert, you are, as always, my hero!!! Thanks again!!! It works!!!

Thank you Wayne for trying but it does not solve the problem of the case sensitivity, thank you!
0 Kudos
ionarawilson1
Deactivated User
Robert,

By the way, why do we need the upper function in front of company?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ionara,

  You have to tell the SQL to capitalize the company field data and the users input to resolve the case sensitivity.
0 Kudos
ionarawilson1
Deactivated User
thank you Robert!
0 Kudos