Params: IMsModelParams;
The Params property returns the collection of metamodel parameters.
Executing the example requires that the repository contains a time series database with the FC_PARAM identifier. This database contains the COUNTRY attribute that refers to the dictionary. Modeling container of the database contains a metamodel with the META_MODEL identifier and a model with the MODEL identifier.
Sub Main;
Var
mb: IMetabase;
Catalog: IRubricator;
Transforms: IMetabaseObjectDescriptor;
MetaModel: IMsMetaModel;
MMParams: IMsModelParams;
Param: IMsModelParam;
Atts: IMetaAttributes;
Dict: IMetabaseObjectDescriptor;
ChainEntries: IMsCalculationChainEntries;
Cycle: IMsCalculationChainIterator;
dimInst: IDimInstance;
Model: IMsModel;
Begin
mb := MetabaseClass.Active;
Catalog := mb.ItemById("FC_PARAM").Bind As IRubricator;
Transforms := Catalog.ModelSpace;
MetaModel := mb.ItemByIdNamespace("METAMODEL", Transforms.Key).Edit As IMsMetaModel;
MMParams := MetaModel.Params;
MMParams.Clear;
Param := MMParams.Add;
Param.Name := "Country param";
Param.Id := "Country_Param";
Param.Hidden := True;
Param.DataType := DbDataType.Integer;
Atts := Catalog.Facts.Attributes;
Dict := Atts.FindById("COUNTRY").ValuesObject;
Param.LinkedObject := Dict;
ChainEntries := MetaModel.CalculationChain;
ChainEntries.Clear;
Cycle := ChainEntries.AddIterator("For");
Cycle.Parameter := Param;
dimInst := Dict.Open(Null) As IDimInstance;
Cycle.Selection := dimInst.CreateSelection;
Cycle.Selection.SelectAll;
Model := mb.ItemByIdNamespace("MODEL", Transforms.Key).Bind As IMsModel;
Cycle.Contents.AddModel(Model);
(MetaModel As IMetabaseObject).Save;
End Sub Main;
After executing the example the parameter that is a reference to the dictionary, is set for the metamodel. The metamodel calculation chain is made of the cycle that contains a model.
See also: