IMsCalculationChainIterator.ParameterAsSelection

Syntax

ParameterAsSelection: IMsModelParam;

Description

The ParameterAsSelection property determines the parameter used as dictionary element selection.

Comments

The dictionary, the selection of which is set in the value of the parameter, is determined by the IMsModelParam.LinkedObject property. The selection transformed into the Variant type is determined by the IMsModelParamValue.Value property.

Example

Executing the example requires that the repository contains a time series database with the FC_COMM identifier. This database contains the time series attribute COUNTRY that refers to the dictionary. Modeling container of this database contains a model with the USER_MODEL identifier, a metamodel with the USER_META_MODEL identifier and a forecasting problem USER_PROBLEM that calculates this metamodel.

Sub Main;

Var

pMetabase: IMetabase;

pRubricator: IRubricator;

pAttributes: IMetaAttributes;

pFacts: IMetaDictionary;

pDict: IMetabaseObjectDescriptor;

pTransformDescr: IMetabaseObjectDescriptor;

pMetaModel: IMsMetaModel;

pParamSet: IMsModelParam;

pIter: IMsCalculationChainIterator;

pModel: IMsModel;

pTransform: IMsFormulaTransform;

pOutVar: IMsFormulaTransformVariable;

pSlice: IMsFormulaTransformSlice;

pParamDim: IMsParametrizedDimension;

pProb: IMsProblem;

pDimInstance: IDimInstance;

DimSelect: IDimSelection;

pSet: IMsProblemCalculationSettings;

pCalc: IMsProblemCalculation;

Begin

pMetabase := MetabaseClass.Active;

pRubricator := pMetabase.ItemById("FC_COMM").Bind As IRubricator;

// Receive the description of repository object, where the time series attribute COUNTRY is referred

pFacts := pRubricator.Facts;

pAttributes := pFacts.Attributes;

pDict := pAttributes.FindById("COUNTRY").ValuesObject;

pTransformDescr := pRubricator.ModelSpace;

// Add the parameter that is the multiply mark of the dictionary, to the metamodel cycle

pMetaModel := pMetabase.ItemByIdNamespace("USER_META_MODEL", pTransformDescr.Key).Edit As IMsMetaModel;

pMetaModel.Params.Clear;

pParamSet := pMetaModel.Params.Add;

pParamSet.DataType := DbDataType.Integer;

pParamSet.Name := "ValueSet";

pParamSet.Id := "PARAM_VALUESET";

pParamSet.LinkedObject := pDict;

pMetaModel.CalculationChain.Clear;

pIter := pMetaModel.CalculationChain.AddIterator("Iter");

pIter.ParameterAsSelection := pParamSet;

// Add the model to the metamodel cycle

pModel := pMetabase.ItemByIdNamespace("USER_MODEL", pTransformDescr.Key).Edit As IMsModel;

pIter.Contents.AddModel(pModel);

(pMetaModel As IMetabaseObject).Save;

// Make the first input variable of model depending from parameters value

pTransform := pModel.Transform;

pOutVar := pTransform.Inputs.Item(0);

pSlice := pOutVar.Slices.Item(0);

pParamDim := pSlice.ParametrizedDimensions.Item(0);

pParamDim.Parameter := pParamSet;

(pModel As IMetabaseObject).Save;

// Assign the mark of dictionary elements for parameter and calculate the model

pProb := pMetabase.ItemByIdNamespace("USER_PROBLEM", pTransformDescr.Key).Edit As IMsProblem;

pSet := pProb.CreateCalculationSettings;

pDimInstance := pDict.Open(Null) As IDimInstance;

DimSelect := pDimInstance.CreateSelection;

DimSelect.DeselectAll;

DimSelect.SelectElement(0, False);

DimSelect.SelectElement(1, False);

pSet.ParamValues.FindById("PARAM_VALUESET").Value := DimSelect.ToVariant;

pSet.FactIncluded := True;

pCalc := pProb.Calculate(pSet);

pCalc.Run;

End Sub Main;

After executing the example the cycle is created for metamodel calculation. At calculation iterations in the cycle are made by multiply selection that is set by parameter.

See also:

IMsCalculationChainIterator