Table of Contents

Class Relationship

Inheritance
Relationship
Implements
Derived
Inherited Members
Namespace
TabularEditor.TOMWrapper
Assembly
TOMWrapper.dll

Represents a logical relationship between two Table objects. It is a child of a Model object.

public abstract class Relationship : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, ITabularNamedObject, INamedObject, IComparable, IAnnotationObject, IExtendedPropertyObject, ITabularObject, INotifyPropertyChanged, ITomErrorMessageObject
Extension Methods

Properties

Annotations

The collection of Annotations on the current Relationship.

[Browsable(true)]
public AnnotationCollection Annotations { get; }

Property Value

Type Description
AnnotationCollection

CrossFilteringBehavior

Indicates how relationships influence filtering of data. The enumeration defines the possible behaviors. Possible values are as follows. OneDirection (1) The rows selected in the 'To' end of the relationship will automatically filter scans of the table in the 'From' end of the relationship. BothDirections (2) Filters on either end of the relationship will automatically filter the other table. Automatic (3) The engine will analyze the relationships and choose one of the behaviors by using heuristics.

public CrossFilteringBehavior CrossFilteringBehavior { get; set; }

Property Value

Type Description
CrossFilteringBehavior

ErrorMessage

A string that explains the error state associated with the current object. It is set by the engine only when the state of the object is one of these three values: SemanticError, DependencyError, or EvaluationError. It is applicable only to columns of the type Calculated or CalculatedTableColumn. It will be empty for other column objects.

public string ErrorMessage { get; }

Property Value

Type Description
string

ExtendedProperties

The collection of Extended Properties on the current Relationship.

public ExtendedPropertyCollection ExtendedProperties { get; }

Property Value

Type Description
ExtendedPropertyCollection

FromTable

Gets the starting table in a directional table relationship.

public Table FromTable { get; }

Property Value

Type Description
Table

IsActive

A boolean value 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.

public bool IsActive { get; set; }

Property Value

Type Description
bool

JoinOnDateBehavior

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.

public DateTimeRelationshipBehavior JoinOnDateBehavior { get; set; }

Property Value

Type Description
DateTimeRelationshipBehavior

Parent

The parent Model of the current Relationship.

public Model Parent { get; }

Property Value

Type Description
Model

RelyOnReferentialIntegrity

Unused; reserved for future use.

public bool RelyOnReferentialIntegrity { get; set; }

Property Value

Type Description
bool

SecurityFilteringBehavior

Indicates how relationships influence filtering of data when evaluating row-level security expressions. Possible values are as follows. OneDirection (1): The rows selected in the 'To' end of the relationship will automatically filter scans of the table in the 'From' end of the relationship. BothDirections (2): Filters on either end of the relationship will automatically filter the other table.

public SecurityFilteringBehavior SecurityFilteringBehavior { get; set; }

Property Value

Type Description
SecurityFilteringBehavior

State

Provides information on the state of the relationship. 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 relationships. 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 relationships. SyntaxError (9) Not applicable to relationships.

public ObjectState State { get; }

Property Value

Type Description
ObjectState

ToTable

Gets the destination table in a directional table relationship.

public Table ToTable { get; }

Property Value

Type Description
Table

Type

The type of Relationship. At present, the only possible value is SingleColumn (1) or a normal column-column relationship.

public RelationshipType Type { get; }

Property Value

Type Description
RelationshipType

UsedInVariations

Enumerates the Variation objects in which this relationship is used.

[Browsable(false)]
public IEnumerable<Variation> UsedInVariations { get; }

Property Value

Type Description
IEnumerable<Variation>

Methods

CanEditName()

protected override bool CanEditName()

Returns

Type Description
bool

ClearAnnotations()

Removes all annotations from this object.

public void ClearAnnotations()

ClearExtendedProperties()

Removes all Extended Properties from this object.

public void ClearExtendedProperties()

GetAnnotation(int)

Gets the value of the annotation with the given index, assuming it exists.

public string GetAnnotation(int index)

Parameters

