IMsBranchConditionInGroup.ElementGroup

Syntax

ElementGroup: IDimElementGroup;

Description

The ElementGroup property determines a group of elements.

Example

Executing the example requires that the repository contains a modeling container with the CONT_MODEL identifier. This container must include a metamodel with the METAMODEL identifier and models with the DEFAULT, MODEL_1 and MODEL_2 identifiers. The repository must also have a dictionary with the D_SOURCE identifier that contains a group of elements with the DICT_GROUP identifier.

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

Sub UserProc;
Var
    pMetaModel: IMsMetaModel;
    pBranch: IMsCalculationChainBranch;
    pBranchConditions: IMsBranchConditions;
    pCase: IMsBranchCase;
    pCaseList: IMsBranchCaseList;
    Chain, pDefaultContents:IMsCalculationChainEntries;
    pCondSelect: IMsBranchConditionInSelection;
    pCondGroup: IMsBranchConditionInGroup;
    pCondScalar: IMsBranchConditionScalar;
    Case_1, Case_2, Case_default:IMsModel;
    mb: IMetabase;
    pModelSpace: IMetabaseObjectDescriptor;
    param:IMsModelParam;
    pDimInstance: IDimInstance;
    pSelection: IDimSelection;
    params:IMsModelParams;
Begin
    mb := MetabaseClass.Active;
    pModelSpace := mb.ItemById("CONT_MODEL");
    pMetaModel := mb.ItemByIdNamespace("METAMODEL",pModelSpace.Key).Edit As IMsMetaModel;
    Chain := pMetaModel.CalculationChain;
    Chain.Clear;
    // Set metamodel parameter
    params:=pMetaModel.Params;
    params.Clear;
    param:=params.Add;
    param.DataType := DbDataType.Integer;
    param.DefaultValue :=1;
    param.Hidden := True;
    param.Id := "T_ID";
    param.Name := "ID";
    param.LinkedObject :=mb.ItemById("D_SOURCE");
    // Create a condition node
    pBranch := Chain.AddBranch("Branch");
    pBranch.Parameter :=Param;
    pDefaultContents := pBranch.DefaultContents;
    Case_default := mb.ItemByIdNamespace("DEFAULT",pModelSpace.Key).Bind As IMsModel;
    pDefaultContents.AddModel(Case_default);
    // Create the first condition branch
    pCaseList := pBranch.CaseList;
    pCase := pCaseList.Add;
    Case_1 := mb.ItemByIdNamespace("MODEL_1",pModelSpace.Key).Bind As IMsModel;
    pCase.Contents.AddModel(Case_1);
    pBranchConditions :=pCase.Conditions;
    pCondScalar := pBranchConditions.Add(MsBranchConditionType.Scalar) As IMsBranchConditionScalar;
    pCondScalar.ComparisonOperator:= MsBranchConditionComparisonOperator.Equal;
    pCondScalar.Value :=6;
    pCondGroup := pBranchConditions.Add(MsBranchConditionType.InGroup) As IMsBranchConditionInGroup;
    pDimInstance := mb.ItemById("D_SOURCE").Open(NullAs IDimInstance;
    pCondGroup.ElementGroup:= mb.ItemByIdNamespace("DICT_GROUP", pDimInstance.Key).Bind As IDimElementGroup;
    pCondGroup.Negation := False;
    pCondGroup.ConditionJoin:= OrmLogicalOperator.Or_;
    // Create the second condition branch
    pCase := pCaseList.Add;
    Case_2 := mb.ItemByIdNamespace("MODEL_2",pModelSpace.Key).Bind As IMsModel;
    pCase.Contents.AddModel(Case_2);
    pBranchConditions :=pCase.Conditions;
    pCondSelect := pBranchConditions.Add(MsBranchConditionType.InSelection) As IMsBranchConditionInSelection;
    pSelection := pDimInstance.CreateSelection;
    pSelection.DeselectAll;
    pSelection.SelectElement(2False);
    pCondSelect.Negation:= False;
    pCondSelect.Selection:= pSelection;
    (pMetaModel As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, the parameter that refers to the dictionary, and the condition that is based on value of the given parameter, is set for metamodel. The condition is the following:

See also:

IMsBranchConditionInGroup