Selection to Definition Query

9983
40
11-15-2013 07:46 AM
Status: Under Consideration
Labels (1)
PatrickMoulden
Occasional Contributor

Add a tool (w/ gui preferably) to get the attribute values for a set of selected features and use them in an interactive definition query dialog box which would allow the user to select which attributes to use for the querry and how to use them.  If this is set up in gui it could also be used to visually analyse for trends within the selected data.

40 Comments
KoryKramer

@wayfaringrob The workflow you described is creating a selection using an attribute query, supposedly using Select by Attributes? So you end up with a selection in the data exploration process. 

"The very next thing I do is go create a definition query that's either the same, inverse of, or similar to my selection query." 

Are you saying that this present idea of converting a selection to a definition query would not satisfy what you're looking for?

i.e. you just want a quick way of taking a query that you've constructed using Select by Attributes, and without making a selection, just take the query and push it into a definition query?

KoryKramer_0-1681423139060.png

The comments through this idea have to do both with interactive selections (no attribute query) as well as selections made using attribute queries. The latter, which is what I understand you to be requesting, should be easier and more robust as I understand it from the development side, whereas the former (an interactive selection not based on a structured query) would have more challenges. Either way, we'd be considering both when looking at this idea. 

I can check back in with the dev team on this, but in the meantime, please provide further clarification about why you feel your new idea is distinct from this existing idea. 

Thank you

wayfaringrob

@KoryKramer  yes -- looking for a quick way to take a query I made there, perhaps modify it a little, and use it as a definition query, regardless of what's selected. E.g. -- I take road data, and do a couple select bys on a road type field to see which values are driveways and alleys. I might want those excluded, so saving the expression as a definition query with the opportunity to change "=" to "<>" would be helpful, without copying & pasting the sql and heading to the layer properties > definition query tab to set it up. The way you're saying might be understandably trickier technically -- to have the software just invent a query (or something like it) from a selection -- probably would not suffice for reasons you probably are thinking of, too -- what field would that even use? would it be smart enough to find one? would it add a field and populate it with something shared? how would it handle new data? would it just use ObjectID? etc etc -- maybe the solution to some of that problem is just making selection layers more like definition queries where you can have multiple & turn them on and off. So for those reasons I think these are very different ideas but if you are considering them together then do what you gotta do, and thanks.

Number1point0

Be able to create a filter based on the selected features. For example, I'm looking at a layer that labels several polygons, but I only want a few choice ones visible. I use the select tool to select the features I don't want to see, and a filter is created to filter out those selected. This would allow for dynamic filtering based on visuals, as supposed to knowing the attributes to filter on.

TanuHoque
Status changed to: Under Consideration
 
Bud
by

 

I know this was mentioned previously, but I’ll say it again for clarity:

I am hoping to have the option of the query referencing a user-defined unique ID field, not just the ObjectID. For example, the tool would be able to take the selected features and output this definition query: 

asset_id in (1,2,3)


Related:

Bud
by
SeaRM
by

XTools Pro 23.1 has Definition Query Switcher that contains Create definition query from selection feature. Try to use it.

SeaRM_0-1705891370343.png

 

Bud
by

@TanuHoque 

If the proposed tool can be used to create a definition query on fields other than the OBJECTID, I wonder how that would work. Would you want to only allow fields that have unique values? Such as fields with a unique database database index? Or maybe a field that is known to be unique due to a relationship class? (I don't use relationship classes, so I don't know)

Otherwise, if the tool were used on a non-unique field, then I don't know how a definition query could be built for the selected features.

It is important to me that the tool can be used on my user-defined ASSET_ID fields. They have unique database indexes, so I'm hoping this tool will work for them.

Bud
by

@TanuHoque and anyone else who's interested:

I have a working Selection to Definition query GP tool here: https://community.esri.com/t5/python-ideas/refer-to-a-specific-contents-layer-even-when-there/idi-p/...

You can either download the Python scripts and create a GP tool yourself. Or download the .zip and simply add the tool to a project.
There is currently an issue in community posts that is preventing me from attaching the .atbx file, so that's why I had to use a .zip: https://community.esri.com/t5/community-ideas/allow-attaching-a-mobile-geodatabase-as-a-file-in/idc-...

I also included a list of requirements in the first link. You might find this requirement interesting: The tool will only generate a definition query using fields that have a unique attribute index.

Hopefully, that gives you an idea of what we're looking for. The tool works and is very handy. But of course, an OOTB tool in the UI would be better.

TanuHoque

thanks @Bud . that is very helpful