IDefGroupSettings.Add

Syntax

Add(dimKey: Integer): IDefGroupSetting;

Parameters

dimKey. Key of dimension of the sidehead, for which grouping settings should be added.

Description

The Add method adds grouping settings for the specified dimension.

Example

Executing the example requires that the repository contains a data entry form, for which the specified macro is set as an executable method for a custom button. Table area is created in data entry form. The table area sidehead contains the dimension based on a dictionary with the DICT_INDICATORS identifier.

Add links to the Dimensions, Metabase, Report system assemblies. Add links to the assemblies required for working with data entry forms.

Public Sub AddGroupSetting(Report: IPrxReport);
Var
    Mb: IMetabase;
    DEForm: IDataEntryForm;
    TArea: IDefTableArea;
    Groups: IDefGroupSettings;
    Group: IDefGroupSetting;
    DimMod: IDimensionModel;
    Attrs: IDimAttributes;
    GrAttrs: NamedEntitiesCollection;
    Dim: IDefDimension;
Begin
    Mb := MetabaseClass.Active;
    // Current data entry form instance
    DEForm := New DataEntryForm.CreateByReport(Report);
    DEForm.refreshOnEdit := True;
    // Create a new table area
    TArea := DEForm.InputAreas.Item(0As IDefTableArea;
    DimMod := Mb.ItemById("DICT_INDICATORS").Bind As IDimensionModel;
    Attrs := DimMod.Attributes;
    Dim := TArea.DefDimensions.ItemByKey((DimMod As IMetabaseObject).Key);
    Dim.Place := DimPlace.side;
    // Grouping settings
    Groups := TArea.GroupSettings;
    Groups.Clear;
    Group := Groups.Add(Dim.Key);
    // Create a collection of attributes
    GrAttrs := New NamedEntitiesCollection.Create;
    GrAttrs.Add(New NamedEntity.CreateWithData(Attrs.Name.Key, """"));
    Group.Attributes := GrAttrs;
    // Indicates whether leaf elements are created on empty attribute values
    Group.CreateElemForEmptyAttr := True;
    // Level of elements, on which grouping is executed
    Group.LevelNumber := 1;
    // Apply changes to data entry form
    DEForm.InputAreas.ApplyAreaToReport(TArea.id);
    DEForm._Dispose;
End Sub AddGroupSetting;

When the macro is executed, dimension grouping settings are reset for the table area if they were created. After this a new grouping setting is added for the specified sidehead dimension.

See also:

IDefGroupSettings