Digital Metaphors: Report Builder - How to iterate through datasource elements?

StackOverflow https://stackoverflow.com/questions/20192313

  •  04-08-2022
  •  | 
  •  

Pergunta

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;
Foi útil?

Solução

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.

Outras dicas

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top