IPrxDataIslandDimensionSort.Element

Fore Syntax

Element(Dim: IDimInstance): Integer;

Fore.NET Syntax

Element[Prognoz.Platform.Interop.Dimensions.IDimInstance] : System.UInt32;

Parameters

Dim. The dimension, by which sorting is executed.

Description

The Element property determines element number when sorting by slice element.

Fore Example

Executing the example requires a regular report with the REPORT identifier, which contains at least one data area. In the slice the first dimension that corresponds to the dictionary with the D_TO identifier is set by rows for the first data area.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    DIs: IPrxDataIslands;
    DI: IPrxDataIsland;
    DimModel: IDimensionModel;
    Prop: IPrxDataIslandProperties;
    PropDim: IPrxDataIslandDimension;
    Sort: IPrxDataIslandDimensionSort;
    DimInst1: IDimInstance;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById("REPORT").Edit;
    Report := MObj As IPrxReport;
    DIs := Report.DataIslands;
    DI := DIs.Item(0).Edit;
        DimModel := DI.Slice.TopHeader.Item(0).Dimension.Dimension;
        Prop := DI.Properties;
        PropDim := Prop.Dimension(DimModel);
        Sort := PropDim.Sort;
        Sort.Enabled := True;
        Sort.Kind := PrxDimensionSortKind.ByElement;
        //Determine the dimension, by which element sorting is executed.
        DimInst1 := mb.ItemById("D_TO").Open(NullAs IDimInstance;
        //Set index of the element, by which sorting is executed.
        Sort.Element(DimInst1) := 5;
    DI.Save;
    MObj.Save;
End Sub UserProc;

After executing the example sorting in the first data area is enabled by columns. Sorting type - By dimension element. The dimension corresponds to the D_TO dictionary. Sorting is executed by the fifth element of the dimension.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example. 

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Dimensions;

...

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    DIs: IPrxDataIslands;
    DI: IPrxDataIsland;
    DimModel: IDimensionModel;
    Prop: IPrxDataIslandProperties;
    PropDim: IPrxDataIslandDimension;
    Sort: IPrxDataIslandDimensionSort;
    DimInst1: IDimInstance;
Begin
    MB := Self.Metabase;
    MObj := MB.ItemById["REPORT"].Edit();
    Report := MObj As IPrxReport;
    DIs := Report.DataIslands;
    DI := DIs.Item[0].Edit();
        DimModel := DI.Slice.TopHeader.Item[0].Dimension.Dimension;
        Prop := DI.Properties;
        PropDim := Prop.Dimension[DimModel];
        Sort := PropDim.Sort;
        Sort.Enabled := True;
        Sort.Kind := PrxDimensionSortKind.phskByElement;
        //Determine the dimension, by which element sorting is executed.
        DimInst1 := mb.ItemById["D_TO"].Open(NullAs IDimInstance;
        //Set index of the element, by which sorting is executed.
        Sort.Element[DimInst1] := 5;
    DI.Save();
    MObj.Save();
End Sub;

See also:

IPrxDataIslandDimensionSort