Type Name Description
int index

Returns

Type Description
string

GetAnnotation(string)

Gets the value of the annotation with the given name. Returns null if no such annotation exists.

public string GetAnnotation(string name)

Parameters

Type Name Description
string name

Returns

Type Description
string

GetAnnotations()

Gets a collection of all annotation names on the current Relationship.

public IEnumerable<string> GetAnnotations()

Returns

Type Description
IEnumerable<string>

GetAnnotationsCount()

Gets the number of annotations on the current Relationship.

public int GetAnnotationsCount()

Returns

Type Description
int

GetExtendedProperties()

Gets a collection of all ExtendedProperty names on the current object.

public IEnumerable<string> GetExtendedProperties()

Returns

Type Description
IEnumerable<string>

GetExtendedProperty(int)

Gets the value of the ExtendedProperty with the given index, assuming it exists.

public string GetExtendedProperty(int index)

Parameters

Type Name Description
int index

Returns

Type Description
string

GetExtendedProperty(string)

Gets the value of the ExtendedProperty with the given name. Returns null if no such ExtendedProperty exists.

public string GetExtendedProperty(string name)

Parameters

Type Name Description
string name

Returns

Type Description
string

GetExtendedPropertyCount()

Gets the number of ExtendedProperties on the current object.

public int GetExtendedPropertyCount()

Returns

Type Description
int

GetExtendedPropertyType(int)

Gets the type of the ExtendedProperty with the given index, assuming it exists.

public ExtendedPropertyType GetExtendedPropertyType(int index)

Parameters

Type Name Description
int index

Returns

Type Description
ExtendedPropertyType

GetExtendedPropertyType(string)

Gets the type of the ExtendedProperty with the given name, assuming it exists.

public ExtendedPropertyType GetExtendedPropertyType(string name)

Parameters

Type Name Description
string name

Returns

Type Description
ExtendedPropertyType

GetNewAnnotationName()

Returns a unique name for a new annotation.

public string GetNewAnnotationName()

Returns

Type Description
string

GetNewExtendedPropertyName()

Returns a unique name for a new ExtendedProperty.

public string GetNewExtendedPropertyName()

Returns

Type Description
string

HasAnnotation(string)

Returns true if an annotation with the given name exists. Otherwise false.

public bool HasAnnotation(string name)

Parameters

Type Name Description
string name

Returns

Type Description
bool

HasExtendedProperty(string)

Returns true if an ExtendedProperty with the given name exists. Otherwise false.

public bool HasExtendedProperty(string name)

Parameters

Type Name Description
string name

Returns

Type Description
bool

RemoveAnnotation(string)

Remove an annotation by the given name.

public void RemoveAnnotation(string name)

Parameters

Type Name Description
string name

RemoveExtendedProperty(string)

Remove an ExtendedProperty by the given name.

public void RemoveExtendedProperty(string name)

Parameters

Type Name Description
string name

SetAnnotation(int, string)

Sets the value of the annotation with the given index, assuming it exists.

public void SetAnnotation(int index, string value)

Parameters

Type Name Description
int index
string value

SetAnnotation(string, string)

Sets the value of the annotation having the given name. If no such annotation exists, it will be created. If value is set to null, the annotation will be removed.

public void SetAnnotation(string name, string value)

Parameters

Type Name Description
string name
string value

SetExtendedProperty(int, string, ExtendedPropertyType)

Sets the value of the ExtendedProperty with the given index, optionally specifiying the type (string or JSON) of the ExtendedProperty.

public void SetExtendedProperty(int index, string value, ExtendedPropertyType type)

Parameters

Type Name Description
int index
string value
ExtendedPropertyType type

SetExtendedProperty(string, string, ExtendedPropertyType)

Sets the value of the ExtendedProperty having the given name. If no such ExtendedProperty exists, it will be created. If value is set to null, the ExtendedProperty will be removed.

public void SetExtendedProperty(string name, string value, ExtendedPropertyType type)

Parameters

Type Name Description
string name
string value
ExtendedPropertyType type