AnsweredAssumed Answered

Get the attributes of a RelationshipQuery result

Question asked by Sara_EL_MALKI on May 10, 2017
Latest reply on May 11, 2017 by Sara_EL_MALKI

that's my code :

 

incidentLayer.on("click", function(evt) {
graphicAttributes = evt.graphic.attributes;
var relatedQuery = new RelationshipQuery();
relatedQuery.outFields = ["nom","code","tel"];
relatedQuery.relationshipId = 14;
relatedQuery.objectIds = [graphicAttributes.objectid];
incidentLayer.queryRelatedFeatures(relatedQuery, function(relatedRecords) {
var fset = relatedRecords[graphicAttributes.objectid];
var count = (fset) ? fset.features.length : 0;
//THE COUNT GIVES ME "1"
// I HAVE TRIED 
//alert("fset.features.attributes.nom"+fset.features.attributes.nom);
//console.log("relatedRecords[graphicAttributes.nom]"+relatedRecords[graphicAttributes.NOM]);
//console.log("relatedRecords[graphicAttributes.code]"+relatedRecords[graphicAttributes.CODE]); 
console.log(relatedRecords[graphicAttributes.objectid].features.attributes["code"]);
//BUT IT DOES NOT WORK !!
});
});

 

I wanna get the attributes' Code' and 'Name' of the result 

Outcomes