CreateAttributeArea(sheetKey: Integer; row: Integer; column: Integer): IDefAttributeArea;
sheetKey. Key of the sheet, to which a new attribute area is added.
row. Index of the row, in which the attribute area will be located.
column. Index of the column, starting with which the attribute area is located.
The CreateAttributeArea method creates an attribute area and returns its parameters.
Executing the example requires that repository contains a dictionary with the DICT_INDICATORS identifier. It is also required to be a data entry form, for which the specified macro is set as an executable method for a custom button. One parameter is created in data entry form.
Add links to the Dimensions, Metabase, Report system assemblies. Add links to the assemblies required for working with data entry forms.
Public Sub AddAttribute(Report: IPrxReport);
Var
Mb: IMetabase;
Sheet: IPrxSheet;
DEForm: IDataEntryForm;
AArea: IDefAttributeArea;
Dim: IDimensionModel;
Param: IDefParameter;
Begin
Mb := MetabaseClass.Active;
// Create a single sheet
Sheet := Report.Sheets.Add("Sheet for new table");
// The current data entry form instance
DEForm := New DataEntryForm.CreateByReport(report);
// Create a new attribute area
AArea := DEForm.inpuTAreas.CreateAttributeArea(Sheet.Key, 1, 1);
// Specify a dictionary
Dim := Mb.ItemById("DICT_INDICATORS").Bind As IDimensionModel;
AArea.DictionaryKey := (Dim As IMetabaseObject).Key;
AArea.AttributeKey := Dim.Attributes.Name.Key;
// Parameter with which attribute area is linked
Param := DEForm.Parameters.Item(0);
AArea.ParameterKey := Param.Key;
AArea.ParameterAttributeKey := Param.DimensionInstance.Attributes.FindById("KEY").Attribute.Key;
// Apply dimensions to data entry form
DEForm.inpuTAreas.ApplyAreaToReport(AArea.id);
DEForm._Dispose;
End Sub AddAttribute;
After the macro is executed, a new sheet is created in the data entry form. The sheet will contain attribute area, specified dictionary and dictionary attribute which values will be displayed, the parameter and parameter attribute that will be used for dynamic modification of attribute area change will be set.
See also: