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 COUNTRY indicators attribute that refers to the dictionary. The modeling container of the database contains a model with the USER_MODEL identifier, a metamodel with the USER_META_MODEL identifier and the USER_PROBLEM forecasting problem that calculates this metamodel.

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

Sub UserProc;
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;
    // Get description of the repository object, to which the COUNTRY indicator attribute refers
    pFacts := pRubricator.Facts;
    pAttributes := pFacts.Attributes;
    pDict := pAttributes.FindById("COUNTRY").ValuesObject;
    pTransformDescr := pRubricator.ModelSpace;
    // Add a parameter that is dictionary multiple selection to 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 a model to metamodel cycle
    pModel := pMetabase.ItemByIdNamespace("USER_MODEL",pTransformDescr.Key).Edit As IMsModel;
    pIter.Contents.AddModel(pModel);
    (pMetaModel As IMetabaseObject).Save;
    // Make the first model input variable dependent on parameter 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;
    // Set dictionary element selection for parameter and calculate model
    pProb := pMetabase.ItemByIdNamespace("USER_PROBLEM",pTransformDescr.Key).Edit As IMsProblem;
    pSet := pProb.CreateCalculationSettings;
    pDimInstance := pDict.Open(NullAs IDimInstance;
    DimSelect := pDimInstance.CreateSelection;
    DimSelect.DeselectAll;
    DimSelect.SelectElement(0False);
    DimSelect.SelectElement(1False);
    pSet.ParamValues.FindById("PARAM_VALUESET").Value:= DimSelect.ToVariant;
    pSet.FactIncluded := True;
    pCalc := pProb.Calculate(pSet);
    pCalc.Run;
End Sub;

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

See also:

IMsCalculationChainIterator