IMsDimIteratorAdvancedFilter.TestInternal

Syntax

TestInternal(Element: Integer, ParamValues: IMsModelParamValues): Boolean;

Parameters

Element. Tested dictionary element.

ParamValues. Metamodel parameters.

Description

The TestInternal method checks if element corresponds to advanced filter taking into account specified values of parameters of metamodel.

Comments

Available values:

The method is relevant if the advanced filter condition depends on metamodel parameters.

Example

Executing the example requires that the repository contains modeling container with the CONT_MODEL identifier that contains a modeling problem with the PROBLEM identifier and a metamodel. The metamodel should have parameter, multidimensional cycle set in the calculation chain and the advanced filtering condition on setting up dimensions of the multidimensional cycle.

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

Sub UserProc;
Var
    Mb: IMetabase;
    MsKey, i: Integer;
    MetaModel: IMsMetaModel;
    MParams: IMsModelParams;
    Chain: IMsCalculationChainEntries;
    Problem: IMsProblem;
    Iterator: IMsCalculationChainMultiDimIterator;
    IterDim: IMsDimIteratorDimension;
    AdvancedFilter: IMsDimIteratorAdvancedFilter;
    CalcSettings: IMsProblemCalculationSettings;
    ParamValues: IMsModelParamValues;
    Param: IMsModelParamValue;
    Dim: IDimInstance;
Begin
    
// Get the current repository
    Mb := MetabaseClass.Active;
    
// Get modeling container key
    MsKey := Mb.GetObjectKeyById("CONT_MODEL");
    
// Get modeling problem
    Problem := Mb.ItemByIdNamespace("PROBLEM", MsKey).Edit As IMsProblem;
    
// Get metamodel
    MetaModel := Problem.MetaModel;
    
// Get metamodel parameters
    MParams := MetaModel.Params;
    
// Get metamodel calculation chain
    Chain := MetaModel.CalculationChain;
    
// Get multidimensional cycle in calculation chain
    Iterator := Chain.Item(0As IMsCalculationChainMultiDimIterator;
    
// Get the first dimension
    IterDim := Iterator.Dimensions.Item(0);
    
// Get advanced filter for dimension
    AdvancedFilter := IterDim.Filter.AdvancedFilter;
    
// Get problem calculation parameters
    CalcSettings := Problem.CreateCalculationSettings;
    ParamValues := CalcSettings.ParamValues;
    
// Get data of the dictionary that is used to determine first parameter value
    Param := ParamValues.Item(0);
    Dim := Param.LinkedObject.Open(
NullAs IDimInstance;
    
// Check if dictionary elements correspond to advanced filter condition 
    For i := 0 To Dim.Elements.Count - 1 Do
        
If AdvancedFilter.TestInternal(i, ParamValues) Then
            Debug.WriteLine(String.Format(
                
"Element with the {0} index of the '{1}' dimension corresponds to advanced filter condition", i, Dim.Name));
        
Else
            Debug.WriteLine(String.Format(
                
"Element with the {0} index of the '{1}' dimension does not correspond to advanced filter condition", i, Dim.Name));
        
End If;
    
End For;
End Sub UserProc;

After executing the example the console displays the result of checking dictionary elements that correspond or do not correspond to advanced filter condition, for example:

Element with the 0 index of the 'Dictionary' dimension does not correspond to advanced filter condition

Element with the 1 index of the 'Dictionary' dimension does not correspond to advanced filter condition

Element with the 2 index of the 'Dictionary' dimension corresponds to advanced filter condition

Element with the 3 index of the 'Dictionary' dimension corresponds to advanced filter condition

See also:

IMsDimIteratorAdvancedFilter