IMsCalculationChainEntries.FindByCoord

Syntax

FindByCoord(Stub: IVariableStub; Selection: IDimSelectionSet): IMsModelSet;

Parameters

Stub. Data source.

Selection. Selection of elements that create a data source point.

Description

The FindByCoord method searches for calculation chain elements using the specified data source point.

Comments

If none of calculation chain elements uses the specified point, the method returns the empty collection.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. A repository cube is used as a data source for the container. The container should also have a metamodel with the METAMODEL identifier and some models included in metamodel calculation chain.

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

Sub UserProc;
Var
    Mb: IMetabase;
    ModelSpaceDescr: IMetabaseObjectDescriptor;
    Stub: IVariableStub;
    MetaModel: IMsMetaModel;
    DimSSFact: IDimSelectionSetFactory;
    DimSS: IDimSelectionSet;
    DimS: IDimSelection;
    Models: IMsModelSet;
    Model: IMsModel;
    i, c: Integer;
Begin
    Mb := MetabaseClass.Active;
    // Get modeling container, its data source and metamodel
    ModelSpaceDescr := Mb.ItemById("CONT_MODEL");
    Stub := (ModelSpaceDescr.Bind As IMsModelSpace).DefaultObject.Bind As IVariableStub;
    MetaModel := Mb.ItemByIdNamespace("METAMODEL", ModelSpaceDescr.Key).Edit As IMsMetaModel;
    // Create a selection to create a coordinate
    DimSSFact := New DimSelectionSetFactory.Create;
    DimSS := DimSSFact.CreateDimSelectionSet;
    c := Stub.DimensionCount;
    For i := 0 To c - 1 Do
        DimS := DimSS.Add((Stub.Dimension(i) As IMetabaseObject).Open(NullAs IDimInstance);
        DimS.SelectElement(0False);
    End For;
    // Search for models that use the obtained point
    Models := MetaModel.CalculationChain.FindByCoord(Stub, DimSS);
    c := Models.Count;
    Debug.WriteLine("Models found: " + c.ToString);
    Debug.Indent;
    For i := 0 To c - 1 Do
        Model := Models.Item(i);
        Debug.WriteLine(Model.Name + '(' + Model.Id + "). Model type: " + Model.Transform.Kind.ToString);
    End For;
    Debug.Unindent;
End Sub UserProc;

After executing the example, a point in the modeling container data source is created based on the dimension selection. After this the models included in the metamodel and using the specified point will be searched. The list of found models will be displayed in the development environment console.

See also:

IMsCalculationChainEntries