Select to view content in your preferred language

DEFINITION QUERY NOT WORKING

228
2
11-15-2024 05:57 AM
WeronikaBąkowska
New Contributor

Hello, i have weird problem
this is my code

import arcpy

aprx = arcpy.mp.ArcGISProject("CURRENT")

maps = aprx.listMaps("Layers4")

if maps:
m = maps[0]

for lyr in m.listLayers("Land Boundary"):
if lyr.supports("DEFINITIONQUERY"):
lyr.definitionQuery = "Flurstueck = 1237"

and it creates Definition query in my layer properly 

WeronikaBkowska_1-1731678944567.png

sadly it doesnt work on itself and i have to manually click apply otherwise map disappears and is white.
I assume its bug, please help

additional info:
even tho definition query is created, i get info

WeronikaBkowska_0-1731918440822.png

ArcGis Pro versions that i tired with 3.0.2 and 3.4

 

 

0 Kudos
2 Replies
WeronikaBąkowska
New Contributor

Additionally if i tried to deactivate the query right after its created to try to switch it on again and hoping it would solve problem, but after adding this line to code
lyr.updateDefinitionQueries(
[{'name': 'Query 1',
'isActive': False}])

program simply crushes and closes 😞

0 Kudos
JesseCloutier
Esri Community Manager

Hi @WeronikaBąkowska, we appreciate you sharing a potential bug with the broader Esri Community; however, Esri does not actively track software defects posted here. The official channel for investigating and validating bugs is Esri Technical Support. All customers experiencing a potential software bug should leverage technical support to report and investigate the issue.

By reporting bugs through technical support, Esri can better track the scope and impact of the issue across all our customers and better prioritize it with our product teams. Our teams can also investigate the issue more thoroughly to see if there is a solution, workaround, or patch to get you back up and running as soon as possible.

As a reminder, Esri Community is primarily a self-service support platform where Esri users can ask or answer each other’s questions, share feature requests, and collaborate to solve problems with GIS.

*Note that this is a scripted message prompted when posts allude to a potential product bug.

Jesse Cloutier
Community Manager, Engagement & Content
0 Kudos