I need to add a OR expression to a query depending on the values in a loop. So for example if I have three related records , how can I create two OR expressions to add to the definition expression, which each attribute value added to the OR expression? ThanksIt would be something like this, with each objectidstring being a different object id:var defexpr:String = "OBJECTID" + " like " + "'" + objectidstring + "'" " OR " + "OBJECTID" + " like " + "'" + objectidstring + "'" " OR " + "OBJECTID" + " like " + "'" + objectidstring + "'" 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);