Selecting Default Dictionary Element

Examples of setting a default element in the dictionary and selection of this element in the express report that uses the dictionary as one of the dimensions are given in the Fore language.

Executing the examples requires that the repository contains an MDM dictionary with the RDS_DICT_OBJ identifier. A selection scheme is added for the dictionary. The dictionary is a standard cube dimension, on which express report with the EAX_OBJ identifier is built.

After executing the example a default element is set for the dictionary, and one element that is a default element is selected on opening the express report in this dimension.

Example

Add links to the Dimensions, Express, Metabase, Pivot, Rds system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Express: IEaxAnalyzer;
    Selection: IDimSelection;
    PreSchema: IPredefinedSelectionSchema;
    Obj: IMetabaseObject;
    Dict: IRdsDictionary;
Begin
    
// Get current repository
    MB := MetabaseClass.Active;
    
// Get MDM dictionary
    Obj := MB.ItemById("RDS_DICT_OBJ").Edit;
    Dict := Obj 
As IRdsDictionary;
    
// Set default element key in dictionary
    Dict.DefaultElementKey := 11;
    
// Get express report
    Express := MB.ItemById("EAX_OBJ").Edit As IEaxAnalyzer;
    
// Get selection of the dimension, which contains default element
    Selection := Express.Pivot.Selection.Item(1);
    
// Get predetermined dimension selection scheme
    PreSchema := Selection.PredefinedSchema;
    
If (PreSchema <> NullThen
        PreSchema.Clear;
        PreSchema.Add(SelectionPrimitiveType.DefaultElement);
        
// Use predetermined dimension selection scheme
        PreSchema.Active := True;
    
End If;
    (Express 
As IMetabaseObject).Save;
End Sub userproc;

See also:

Examples | IRdsDictionary