AnsweredAssumed Answered

How do I pass multiple ObjectIds as Number[] delimited list to execute a relationship query

Question asked by databolic on Feb 27, 2018
Latest reply on Feb 27, 2018 by databolic

I'm trying to make a relationship query with the returned object ids from a previous query but having trouble passing multiple IDs 

 

var query = new Query(); 
query.returnGeometry = false;
query.outFields = ["OBJECTID"];
query.where = requestTerm;

myQueryTask.execute(query, function(results) {

    if (results.features.length > 0) {
        var ids = [];
        for (var i = 0; i < results.features.length; i++){
            ids(Number(results.features[i].attributes.OBJECTID));
        }

        query = new RelationshipQuery();
        query.returnGeometry = false;
        query.outFields = ["OBJECTID"];
        query.objectIds = [ids];
        query.relationshipId = 1;
        myQueryTask.executeRelationshipQuery(query, function(set) {
            // ....
        }
    }
}

 

I also tried to set the IDs with

ids(new Number(results.features[i].attributes.OBJECTID));

 

 as well as directly, but nothing seems to work.

query.objectIds = [304,305,306];

// and casted

query.objectIds = [Number(304),Number(305)];

but nothing seems to right. 

 

Any suggestions or is there an example with multiple ObjectIds?

Outcomes