Item(Index: Integer): IMsModelParamControl;
Index. Parameter index in the collection.
The Item method returns parameter from the collection by its index.
Executing the example requires that the repository contains a time series database with the FC_PARAM identifier. The database modeling container contains two metamodels with the METAMODEL and META_CONTROLLED identifiers.
Sub Main;
Var
mb: IMetabase;
Catalog: IRubricator;
Transforms: IMetabaseObjectDescriptor;
MetaModel_1, MetaModel_2: IMsMetaModel;
MMParams: IMsModelParams;
pMetaModelParam1, pMetaModelParam2: IMsModelParam;
MainChainEntries: IMsCalculationChainEntries;
pChain: IMsCalculationChainMetaModel;
ParamsControl: IMsModelParamsControl;
pControl: IMsModelParamControl;
Begin
mb := MetabaseClass.Active;
Catalog := mb.ItemById("FC_PARAM").Bind As IRubricator;
Transforms := Catalog.ModelSpace;
MetaModel_1 := mb.ItemByIdNamespace("METAMODEL", Transforms.Key).Edit As IMsMetaModel;
MMParams := MetaModel_1.Params;
MMParams.Clear;
pMetaModelParam1 := MMParams.Add;
pMetaModelParam1.Name := "Main param";
pMetaModelParam1.Id := "Main_Param";
pMetaModelParam1.Hidden := True;
pMetaModelParam1.DataType := DbDataType.Float;
pMetaModelParam1.DefaultValue := 0.36;
MainChainEntries := MetaModel_1.CalculationChain;
MainChainEntries.Clear;
MetaModel_2 := mb.ItemByIdNamespace("META_CONTROLLED", Transforms.Key).Edit As IMsMetaModel;
MMParams := MetaModel_2.Params;
MMParams.Clear;
pMetaModelParam2 := MMParams.Add;
pMetaModelParam2.Name := "Controlled param";
pMetaModelParam2.Id := "Controlled_param";
pMetaModelParam2.Hidden := True;
pMetaModelParam2.DataType := DbDataType.Integer;
pMetaModelParam2.DefaultValue := 1;
(MetaModel_2 As IMetabaseObject).Save;
pChain := MainChainEntries.AddMetaModel(MetaModel_2);
ParamsControl := pChain.ParamsControl;
pControl := ParamsControl.Item(0);
pControl.ControllingParam := pMetaModelParam1;
pControl.Value := 4;
(MetaModel_1 As IMetabaseObject).Save;
End Sub Main;
After executing the example the parameters are determined for metamodels. The META_CONTROLLED metamodel is included in the chain of the METAMODEL metamodel calculation. The controlled parameter of the calculation chain sets the METAMODEL metamodel parameter, the value is determined for it.
See also: