IDimInstance.DefaultElement

Syntax

DefaultElement: Integer;

Description

The DefaultElement property returns the default text index.

Comments

If a default element is absent in the dictionary, the property returns -1.

Example

Executing the example requires that the repository contains a parametric table MDM dictionary with the RDS_DICT_OBJ identifier and a default element. The default element must be included into the elements selection, which attribute is equal to 2 and is bound to the parameter.

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

Sub UserProc;
Var
    MB: IMetabase;
    Obj: IMetabaseObject;
    Dict: IRdsDictionary;
    ParamsVal: IRdsParamValues;
    DictInst: IRdsDictionaryInstance;
    DimInst: IDimInstance;
Begin
    // Get current repository
    MB := MetabaseClass.Active;
    // Get table MDM dictionary
    Obj := MB.ItemById("RDS_DICT_OBJ").Bind;
    Dict := Obj As IRdsDictionary;
    // Set parameter value and open MDM dictionary taking into account value
    If Dict.Params.Count > 0 Then
        ParamsVal := Dict.Params.CreateValues;
        ParamsVal.Item(0).Value := "2";
        DictInst := Dict.Open(ParamsVal);
    Else
        DictInst := Dict.Open(Null);
    End If;
    DimInst := DictInst As IDimInstance;
    // Display element key value and default element key value
    Debug.WriteLine("Default element key:" + Dict.DefaultElementKey.ToString);
    Debug.WriteLine("Default element : " + DimInst.DefaultElement.ToString);
End Sub UserProc;

After executing the example the console window displays default element key and default element index.

See also:

IDimInstance