<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Related Records Query in ArcGIS Runtime SDK for iOS Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398595#M3429</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great! Glad to know that you got what you wanted! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 18 May 2012 16:20:45 GMT</pubDate>
    <dc:creator>NimeshJarecha</dc:creator>
    <dc:date>2012-05-18T16:20:45Z</dc:date>
    <item>
      <title>Related Records Query</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398590#M3424</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am having trouble implementing AGSRelationshipQuery, I get a successful response, but the data returned id not what I expect and I am not sure if I am setting up my query the correct way. What I am trying to do is query related records from a point feature class (through a map service) that has a relationship set up with a table. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is code: (the names of the server and services have been changed to protect the innocent, and unfortunately, this server is not public so i can't point anybody to it)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;- (void)mapView:(AGSMapView *)mapView didClickCalloutAccessoryButtonForGraphic:(AGSGraphic *)graphic {

&amp;nbsp;&amp;nbsp;&amp;nbsp; self.queryTask = [AGSQueryTask queryTaskWithURL:[NSURL URLWithString:@"http://&amp;lt;myServer&amp;gt;/arcgis/rest/services/&amp;lt;myFolder&amp;gt;/&amp;lt;myService&amp;gt;/MapServer/0"]];
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.queryTask.delegate = self;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.relQuery = [AGSRelationshipQuery relationshipQuery];
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.relQuery.objectIds = [NSArray arrayWithObject:[graphic.attributes objectForKey:@"OBJECTID"]];
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.relQuery.outFields = [NSArray arrayWithObject :@"*"];
&amp;nbsp;&amp;nbsp;&amp;nbsp; self.relQuery.relationshipId = 0;

&amp;nbsp;&amp;nbsp;&amp;nbsp; [self.queryTask executeWithRelationshipQuery:self.relQuery];
{

- (void) queryTask:(AGSQueryTask *)queryTask operation:(NSOperation*)op didExecuteWithRelatedFeatures:(NSDictionary *)relatedFeatures {

&amp;nbsp;&amp;nbsp; NSLog(@"relatedFeatures: %@", relatedFeatures);

}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The response I get back from the NSLog on related Features is:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;relatedFeatures: (
&amp;nbsp;&amp;nbsp;&amp;nbsp; "AGSFeatureSet: display name: (null)
\ngeometry type: esriGeometryPoint
\nnum features: 1
\nspatial reference: (null)"
)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have confirmed the parameters in my query are valid using the rest/services web page, and there I get a json object that has the data I expect. But I am not sure what to make of the response I am getting through the iOS API. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have also tested the a regular http request using the direct URL for the REST query, and I do get back the proper response, &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSString *relatedQueryString = @"http://&amp;lt;myServer&amp;gt;/ArcGIS/rest/services/&amp;lt;myFolder&amp;gt;/&amp;lt;myService&amp;gt;/MapServer/0/queryRelatedRecords?objectIds=1&amp;amp;relationshipId=0&amp;amp;definitionExpression=&amp;amp;returnGeometry=false&amp;amp;maxAllowableOffset=&amp;amp;outSR=&amp;amp;outFields=*&amp;amp;f=pjson";
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSError *theError = nil; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:relatedQueryString]];
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSURLResponse *theResponse = [[NSURLResponse alloc] init];
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&amp;amp;theResponse error:&amp;amp;theError];
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSString *string = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
&amp;nbsp;&amp;nbsp;&amp;nbsp; NSDictionary *jsonDict = [string AGSJSONValue];

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;so I am figuring I am just not setting up the related request correctly. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 13:52:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398590#M3424</guid>
      <dc:creator>ChristopherEbright</dc:creator>
      <dc:date>2012-05-15T13:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: Related Records Query</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398591#M3425</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Are you sure that the graphic you're getting back in the &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;didClickCalloutAccessoryButtonForGraphic:&lt;/SPAN&gt;&lt;SPAN&gt; parameter has any related records?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For example, if you have multiple layers in your map, the graphic could belong to a completely different layer.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Just to rule out such problems, I would try running the query by hardcoding the objectid (instead of getting it from the graphic's attributes). If things still don't work, we can troubleshoot more.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 May 2012 21:54:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398591#M3425</guid>
      <dc:creator>DiveshGoyal</dc:creator>
      <dc:date>2012-05-15T21:54:25Z</dc:date>
    </item>
    <item>
      <title>Re: Related Records Query</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398592#M3426</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Good thought, but still did not work. I am logging the objectid and it is returning the correct one, and if i compare to a manual rest query, the related records are there.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 May 2012 13:13:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398592#M3426</guid>
      <dc:creator>ChristopherEbright</dc:creator>
      <dc:date>2012-05-16T13:13:09Z</dc:date>
    </item>
    <item>
      <title>Re: Related Records Query</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398593#M3427</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Chris,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Could you please print your result with this code and check? Also, in your query, please set self.relQuery.returnGeometry = TRUE if you want the geometry.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;for(NSString *aKey in relatedFeatures)
{
 NSLog(@"Key: %@ Value: %@", aKey, [relatedFeatures objectForKey:aKey]);
 AGSFeatureSet *featureSet = [relatedFeatures objectForKey:aKey];
&amp;nbsp;&amp;nbsp; 
 for (int i=0; i&amp;lt; [featureSet.features count]; i++) {
&amp;nbsp; AGSGraphic *graphic = [featureSet.features objectAtIndex:i];
&amp;nbsp; NSLog(@"graphic: %@",graphic);
 }
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:12:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398593#M3427</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2021-12-11T18:12:34Z</dc:date>
    </item>
    <item>
      <title>Re: Related Records Query</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398594#M3428</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here is what I got:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;2012-05-18 11:08:33.738 WPC_Mobile[7173:707] Key: 6675 Value: AGSFeatureSet: display name: (null)

geometry type: esriGeometryPoint

num features: 1

spatial reference: (null)
2012-05-18 11:08:33.741 WPC_Mobile[7173:707] graphic: geometry: (null), symbol: (null), attributes: {
&amp;nbsp;&amp;nbsp;&amp;nbsp; CompletionRecID = 10214;
}, visible: 1&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is what I was looking for. It looks like I failed to go into the FeatureSet.features and pull out the attributes from the graphic. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you very much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Chris&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:12:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398594#M3428</guid>
      <dc:creator>ChristopherEbright</dc:creator>
      <dc:date>2021-12-11T18:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: Related Records Query</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398595#M3429</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Great! Glad to know that you got what you wanted! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nimesh&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 May 2012 16:20:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-ios-questions/related-records-query/m-p/398595#M3429</guid>
      <dc:creator>NimeshJarecha</dc:creator>
      <dc:date>2012-05-18T16:20:45Z</dc:date>
    </item>
  </channel>
</rss>

