Show contents 

Dimensions > Dimensions Assembly Interfaces > ICustomDimOrders > ICustomDimOrders.FindByKey

ICustomDimOrders.FindByKey

Syntax

FindByKey(AttributeKey: Integer): ICustomDimOrder;

Parameters

AttributeKey. Key of the attribute used for search.

Description

The FindByKey method finds attribute in the collection by its key.

Comments

The method returns attribute parameters in case of successful search and Null, if the attribute is absent in sorting collection.

Example

Sub UserProc;
Var
    MB: IMetabase;
    Cube: IStandardCube;
    CustDim: ICustomDimension;
    CustAtrs: ICustomDimAttributes;
    CustDimOrd: ICustomDimOrders;
    DimOrder: ICustomDimOrder;
    s: String;
Begin
    MB := MetabaseClass.Active;
    Cube := MB.ItemById("CUBE_1").Bind As IStandardCube;
    CustDim := Cube.FactDimension.Dimension As ICustomDimension;
    CustAtrs := CustDim.Attributes;
    CustDimOrd := CustAtrs.Orders;
    DimOrder := CustDimOrd.FindByKey(CustAtrs.Name.Key);
    If DimOrder <> Null Then
        s := DimOrder.ReverseOrder.ToString;
    Else
        s := "Attribute does not fall into list of the sorting";
    End If;
End Sub UserProc;

After executing the example the attribute with Name function is searched for in the sorting list; if the search is successful, the "s" variable contains direction of sorting by this attribute.

See also:

ICustomDimOrders