ITsModelParam.LinkedObject

Syntax

LinkedObject: IMetabaseObjectDescriptor;

Description

The LinkedObject property determines the dictionary that is used to determine a parameter value.

Comments

To determine a parameter type, use the ITsModelParam.ParamType property.

Example

Executing the example requires that the repository contains a time series database with the TSDB identifier containing a mandatory series attribute with the CITY identifier. This attribute is a reference to the dictionary. An internal modeling container of time series database must contain a metamodel with the METAMODEL identifier. This metamodel must contain only a model based on attributes of the TSDB time series database in the calculation chain.

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

Sub MetaModelParams;
Var
    mb: IMetabase;
    TSDB: IRubricator;
    Ms: IMetabaseObjectDescriptor;
    MetaModel: IMsMetaModel;
    Params: ITsModelParams;
    Param: ITsModelParam;
    Atts: IMetaAttributes;
    Dict: IMetabaseObjectDescriptor;
    DimInst: IDimInstance;
    Model: IMsModel;
    Slices: IMsFormulaTransformSlices;
    ParamDim: IMsParametrizedDimension;
Begin
    mb := MetabaseClass.Active;
    // Get time series database
    TSDB := mb.ItemById("TSDB").Bind As IRubricator;
    // Get time series attributes
    Atts := TSDB.Facts.Attributes;
    // Get dictionary that determines values of the CITY attribute
    Dict := Atts.FindById("CITY").ValuesObject;
    DimInst := Dict.Open(NullAs IDimInstance;
    // Get internal modeling container
    Ms := TSDB.ModelSpace;
    // Get metamodel
    MetaModel := mb.ItemByIdNamespace("METAMODEL", Ms.Key).Edit As IMsMetaModel;
    // Get metamodel parameters collection 
    Params := MetaModel.Params As ITsModelParams;
    // Clear collection
    Params.Clear;
    // Add a parameter
    Param := Params.Add;
    // Determine parameter settings
    Param.Name := "City";
    Param.Id := "CITY_PARAM";
    Param.Hidden := False;
    Param.DataType := DbDataType.Integer;
    // Set dictionary, which values are used as parameter values
    Param.LinkedObject := Dict;
    // Set default value
    Param.DefaultValue := DimInst.Elements.Elements.Element(0);
    // Specify dictionary attribute that will be used to restore selection
    Param.SelectionAttrID := "KEY";
    // Save metamodel 
    (MetaModel As IMetabaseObject).Save;
    // Get first model in metamodel calculation chain
    Model := (MetaModel.CalculationChain.Item(0As IMsCalculationChainModel).EditModel;
    // Get output variable slice
    Slices := Model.Transform.Outputs.Item(0).Slices;
    // Set attribute parameter that determines values of the CITY attribute
    ParamDim := Slices.Item(0).ParametrizedDimensions.FindById(Dict.Id);
    ParamDim.Parameter := Param As IMsModelParam;
    // Save changes made in model
    (Model As IMetabaseObject).Save;
End Sub MetaModelParams;

After executing the example the parameter is added to the METAMODEL metamodel, values of this parameter are determined by elements of the dictionary used by the CITY series attribute. The parameter has the default value. This parameter will be used in the model contained in the METAMODEL metamodel to set value of the CITY attribute of the output variable.

See also:

ITsModelParam