Multiple Definition Queries on the same layer

07-08-2021 01:06 AM
New Contributor III

Hi all!

How can I create multiple definition queries on the same layer using Python? I only know how to set one definition query and make it active with the following expression:

lyr.definitionQuery = definitionQueryString

I want to create multiple queries, in order to be able to select them via the drop down menu available in the Data tab of ArcGIS Pro.

I read that this could be possible by applying changes in the CIM, but I couldn't make it work. 

Thank you in advance for your help!

0 Kudos
2 Replies
MVP Esteemed Contributor

multiple definition queries are supported but only one can be active at a time

Filter features with definition queries—ArcGIS Pro | Documentation

and setting/getting the query is done through CIM apparently

Layer—ArcGIS Pro | Documentation

not tried and I couldn't find any in their examples published for Pro 2.5

ArcGIS Pro 2.5 CIM Samples V1 - Overview

and I don't see more recent version for python on the code sharing site or their github

... sort of retired...
0 Kudos
New Contributor III

Thank you for your reply. Unfortunately, I have already read the contents of the first two URLs but I couldn't find the answer in there. I will start reading the scripts you sent one by one in case I can find the solution to my problem. Enjoy the rest of your day.

0 Kudos