5

I have created one script which set a defination query at certain location in script. I use lyr.definitionquery = "some expression"

After running the script i want to remove the definition query . But not getting any hint to do it.

  • 1
    It is the same lr.definitionQuery="" – FelixIP Aug 19 '16 at 10:12
  • I think definitionquery should be definitionQuery – PolyGeo Sep 5 '16 at 9:26
8

Just clear that property:

lyr.definitionQuery = None

None is the python for NULL, so making it = None will clear the query.

  • 2
    I always do it using "" – PolyGeo Aug 19 '16 at 10:29
  • Yes you can also do it using "" but I don't think it matters. I've developed a habit of using Nulls over empty strings, but either works. – Midavalo Aug 19 '16 at 10:51
2

I use an empty string to clear a definition query from a layer:

lyr.definitionQuery = ""

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.