IMsCompositeFormulaTerm.UnitInfo

Fore Syntax

UnitInfo: IMsUnitInfo;

Fore.NET Syntax

UnitInfo: Prognoz.Platform.Interop.Ms.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.

UnitInfo returns the information that the units of measurement are not determined, in the following cases:

Fore Example

Executing the example requires that the repository contains a time series database with the FC identifier. Modeling container of this database contains a linear regression model (OLS) with the LINEAR identifier. Measurement 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 units of dimension: ");
        Elements := UnitInfo.UnitsDimension.Elements;
        Debug.WriteLine("  - measurement unit: " + Elements.Name(UnitInfo.Unit));
    Else
        Debug.WriteLine("Explanatory variables of model have different units of dimension: ");
        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("  - dimension unit: " + Elements.Name(UnitInfo.Unit));
            Else
                Debug.WriteLine("  - dimension unit is not determined");
            End If;
        End For;
    End If;
End Sub UserProc;

Example execution result: if all explanatory model variables have the same unit of measurement, information about this unit is displayed in the console window. If the explanatory variables have different units of measurement, the information about the unit of measurement is displayed for each variable.

See also:

IMsCompositeFormulaTerm