relationshipQuery not executing - returns TypeError

683
1
Jump to solution
11-26-2012 01:30 PM
AndrewBrown1
Occasional Contributor II
Hello,

I'm trying to execute a relationshipQuery against a featureLayer. I narrowed the featureLayer down to one point that I know has data within the related database view (I can see the data within the Identify Tool in ArcMap).

Anyhow, once my code executes the queryRelatedFeatures, it throws an error code using the onError event for the featureLayer:

TypeError: Object 1564 has no method 'join'


1564 being the OBJECTID of my single point.

Also, just to note, the featureLayer has a defined definitionQuery to limit it to this one point.

var joined = objectID.toString(); //contains a list of OBJECTIDs. There is only one right now         nonDetectsLayer.setDefinitionExpression("OBJECTID IN (" + joined + ")");         var relatedQuery = new esri.tasks.RelationshipQuery();         relatedQuery.outFields = ["*"];         relatedQuery.relationshipId = 0;         relatedQuery.objectIds = joined;         nonDetectsLayer.queryRelatedFeatures(relatedQuery, function (relatedRecords) {             console.log("related recs: ", relatedRecords);             if (!relatedRecords.hasOwnProperty(features[0].attributes.OBJECTID)) {                 console.log("No related records for ObjectID: ", objectID);             } //if         }); //queryRelatedFeatures


Has anybody had any experience with this? Any help?

Thanks,
Andrew
0 Kudos
1 Solution

Accepted Solutions
AndrewBrown1
Occasional Contributor II
I figured it out on my own. Apparently, I was sending the property ObjectIDs a string instead of an array, which is required.
"joined" is a comma-delimited string of objectIDs, so what I need to do is send it the array of objectIDs:

var joined = objectID.toString(); //contains a list of OBJECTIDs. There is only one right now         nonDetectsLayer.setDefinitionExpression("OBJECTID IN (" + joined + ")");         var relatedQuery = new esri.tasks.RelationshipQuery();         relatedQuery.outFields = ["*"];         relatedQuery.relationshipId = 0;         relatedQuery.objectIds = objectID;

View solution in original post

0 Kudos
1 Reply
AndrewBrown1
Occasional Contributor II
I figured it out on my own. Apparently, I was sending the property ObjectIDs a string instead of an array, which is required.
"joined" is a comma-delimited string of objectIDs, so what I need to do is send it the array of objectIDs:

var joined = objectID.toString(); //contains a list of OBJECTIDs. There is only one right now         nonDetectsLayer.setDefinitionExpression("OBJECTID IN (" + joined + ")");         var relatedQuery = new esri.tasks.RelationshipQuery();         relatedQuery.outFields = ["*"];         relatedQuery.relationshipId = 0;         relatedQuery.objectIds = objectID;
0 Kudos