Skip to content
import Relationship from "@arcgis/core/layers/support/Relationship.js";
Inheritance:
RelationshipAccessor
Since
ArcGIS Maps SDK for JavaScript 4.7

Describes a layer's relationship with another layer or table. These relationships are listed in the ArcGIS Services directory as described in the REST API documentation.

See also

Constructors

Constructor

Constructor
Parameters
ParameterTypeDescriptionRequired
properties
See the properties table for a list of all the properties that may be passed into the constructor.

Properties

Any properties can be set, retrieved or listened to. See the Watch for changes topic.

cardinality

Property
Type
Cardinality

The cardinality which specifies the number of objects in the origin FeatureLayer related to the number of objects in the destination FeatureLayer. Please see the Desktop help for additional information on cardinality.

catalogId

Property
Type
string | null | undefined
Since
ArcGIS Maps SDK for JavaScript 4.32

The globally unique identifier for the relationship. This property is only available on non-hosted feature services (referencing Enterprise geodatabases).

composite

Property
Type
boolean
Since
ArcGIS Maps SDK for JavaScript 4.16

Indicates whether the relationship is composite. In a composite relationship, a destination object cannot exist independently of its origin object.

declaredClass

readonlyinherited Property
Type
string
Inherited from: Accessor

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

id

Property
Type
number

The unique ID for the relationship. These ids for the relationships the FeatureLayer participates in are listed in the ArcGIS Services directory.

keyField

Property
Type
string

The field used to establish the relate within the FeatureLayer.

keyFieldInRelationshipTable

Property
Type
string
Since
ArcGIS Maps SDK for JavaScript 4.16

The key field in an attributed relationship class table that matches the keyField. This is returned only for attributed relationships.

name

Property
Type
string | null | undefined

The name of the relationship.

relatedTableId

Property
Type
number

The unique ID of the related FeatureLayer.

relationshipTableId

Property
Type
number
Since
ArcGIS Maps SDK for JavaScript 4.16

The relationship table id.

role

Property
Type
Role
Since
ArcGIS Maps SDK for JavaScript 4.16

Indicates whether the table participating in the relationship is the origin or destination table.

Methods

MethodSignatureClass
fromJSON
inherited static
fromJSON(json: any): any
clone
inherited
clone(): this
toJSON
inherited
toJSON(): any

fromJSON

inheritedstatic Method
Signature
fromJSON (json: any): any
Inherited from: JSONSupportMixin

Creates a new instance of this class and initializes it with values from a JSON object generated from an ArcGIS product. 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.

Parameters
ParameterTypeDescriptionRequired
json
any

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
any

Returns a new instance of this class.

clone

inherited Method
Signature
clone (): this
Inherited from: ClonableMixin

Creates a deep clone of this object. Any properties that store values by reference will be assigned copies of the referenced values on the cloned instance.

Returns
this

A deep clone of the class instance that invoked this method.

toJSON

inherited Method
Signature
toJSON (): any
Inherited from: JSONSupportMixin

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

Returns
any

The ArcGIS portal JSON representation of an instance of this class.

Type definitions

Cardinality

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0
Type
"one-to-one" | "one-to-many" | "many-to-many"

Role

Type definition
Since
ArcGIS Maps SDK for JavaScript 5.0
Type
"origin" | "destination"