IMsCompositeFormulaTerm.UnitInfo

Syntax

UnitInfo: IMsUnitInfo;

Description

The UnitInfo property returns information about term measurement units.

Comments

Measurement units are used in terms based on data of a time series database.

The property returns information that measurement units are not determined, in the following cases:

Example

Executing the example requires that the repository contains a time series database with the FC identifier. The modeling container of this database contains a linear regression model (OLS estimation) with the LINEAR identifier. The units dictionary is not a mandatory attribute of the time series database.

Add links to the Cubes, Dimensions, Metabase, Ms system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    Cat: IRubricator;
    MsDesc: IMetabaseObjectDescriptor;
    Model: IMsModel;
    Formula: IMsFormula;
    Linear: IMsLinearRegressionTransform;
    i: Integer;
    Explanatories: IMsCompositeFormulaTermList;
    UnitInfo: IMsUnitInfo;
    Elements: IDimElements;
    Term: IMsCompositeFormulaTerm;
Begin
    Mb := MetabaseClass.Active;
    Cat := Mb.ItemById("FC").Bind As IRubricator;
    MsDesc := Cat.ModelSpace;
    Model := mb.ItemByIdNamespace("LINEAR", MsDesc.Key).Bind As IMsModel;
    Formula := Model.Transform.FormulaItem(0);
    Linear := Formula.Method As IMsLinearRegressionTransform;
    Explanatories := Linear.Explanatories;
    UnitInfo := Explanatories.UnitInfo;
    If UnitInfo.Unit <> -1 Then
        Debug.WriteLine("All explanatory variables of model have similar measurement units: ");
        Elements := UnitInfo.UnitsDimension.Elements;
        Debug.WriteLine("  - measurement unit: " + Elements.Name(UnitInfo.Unit));
    Else
        Debug.WriteLine("Explanatory variables of model have different measurement units: ");
        For i := 0 To Explanatories.Count - 1 Do
            Term := Explanatories.Item(i);
            Debug.WriteLine("  " + Term.ExpressionText);
            UnitInfo := Term.UnitInfo;
            If UnitInfo.Unit <> -1 Then
                Elements := UnitInfo.UnitsDimension.Elements;
                Debug.WriteLine("  - measurement unit: " + Elements.Name(UnitInfo.Unit));
            Else
                Debug.WriteLine("  - measurement unit is not determined");
            End If;
        End For;
    End If;
End Sub UserProc;

After executing the example, if all explanatory variables of model have the same measurement unit, information about this unit is displayed in the console window. If explanatory variables have different measurement units, the information about the measurement unit is displayed for each variable.

See also:

IMsCompositeFormulaTerm