Class CalculationItem
- Inheritance
-
CalculationItem
- Implements
- Inherited Members
- Namespace
- TabularEditor.TOMWrapper
- Assembly
- TOMWrapper.dll
A Tabular Calculation Item.
public sealed class CalculationItem : TabularNamedObject, ICustomTypeDescriptor, INotifyPropertyChanging, IComparable, ITomErrorMessageObject, IDescriptionObject, IClonableObject, IDaxDependantObject, IExpressionObject, ITabularTableObject, ITabularNamedObject, ITabularObject, INotifyPropertyChanged, INamedObject
- Extension Methods
Remarks
This metadata object is only supported when the compatibility level of the database is at 1470 or above.
Properties
CalculationGroupTable
The CalculationGroupTable to which this calculation item belongs.
[Browsable(false)]
public CalculationGroupTable CalculationGroupTable { get; }
Property Value
Type | Description |
---|---|
CalculationGroupTable |
DependsOn
Gets the list of objects that this calculation item depends on.
[Browsable(false)]
public DependsOnList DependsOn { get; }
Property Value
Type | Description |
---|---|
DependsOnList |
Description
The description of the CalculationItem, visible to developers at design time and to administrators in management tools, such as SQL Server Management Studio.
public string Description { get; set; }
Property Value
Type | Description |
---|---|
string |
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 |
Expression
The DAX expression that is evaluated for this CalculationItem.
public string Expression { get; set; }
Property Value
Type | Description |
---|---|
string |
FormatStringExpression
A DAX expression that returns a Format String for this calculation item.
public string FormatStringExpression { get; set; }
Property Value
Type | Description |
---|---|
string |
Ordinal
The zero-based ordinal value associated with a Calculation Item.
public int Ordinal { get; set; }
Property Value
Type | Description |
---|---|
int |
Remarks
This property is only supported when the compatibility level of the database is at 1500 or above.
Parent
The parent Calculation Group of the current Calculation Item.
public CalculationGroup Parent { get; }
Property Value
Type | Description |
---|---|
CalculationGroup |
State
Provides information on the state of the Expression. Possible values and their interpretation are as follows. Ready (1) The Expression is queryable and has up-to-date data. SemanticError (5) The Expression has a semantic error. DependencyError (7) A dependency associated with this Expression is in an error state (SemanticError, EvaluationError, or DependencyError). SyntaxError (9) The Expression has a syntax error.
public ObjectState State { get; }
Property Value
Type | Description |
---|---|
ObjectState |
Methods
Clone(string, CalculationGroup)
Creates an exact copy of this CalculationItem object.
public CalculationItem Clone(string newName = null, CalculationGroup newParent = null)
Parameters
Type | Name | Description |
---|---|---|
string | newName | |
CalculationGroup | newParent |
Returns
Type | Description |
---|---|
CalculationItem |
CreateNew(CalculationGroup, string)
Creates a new CalculationItem and adds it to the parent CalculationGroup. Also creates the underlying metadataobject and adds it to the TOM tree.
public static CalculationItem CreateNew(CalculationGroup parent, string name = null)
Parameters
Type | Name | Description |
---|---|---|
CalculationGroup | parent | |
string | name |
Returns
Type | Description |
---|---|
CalculationItem |
OnPropertyChanged(string, object, object)
Fired after a property is changed
protected override void OnPropertyChanged(string propertyName, object oldValue, object newValue)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | |
object | oldValue | |
object | newValue |
OnPropertyChanging(string, object, ref bool, ref bool)
Called before a property is changed on an object. Derived classes can control how the change is handled. Throw ArgumentException within this method, to display an error message in the UI.
protected override void OnPropertyChanging(string propertyName, object newValue, ref bool undoable, ref bool cancel)
Parameters
Type | Name | Description |
---|---|---|
string | propertyName | Name of the changed property. |
object | newValue | New value assigned to the property. |
bool | undoable | Return false if automatic undo of the property change is not needed. |
bool | cancel | Return true if the property change should not apply. |
ShouldSerializeFormatStringExpression()
public bool ShouldSerializeFormatStringExpression()
Returns
Type | Description |
---|---|
bool |