"OnManualBuild" page’s event The FastReport core is usually responsible for report construction. It displays report’s bands in a definite order, as many times, as there are data, thus forming a finished report. Sometimes it is necessary to display a report in a non-standard form, which the FastReport core is unable to create. In this case, one can use a possibility to constructa report manually via the "OnManualBuild" event, contained in the report’s page. If the handler of this event were defined, then when forming a page the FastReport core would transfer control to it. At the same time, the report’s core automatically displays the bands located in the page, such as "Report title," "Page title," "Column title," "Report footer," "Page footer," "Column footer," and "Background." The core also handles the process of forming of new pages and columns. The task of the "OnManualBuild" event’s handler is to display data bands and their titles and footers in a definite order. That is to say, "OnManualBuild" handler’s essence is to give a command for displaying definite bands to the FastReport’s core. The core will do the rest itself: it will form a new page, as soon as there is no free space on the current one; accomplish the scripts attached to events; etc. Let us demonstrate a handler with a simple example. In the report, there are two master data bands, which are not connected to data: The handler will display these bands in alternate order (six times each one). After six bands are created, a small gap will be inserted. procedure Page1OnManualBuild(Sender: TfrxComponent); var i: Integer; begin for i := 1 to 6 do begin { displaying bands one by one } Engine.ShowBand(MasterData1); Engine.ShowBand(MasterData2); { insert a small gap } if i = 3 then Engine.CurY := Engine.CurY + 10; end; end; The following example displays two bands’ groups next to each other. procedure Page1OnManualBuild(Sender: TfrxComponent); var i, j: Integer; SaveY: Extended; begin SaveY := Engine.CurY; for j := 1 to 2 do begin for i := 1 to 6 do begin Engine.ShowBand(MasterData1); Engine.ShowBand(MasterData2); if i = 3 then Engine.CurY := Engine.CurY + 10; end; Engine.CurY := SaveY; Engine.CurX := Engine.CurX + 200; end; end; As you can see, in these examples we controlled typing of data-bands only. All the rest bands (for example, in our case, it was "Report title") were printed automatically. Finally, we will demonstrate, how to construct a report of the "List of clients" type (we have constructed it several times in this book) via the "OnManualBuild" event. In our example, let us connect the data-band to the data source. Event’s script is the following: procedure Page1OnManualBuild(Sender: TfrxComponent); var DataSet: TfrxDataSet; begin DataSet := MasterData1.DataSet; DataSet.First; while not DataSet.Eof do begin Engine.ShowBand(MasterData1); DataSet.Next; end; end; When starting a report, make sure that the result of the script’s work does not differ from a standard report at all. Refer to the process of getting a link to the Dataset; in our example we connected a band to the data source, that is why the DataSet := MasterData1.DataSet; line returns a link to the data source. If a band is not connected to the source, the link to the required source can be got in the following way: DataSet := Report.GetDataSet('Customers'); Of course, the source, we are interested in, must be added to the report in the "Report|Data…" dialogue