IDimInstance.DefaultElement

Syntax

DefaultElement: Integer;

DefaultElement: uinteger;

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 key values for element and default element
    Debug.WriteLine("Default element key:" + Dict.DefaultElementKey.ToString);
    Debug.WriteLine(
"Default element : " + DimInst.DefaultElement.ToString);
End Sub UserProc;

Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Rds;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Obj: IMetabaseObject;
    Dict: IRdsDictionary;
    ParamsVal: IRdsParamValues;
    DictInst: IRdsDictionaryInstance;
    DimInst: IDimInstance;
Begin
    
// Get current repository
    MB := Params.Metabase;
    
// 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 key values for element and default element
    System.Diagnostics.Debug.WriteLine("Default element key:" + Dict.DefaultElementKey.ToString());
    System.Diagnostics.Debug.WriteLine(
"Default element : " + DimInst.DefaultElement.ToString());
End Sub;

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

See also:

IDimInstance