Question

I'm working with ReportBuilder 12.05 and I'm trying to iterate through an array (I guess) of my datasource.

I've got a datasource called "STAFF" with some fields within - dynamically created from a database table.

So the table look like this:

tablename: STAFF
id | name | last_name
----------------------
1  | Alex | Gates
2  | Pete | Jefferson
...

I can access a single element by accessing STAFF['LAST_NAME']. But this will always post "Gates" as a result. How do I iterate through all my STAFF?

My code currently looks like this:

memo1.lines.clear;
for len := 1 to 5 do
begin
    memo1.lines.add(STAFF['LAST_NAME'])
end;
Was it helpful?

Solution

Add a SubReport to the summary band, then select the new SubReport tab at the bottom of the designer, set it to have multiple columns and to column traversal left to right (File->Page Setup->Layout), then assign the datapipeline to the SubReport. Then add your fields to the SubReport.

OTHER TIPS

OP was using end-user scripting engine.
So it may necessary to change the event to reach what he wants:

According to Help:

Declaration

property OnEndPage: TNotifyEvent;

This event fires after a page has completed printing. If you set DonePrinting to True in this event handler, no further pages will print.

This event should be used instead of BeforePrint.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top