function onResult(relatedRecords:Object, token:Object = null):void { // get related records for the first feature var fset:FeatureSet = (relatedRecords[event.features[0].attributes.OBJECTID]); if (fset is FeatureSet) { relatedRecordsCount = fset.attributes.length; numberofrelatedrecords.text = relatedRecordsCount.toString() for (var i=0, il=fset.attributes.length; i<il; i++) { var objectidstring:String = String(fset.attributes.OBJECTID) Alert.show(objectidstring) } var defexpr:String = "OBJECTID" + " like " + "'" + objectidstring + "'"; var defexpr2:String = " OR " + "OBJECTID" + " like " + "'" + objectidstring + "'" yourTable.definitionExpression = defexpr Alert.show(defexpr) query.where = defexpr; query.objectIds=[]; query.returnGeometry = false; queryTask.executeForIds(query);
Solved! Go to Solution.
OBJECTID in (1,2,3,10,11,101)
function onResult(relatedRecords:Object, token:Object = null):void { var defexpr:String = "" // get related records for the first feature var fset:FeatureSet = (relatedRecords[event.features[0].attributes.OBJECTID]); if (fset is FeatureSet) { relatedRecordsCount = fset.attributes.length; numberofrelatedrecords.text = relatedRecordsCount.toString() for (var i=0, il=fset.attributes.length; i<il; i++) { //var objectidstring:String = String(fset.attributes.OBJECTID) //Alert.show(objectidstring) if (i == 0) { defexpr = "OBJECTID" + " =" + fset.attributes.OBJECTID } else { defexpr = defexpr + " or " + "OBJECTID" + " = " + fset.attributes.OBJECTID } } yourTable.definitionExpression = defexpr Alert.show(defexpr) query.where = defexpr; query.objectIds=[]; query.returnGeometry = false; queryTask.executeForIds(query); myAttributeTable.featureLayer = myFeatureLayer myAttributeTable.featureLayer = yourTable myAttributeTable.visible = true; yourTable.visible = true myAttributeTable.featureLayer = yourTable }