Can I define multiple definition queries for a single layer using python?

942
2
08-07-2020 05:27 AM
TobiSellekaerts
New Contributor III

I am familiar with using python to get and/or set a (single) definition query for a map layer. 

However, in Pro you can specify multiple different definition queries for a single layer (although only one, or none, can be active at any given time).  When I use the definitionQuery property of the layer object, I can get, or set, the currently active query.

But I would like to be able to create lots of different definition Queries for a given layer using python (and then get / set them using python as well).  Is there a way to do this that I'm missing?

We are getting around this at the moment by using python to create query expression (EXP) files and then importing them all in one go using the GUI.

0 Kudos
2 Replies
JoshuaBixby
MVP Esteemed Contributor

See my response in https://community.esri.com/thread/241459-arcgis-pro-modifying-layer-definition-query-via-arcpy .  It is possible, you just need to use the CIM components.

PantelisKaniouras
New Contributor

I am sorry, but I didn't figure out how to create multiple queries on the same layer by reading your comment 😞 

0 Kudos