Home Subreports

Iterate through all objects on report

edited January 2003 in Subreports
(Tried this on the General NG but got no response. Sorry for the repost, but
I need to solve this!)

I have a requirement to iterate through all of the labels in a report
including the sub reports.

I have used the code found the tech-tips,which successfully iterates through
all of the labels on my main report, but it seems to ignore the subreports.
My code is as follows:

for BandIdx := 0 to ppReport1.BandCount-1 do
begin
for ObjIdx := 0 to ppReport1.Bands[BandIdx].ObjectCount-1 do
begin
aObject := ppReport1.Bands[BandIdx].Objects[ObjIdx];
if (aObject is TppLabel) and
(Copy(TppLabel(aObject).Caption, 0, 2) = 'L_') then
begin
// Other code in here
end;
end;
end;

How then, do I alter the code so that it includes objects (Labels) in any
sub reports.

TIA,

Paul

Comments

  • edited January 2003
    Hi Paul,

    I uploaded a revised tech tip once, but it doesn't seem to be there.

    Recursively call the procedure passing the TppSubreport.Report object.
    Inside the cod eyou have, check to see if aObject is TppSubreport. If true,
    then do the recursive call typecasting the object as a TppSubreport and pass
    the Report object property to the routine.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.