RelationshipQuery

require(["esri/tasks/support/RelationshipQuery"], function(RelationshipQuery) { /* code goes here */ });
Class: esri/tasks/support/RelationshipQuery
Inheritance: RelationshipQuery Accessor
Since: ArcGIS API for JavaScript 4.0

This class defines parameters for executing queries for related records from a layer. Once a RelationshipQuery object's properties are defined, it can then be passed into the QueryTask.executeRelationshipQuery() and FeatureLayer.queryRelatedFeatures() methods, which will return FeatureSets grouped by source layer/table objectIds.

See also:

Constructors

new RelationshipQuery(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
String

The name of the class.

more details
more detailsAccessor
String

The definition expression to be applied to the related table or layer.

more details
more detailsRelationshipQuery
String

Specify the geodatabase version to query.

more details
more detailsRelationshipQuery
Number

Specify the number of decimal places for the geometries returned by the query operation.

more details
more detailsRelationshipQuery
Date

The historic moment to query.

more details
more detailsRelationshipQuery
Number

The maximum allowable offset used for generalizing geometries returned by the query operation.

more details
more detailsRelationshipQuery
Number[]

An array of objectIds for the features in the layer/table being queried.

more details
more detailsRelationshipQuery
String[]

Attribute fields to include in the FeatureSet.

more details
more detailsRelationshipQuery
SpatialReference

The spatial reference for the returned geometry.

more details
more detailsRelationshipQuery
Number

The ID of the relationship to be queried.

more details
more detailsRelationshipQuery
Boolean

If true, each feature in the FeatureSet includes the geometry.

more details
more detailsRelationshipQuery

Property Details

declaredClassStringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

definitionExpressionString

The definition expression to be applied to the related table or layer. Only records in the list of objectIds that satisfy the definition expression are queried for related records.

gdbVersionString
Since: ArcGIS API for JavaScript 4.7

Specify the geodatabase version to query.

geometryPrecisionNumber

Specify the number of decimal places for the geometries returned by the query operation.

historicMomentDate
Since: ArcGIS API for JavaScript 4.7

The historic moment to query. This parameter applies only if the supportsHistoricMoment on FeatureLayer property of the layer is set to true.

maxAllowableOffsetNumber

The maximum allowable offset used for generalizing geometries returned by the query operation. The offset is in the units of outSpatialReference. If outSpatialReference is not defined, the spatialReference of the view is used.

objectIdsNumber[]

An array of objectIds for the features in the layer/table being queried.

outFieldsString[]

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

When specifying 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. However, your list of fields does not need to include these two fields.

Example:
query.outFields = [ "NAME", "STATE_ABBR", "POP04" ];
outSpatialReferenceSpatialReferenceautocast

The spatial reference for the returned geometry. If outSpatialReference is not defined, the spatialReference of the view is used.

relationshipIdNumber

The ID of the relationship to be queried. The ids for the relationships the table or layer participates in are listed in the ArcGIS Services directory. The ID of the relationship to be queried. The relationships that this layer/table participates in are included in the Feature Service Layer resource response. Records in tables/layers corresponding to the related table/layer of the relationship are queried.

returnGeometryBoolean

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.

Default Value:false

Method Overview

NameReturn TypeSummaryClass
RelationshipQuery

Creates a deep clone of RelationshipQuery object.

more details
more detailsRelationshipQuery
*

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform.

more details
more detailsRelationshipQuery
Object

Converts an instance of this class to its ArcGIS portal JSON representation.

more details
more detailsRelationshipQuery

Method Details

Since: ArcGIS API for JavaScript 4.7

Creates a deep clone of RelationshipQuery object.

Returns:
TypeDescription
RelationshipQueryA new instance of a RelationshipQuery object equal to the object used to call .clone().
fromJSON(json){*}static

Creates a new instance of this class and initializes it with values from a JSON object generated from a product in the ArcGIS platform. The object passed into the input json parameter often comes from a response to a query operation in the REST API or a toJSON() method from another ArcGIS product. See the Using fromJSON() topic in the Guide for details and examples of when and how to use this function.

Parameter:
json Object

A JSON representation of the instance in the ArcGIS format. See the ArcGIS REST API documentation for examples of the structure of various input JSON objects.

Returns:
TypeDescription
*Returns a new instance of this class.
toJSON(){Object}

Converts an instance of this class to its ArcGIS portal JSON representation. See the Using fromJSON() topic in the Guide for more information.

Returns:
TypeDescription
ObjectThe ArcGIS portal JSON representation of an instance of this class.

API Reference search results

NameTypeModule
Loading...