IMsProblemCalculation.MetaAttributeFilter

Syntax

MetaAttributeFilter: IMsMetaAttributeFilter;

Description

The MetaAttributeFilter property return the object that contains filter applied on modeling problem calculation.

Comments

By default empty filter is applied.

Example

Executing the example requires that the repository includes a modeling container with the MS identifier including a modeling problem with the PROBLEM_METAFILTER identifier.. The time series database, which is data source for the modeling container, must contain the CITY series attribute that refers to the dictionary.

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

Sub UserProc;
Var
    MB: IMetabase;
    Descr: IMetabaseObjectDescriptor;
    Problem: IMsProblem;
    CalcSettings: IMsProblemCalculationSettings;
    Calculation: IMsProblemCalculation;
    Ruby: IRubricator;
    MetaAttr: IMetaAttribute;
    MetaVals: IMsMetaAttributeValues;
    Dict: IMetabaseObject;
    DI: IDimInstance;
    Sel: IDimSelection;
Begin
    // Get current repository
    MB := MetabaseClass.Active;
    // Get modeling container
    Descr := MB.ItemById("MS");
    // Get modeling problem
    Problem := MB.ItemByIdNamespace("PROBLEM_METAFILTER", Descr.Key).Edit As IMsProblem;
    // Create problem calculation settings
    CalcSettings := Problem.CreateCalculationSettings;
    // Determine that calculation will be made by the Fact scenario
    CalcSettings.FactIncluded := True;
    // Create an object for problem calculation
    Calculation := Problem.Calculate(CalcSettings);
    // Get time series database which is data source for modeling container
    Ruby := (Descr.Bind As IMsModelSpace).DefaultObject.Bind As IRubricator;
    // Get attribute of the CITY series
    MetaAttr := Ruby.Facts.Attributes.FindById("CITY");
    // Add filtering by this attribute
    MetaVals := Calculation.MetaAttributeFilter.Add(MetaAttr);
    // Create selection of the CITY attribute
    Dict := MetaAttr.ValuesObject.Bind;
    DI := Dict.Open(NullAs IDimInstance;
    Sel := DI.CreateSelection;
    Sel.SelectElement(0False);
    // Determine selection to the filter
    MetaVals.Selection := Sel;
    // Perform calculation
    Calculation.Run;
    // Save changes in modeling task
    (Problem As IMetabaseObject).Save;
End Sub UserProc;

After executing the example filtering is set and calculation is executed for modeling problem.

See also:

IMsProblemCalculation