Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/workers
Class: RelationshipQuery

require(["esri/tasks/RelationshipQuery"], function(RelationshipQuery) { /* code goes here */ });

Description

(Added at v2.0)
Define query parameters for the feature layer's queryRelatedFeatures method.

Samples

Search for samples that use this class.

Constructors

NameSummary
new RelationshipQuery()Creates a new RelationshipQuery object.

Properties

NameTypeSummary
definitionExpressionStringThe definition expression to be applied to the related table or layer.
geometryPrecisionNumberSpecify the number of decimal places for the geometries returned by the query operation.
maxAllowableOffsetNumberThe maximum allowable offset used for generalizing geometries returned by the query operation.
objectIdsNumber[]A comma delimited list of ObjectIds for the features in the layer/table that you want to query.
outFieldsString[]Attribute fields to include in the FeatureSet.
outSpatialReferenceSpatialReferenceThe spatial reference for the returned geometry.
relationshipIdNumberThe ID of the relationship to test.
returnGeometryBooleanIf "true", each feature in the FeatureSet includes the geometry.
Constructor Details

new RelationshipQuery()

Creates a new RelationshipQuery object.
Property Details

<String> definitionExpression

The definition expression to be applied to the related table or layer. Only records that fit the definition expression and are in the list of ObjectIds will be returned.

<Number> geometryPrecision

Specify the number of decimal places for the geometries returned by the query operation. (Added at v3.0)
Sample:

query.geometryPrecision = 1;

<Number> maxAllowableOffset

The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of the spatialReference. If a spatialReference is not defined the spatial reference of the map is used.

<Number[]> objectIds

A comma delimited list of ObjectIds for the features in the layer/table that you want to query.
Sample:

relatedQuery.objectIds = [100,120,140];

<String[]> outFields

Attribute fields to include in the FeatureSet. Fields must exist in the map layer. You must list the actual field names rather than the alias names. Returned fields are also the actual field names. However, you are able to use the alias names when you display the results. You can set field alias names in the map document.

When you specify the output fields, you should limit the fields to only those you expect to use in the query or the results. The fewer fields you include, the faster the response will be.

Each query must have access to the Shape and ObjectId fields for a layer, but your list of fields does not need to include these two fields.
Sample:

relatedQuery.outFields = ["*"];

<SpatialReference> outSpatialReference

The spatial reference for the returned geometry. If not specified, the geometry is returned in the spatial reference of the map. See Projected Coordinate Systems and Geographic Coordinate Systems for the list of supported spatial references.

<Number> relationshipId

The ID of the relationship to test. The ids for the relationships the table or layer participates in are listed in the ArcGIS Services directory.
Sample:

relatedQuery.relationshipId = 3;

<Boolean> returnGeometry

If "true", each feature in the FeatureSet includes the geometry. Set to "false" (default) if you do not plan to include highlighted features on a map since the geometry makes up a significant portion of the response.
Known values: true | false