4

I'm attempting to use a definition query in order to display only a subset of data. I have a large CAD drawing that I have imported into my map. I do not need many of the lines from the .dwg file to be shown. I noticed that most of the CAD lines I did not want to display shared similarly named attributes. Some lines were "Poly-Line-1", some were "Poly-Line-3", "Poly-Line-A", so on and so forth. The query I attempted to use was the following:

"Attribute" <> 'Poly-Line-%' 

I was able to apply this statement, which seemed to indicate that it was syntactically correct. Unfortunately the file was not affected and each line was drawn as it had been before. I then tried:

"Attribute" <> 'Poly%' 

Again, it was treated as if the syntax was correct, but no change took place. As a workaround I ended up using a query similar to

"Attribute" NOT IN ('Poly-Line-1', 'Poly-Line-2', 'Poly-Line-3', etc) 

This was more efficient than something like

"Attribute" <> 'Poly-Line-1' AND "Attribute" <> 'Poly-Line-2' AND...

However it still took a while to list every thing I wanted.

I'm interested in any solutions that are more efficient than my final workaround and don't make use of ArcPy scripts. The problem I described is something I encounter at the workplace and I am mostly restricted to using the ArcMap GUI there.

6

You are using the wrong operator, It should work with :

"Attribute" NOT LIKE 'Poly-Line-%'

  • 1
    Thanks, I will try this out tomorrow. Why is the <> operator incorrect in this case? – socks Apr 5 '16 at 23:25
  • 5
    The <> along with the other mathematical operators can only be directly used on values. For example att <> 8 for integer data; or att <> "new" for string data. LIKE, IS and NOT are a recent addition that allow a more advanced SQL querying which you can use along with wildcards. As you know ArcGIS attribute table querying do not allow complex SQL queries (which can be circumvented if using arcpy). More info here – yanes Apr 5 '16 at 23:31
  • 1
    Excellent, thanks a lot. I have never used the LIKE operator so I'll look that up now. – socks Apr 5 '16 at 23:34
  • 1
    Just as an update: I needed to clean up another CAD file today and was able to use this solution. It worked exactly as expected, huge time saver. Thanks again yanes. – socks Apr 6 '16 at 18:44
  • 1
    How can I get this to work with a integer? I have a non-functional query of VAR NOT LIKE 18% where VAR is an integer and the values I'm trying to exclude are anything from 18 to 180000. – Alpheus May 15 '18 at 21:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.