RelationshipQueryTask question
Is there a way to query a related table using the RelationshipQueryTask, but then allow those hits to be returned to the client with their related geometries? If anyone has a workflow that does this I would be interested in seeing it.
-
Hi Jim,
Do you mean the geometries that belong to the related results? The result of the Relationship Query Task is an Esri.ArcGIS.Client.Tasks.RelationshipResult, which contains a RelatedRecordsGroup. This group is an IDictionary, which contains an IEnumerable of Graphics for each ObjectID specified in the RelationshipQueryTask activity. So if your relationship is to another layer, you can access the geometries by looping through the results:
ForEach item in relationshipResult.RelatedRecordsGroup(objectID)
geometryOfRelatedRecord = item.geometry()
If you wanted to select all of the related records for a particular objectID, you could create a new feature set out of the IEnumerable of Graphics. For example:
featureSetForObjectID = New Esri.ArcGIS.Client.Tasks.FeatureSet(relationshipResult.RelatedRecordsGroup(objectID))
See the Esri API for more information:
-Victoria
0 -
Victoria,
Thanks for your reply. Yes, I am looking to have the ability to zoom to the geometries of features queried from a related table that takes part in a relationship.
I guess I need more specifics on which tasks/activities to call to implement your solution, as my workflow programming skills are pretty basic. I've attached the workflow as it works now. I get results showing in the results pane, but no ability to zoom to the point geometries.
Thanks,
Jim
(https://support.geocortex.com/Data/Sites/1/userfiles/773/childsearch.xaml) /Data/Sites/1/userfiles/773/childsearch.xaml
0 -
Hi Jim,
You can add a Set Map Extent activity to have the workflow zoom to the extent of the feature set that you retrieved in the GetFeatureSetExtent activity, or you can have it zoom directly to the first result using the syntax:
relatedFeatureSet.Features(0).Geometry.Extent()
You may need to buffer the geometry of the point to zoom to, and supply the extent of the buffer. Because a point is just an (x,y) coordinate, it is difficult to determine an appropriate scale to zoom to, as you would want to zoom in closer for a point that is a fire hydrant, than a point that is a city, for example.
For a result set, there is an option in the viewer.defaults.xml that you can copy into your site's viewer.xml, which lets you specify a list of scale ranges, and the viewer will zoom to the first range that is within the visible scale of that layer. For example:
<Map>
<Configuration DefaultPointFeatureZoomScale="10000,15000,25,000" />
</Map>I don't know if this will work for relationship result though, if the related table is not itself a layer in the site.
-Victoria
0 -
Thanks Victoria. I am now able to click on the result in the results pane and zoom to the related point.
On a related note, how do I pull these related records into a report. I'd like the parent record in the report, as well as all the child records. Is this done with a sub-report, or is there a way I can get to the result set without a sub-report?
Jim
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
4 Kommentare