Iterate down one data source, filtering another panel based on the contents of one of the fields
To install this script, navigate to the Adobe InDesign Application Directory and paste the script file into the following folder ‘Scripts -> Scripts Panel’. The script can then be run from the Scripts panel; this is found in ‘Window -> Utilities -> Scripts’.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | var bodyDSName = "ENTER NAME OF DATASOURCE TO EXTRACT FIELD CONTENTS FROM"; var calloutDSName = "ENTER NAME OF DATASOURCE TO FILTER"; var fieldContentName = "ENTER THE NAME OF THE FIELD TO EXTRACT CONTENTS FROM"; var filterField = "ENTER THE NAME OF THE FIELD YOU WISH TO FILTER"; var filterOperator = "ENTER THE OPERATOR FOR THE FILTER"; //i.e "=" ">" "<" "<>" var myEasyCatalog = app.easycatalogObject; var bodyDS = app.easycatalogObject.datasources.item(bodyDSName); var calloutDS = app.easycatalogObject.datasources.item(calloutDSName); var bodyDV = bodyDS.dataviews.item(bodyDSName); var calloutDV = calloutDS.dataviews.item(calloutDSName); for (i = 0; i < bodyDV.records.count(); ++i) { var record = bodyDV.records.item(i); $.writeln(record.fields.item(fieldContentName).fieldContent); calloutDV.subsetOf(filterField, filterOperator, record.fields.item(fieldContentName).fieldContent, true); } |