I have an ArcGIS toolbox script that applies a user-defined definition query to multiple layers within the current MXD.
The only user variable currently required is the definition query itself, which I have listed as an "SQL expression". The script works fine, but it would be nice if the SQL validation box on the toolbox GUI was populated with the details of the first layer in the MXD, allowing the user to construct and validate a definition query against the first layer.
How can I achieve this using a hard-coded variable pointing to the first layer in the TOC?
It's fairly straightforward in a one-to-one scenario, by asking the user to input the feature layer as a parameter and then making the SQL expression parameter "Obtained from", but I can't figure out how to do it by defining it myself.