1

Does anyone know if it is possible to achieve the effects of a wildcard match using data driven pages (DDP) in ArcMap?

For one of the tables that I want the DDP index value to match, the target field has a comma-separated list of values. As long as the DDP index value is in that list, I would like the table to filter in/out those rows.

For example, if the DDP index value is 'Y' and the corresponding field value in the other table is 'X,Y,Z', I would like that row to evaluated as matched. I've tried setting the DDP index values to include wildcard characters (*, %) but that has no affect.

The intended purpose of this is for real-time interaction in ArcMap, so I don't think a solution using arcpy would be helpful. However, if there is some other programming option that is relatively simple, I would be certainly be interested in that.

2
  • Question, to use your example - do you have more than one row that might contain 'Y', e.g. more than one record could evaluate as true using your wildcard?
    – RyNo's
    Jun 6, 2017 at 18:30
  • Yes, the table could have many rows with a value that should evaluate as true using the wildcard. Jun 6, 2017 at 19:02

2 Answers 2

2

I applied this label expression to layer called "NODES" (with values to test stored in text field "aField") in my table of content:

mxd = arcpy.mapping.MapDocument("CURRENT")
ddp = mxd.dataDrivenPages
thePagesLayer = arcpy.mapping.ListLayers(mxd,ddp.indexLayer.name)[0]
fld=ddp.pageNameField
ID=ddp.pageRow.getValue(fld.name); ID =r"'%"+ID+r"%'"
lyr=arcpy.mapping.ListLayers(mxd,"NODES")[0]
expr = arcpy.AddFieldDelimiters(lyr, "aField")
dq='%s LIKE %s' %(expr,ID)
lyr.definitionQuery=dq
def FindLabel ( [aField] ):
  return ""

and it works. So, in above expression you need to replace layer and field names, and check "label". Note I applied LIKE in the query.

Perhaps add

arcpy.RefreshActiveView()

before def, unless you Ok to hit F5 every time you change page

2
  • This is fantastic. Even with the arcpy.RefreshActiveView(), it still requires another refresh from within the data frame, at least using ArcMap 10.3.1. Even still, it does 99.9% of the job. Thanks! Jun 7, 2017 at 15:00
  • Mark it as solved please
    – FelixIP
    Jun 7, 2017 at 19:30
0

I don't think there is a way to do this in ArcMap through the interface. I was experimenting. I think you'll have to write a python script and use arcpy. For each page you'll have to change the definition query of the other table to match the index page name. Something like this where the index layer name is an attribute called 'NAME' and the attribute name in the related table is 'VALUE'

if layer.name == "whatever":
  layer.definitionQuery = '"VALUE" = ' + "'" + mxd.dataDrivenPages.pageRow.NAME + "'" 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.