Select to view content in your preferred language

Can anybody help me on this problem.....

2448
4
07-29-2013 12:40 AM
4 Replies
BenFousek
Deactivated User
Getting related table data requires a separate call to the server.

You'll can use esri.request() https://developers.arcgis.com/en/javascript/jsapi/namespace_esri.html#request OR use a feature layer which has the queryRelatedFeatures method https://developers.arcgis.com/en/javascript/jsapi/featurelayer.html#queryrelatedfeatures.
0 Kudos
RahulGupta1
Emerging Contributor
Hi Ben, thanks for reply. I have relate some non-spatial tables and i didn't add those table in MXD. so how will put the relatedTableId.
Shall i have to add all these table into MXD ?

Please can u explain me how it is working..

Thanks & Regards
Rahul gupta
0 Kudos
BenFousek
Deactivated User
It's pretty simple. Just add the related table to the map document and publish as a map service. The table will be available to query as will the ability to query related records.
0 Kudos
RahulGupta1
Emerging Contributor
Hi Ben , I want to give definitionExpression in relatedQuery because I want to retrieve records for which the GridID field value is 1 (for example)
So i have write some code like

var relatedQuery = new esri.tasks.RelationshipQuery();
relatedQuery.outFields = ["*"];
relatedQuery.relationshipId = 4;
relatedQuery.definitionExpression = "GridId=1";
graphic._graphicsLayer.queryRelatedFeatures(relatedQuery, function (relatedRecords) {
debugger } });//This function is not getting call..


Any suggestion ?
0 Kudos