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.

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Aug 19, 2016 at 10:04
2
  • 1
    It is the same lr.definitionQuery="" Commented Aug 19, 2016 at 10:12
  • I think definitionquery should be definitionQuery Commented Sep 5, 2016 at 9:26

2 Answers 2

8

Just clear that property:

lyr.definitionQuery = None

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

answered Aug 19, 2016 at 10:12
2
  • 2
    I always do it using "" Commented Aug 19, 2016 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. Commented Aug 19, 2016 at 10:51
2

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

lyr.definitionQuery = ""
answered Sep 5, 2016 at 9:25

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.