Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

How do I determine if a report contains a specific TppMemo or TppLabel?

edited October 2003 in General
Greetings All,

We are using the ReportExplorer and store all of our reports in a database.

Once a report is loaded, is there anyway to determine if a specific TppMemo
or a TppLabel is present in the report?

If so, how?

Thanks
--
Michael Tuttle
Software Technologies, Inc.
Topeka, KS

Comments

  • edited October 2003
    procedure FindppComponent(aComponentName : String; aReport :
    TppCustomReport);
    var
    liBand : Integer;
    liObject : Integer;
    lObject : TppComponent;
    begin
    for liBand := 0 to aReport.BandCount-1 do
    for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
    begin
    lObject := aReport.Bands[liBand].Objects[liObject];
    if ((lObject is TppSubReport) and (TppSubReport(lObject).Report <>
    nil)) then
    FindppComponent(aComponentName,TppSubReport(lObject).Report)
    else
    if aReport.Bands[liBand].Objects[liObject].Name = aComponentName
    then
    aReport.Bands[liBand].Objects[liObject].Text := 'YES !!!';
    end;
    end;

    You might have to minipulate the code to your needs but this is how I find
    all my components from delphi.
    Tim

  • edited October 2003
    Thanks Tim,

    I modified your code, and changed it to a function. Works great.

    Here is the modified code:

    Function FindppComponent(aComponentName: String; aReport: TppCustomReport):
    Boolean;
    var
    liBand: Integer;
    liObject: Integer;
    lObject: TppComponent;
    begin
    Result := False;
    for liBand := 0 to aReport.BandCount-1 do
    for liObject := 0 to aReport.Bands[liBand].ObjectCount-1 do
    begin
    lObject := aReport.Bands[liBand].Objects[liObject];
    if ((lObject is TppSubReport) and (TppSubReport(lObject).Report <>
    nil)) then
    FindppComponent(aComponentName,TppSubReport(lObject).Report)
    else
    if aReport.Bands[liBand].Objects[liObject].Name = aComponentName
    then
    Result := True;
    end;
    end;
This discussion has been closed.