FieldName: String;
The FieldName property determines binding of a cell to a field of the relational source.
To execute an example, add links to the Report, Metabase and Tab system assemblies. The example requires a regular report with the RR identifier and a table added to data sources. A table must contain the ID and NAME fields.
Sub Main;
Var
Report : IPrxReport;
MB: IMetabase;
TI : IPrxTableIsland;
Range : ITabRange;
Layout : IPrxTableIslandLayout;
Row : IPrxTableIslandLayoutRow;
Cell : IPrxTableIslandLayoutCell;
Begin
MB := MetabaseClass.Active;
Report := MB.ItemById("RR").Edit As IPrxReport;
TI := Report.TableIslands.Add;
TI := TI.Edit;
TI.Source := Report.TableSources.Item(0);
TI.Sheet := Report.Sheets.Item(0);
Range := (TI.Sheet As IPrxTable).TabSheet.Cell(10,1);
TI.Range := Range;
Layout := TI.Layout;
Row := Layout.Add;
Cell := Row.Add;
Cell.Field.FieldName := "ID";
Cell.Field.Caption := "ID";
Cell := Row.Add;
Cell.Field.FieldName := "NAME";
Cell.Field.Caption := "NAME";
Cell := Row.Add;
Cell.Field.Expression.AsString := "NAME + ID";
Cell.Field.Caption := "More";
TI.Save;
Report.Recalc;
(Report As IMetabaseObject).Save;
TI.Save;
End Sub Main;
After executing the example a relational data area is created and layout parameters are set up. The relational area is located in the cell range, starting from the (10,1) cell. The area contains 3 columns:
ID with binding to the ID field of the source.
NAME with binding to the NAME field of the source.
More with binding to the ID and NAME fields of the source (using formula).
See also: