共用方式為


2.2.5.7 Relationship Object

The Relationship object represents a logical relationship between two Table objects. It is a child of a Model object.

The Relationship object has the following properties.

Name

Type

Description

ID

unsignedLong

A reference to the object.

ModelID

unsignedLong

An ID-based reference to a Model object.

Name

string

The name of the object.

IsActive

boolean

A Boolean that indicates whether the relationship is marked as Active or Inactive. An Active relationship is automatically used for filtering across tables. An Inactive relationship can be used explicitly by DAX calculations with the USERELATIONSHIP function.

Type

enumeration

The type of Relationship. At present, the only possible value is as follows:

  • SingleColumn (1) - Normal column-column relationship.

CrossFilteringBehavior

enumeration

Indicates how relationships influence filtering of data. The enumeration defines the possible behaviors. The possible values are as follows:

  • OneDirection (1) - The rows selected in the "To" end of the relationship automatically filter scans of the table in the "From" end of the relationship.

  • BothDirections (2) - Filters on either end of the relationship; automatically filters the other table.

  • Automatic (3) - The engine analyzes the relationships and chooses one of the behaviors by using heuristics.

JoinOnDateBehavior

enumeration

When joining two date time columns, indicates whether to join on date and time parts or on date part only:

  • DateAndTime (1) - When joining two date time columns, join on date and time parts.

  • DatePartOnly (2) - When joining two date time columns, join on date part only.

RelyOnReferentialIntegrity

boolean

Unused; reserved for future use.

FromTableID

unsignedLong

An ID-based reference to a table at the "From" end of the relationship.

FromColumnID

unsignedLong

An ID-based reference to a column at the "From" end of the relationship.

FromCardinality

enumeration

Indicates whether the "From" end of the relationship has a cardinality of One (1) or Many (2).

ToTableID

unsignedLong

An ID-based reference to a table at the "To" end of the relationship.

ToColumnID

unsignedLong

An ID-based reference to a column at the "To" end of the relationship.

ToCardinality

enumeration

Indicates whether the "To" end of the relationship has a cardinality of One (1) or Many (2).<47>

State

enumeration

A value that provides information about the state of the relationship. The possible values and their interpretation are as follows:

  • Ready (1) – The relationship is queryable and has up-to-date data.

  • NoData (3) – Not applicable to Relationship.

  • CalculationNeeded (4) – The relationship does not contain any data because it was not refreshed. There is no error associated with the relationship.

  • SemanticError (5) - Not applicable to Relationship.

  • EvaluationError (6) - Not applicable to Relationship.

  • DependencyError (7) – A dependency associated with this relationship is in an error state (SemanticError, EvaluationError, or DependencyError).

  • Incomplete (8) - Not applicable to Relationship.

  • SyntaxError (9) - Not applicable to Relationship.

RelationshipStorageID

unsignedLong

An ID-based reference to a RelationshipStorage object. The RelationshipStorage object is reserved for internal use only.

RelationshipStorage2ID

unsignedLong

An ID-based reference to a second RelationshipStorage object.

ModifiedTime

dateTime

The time that the object was last modified.

RefreshedTime

dateTime

The time that the object was last refreshed.

SecurityFilteringBehavior

enumeration

Indicates how relationships influence filtering of data when evaluating row-level security expressions. The possible values are as follows:

  • OneDirection (1) – The rows selected in the "To" end of the relationship automatically filter scans of the table in the "From" end of the relationship.

  • BothDirections (2) – Filters on either end of the relationship automatically filter the other table.

  • None (3) – No filtering occurs from either end of the relationship. Compatibility level 1600 or higher is required.<48>