Feature service QueryRelatedObjects method

Queries and returns the related features/objects that satisfy the criteria.

ServiceData QueryRelatedObjects(int SourceLayerOrTableID, int[] ObjectIDsInSource, int RelationshipID, string TargetDefinitionExpression, string TargetTableProps, bool GroupBySourceOIDs, SpatialReference OutSR, TimeReference OutTR, ServiceDataOptions ServiceDataOptions, string VersionName, double MaximumAllowableOffset)

Parameter

Description

SourceLayerOrTableID

The identifier of the source layer or table.

ObjectIDsInSource

The IDs of the features or objects for which related objects are being searched..

RelationshipID

The target layer/table ID.

TargetDefinitionExpression

Criteria to select features or objects from related selection.

TargetTableProps

Comma separated names of the properties to be returned in the result.

GroupBySourceOIDs

If true, the result has related objects sorted by source objects' IDs, else they are just an array of objects.

OutSR

The spatial reference in which to return the results.

OutTR

The time reference in which to return the results.

ServiceDataOptions

Specifies the format and transport types.

VersionName

Geodatabase version to query. This parameter applies only to feature services that expose geodatabases. If not specified, queries are made against the published map's version.

MaximumAllowableOffset

Specifies the maximum allowable offset to be used for generalizing geometries returned by the query operation. The MaximumAllowableOffset is in the units of the OutSR. If the OutSR is not specified, then MaximumAllowableOffset is assumed to be in the unit of the spatial reference of the map.

Return Value

Returns an object of ServiceData type. If GroupBySourceOIDs is false, the returned object contains an array of DataObject elements. If GroupBySourceOIDs is true, it contains an array of DataObjectGroup elements, which has related features or objects grouped by source features' ObjectIDs.

Remarks

Only the fields that are expressed in TargetTableProps are returned. Setting GroupBySourceOIDs to true returns the results group, but can take longer to process. If you do not need to set the spatial reference or the time reference set the parameters to null.

2/28/2020