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

Editing Existing Query

edited June 2003 in End User
I load the Report from database file.

SQL := LoadExistingReport;
fReport := RWReport.Report;
SetOrientation( fReport.PrinterSetup.Orientation); //I can able to get
the orientation but not the style and layout.
How do I know what was the Report Layout / Report Style when It was saved?.
Remember I am not using your Query Wizard and our user doesn't want use see
the designer at all, we have our own wizard.
I've tried to look into all the help possible and couldn't able to see any
help how do you extract Layout and Style of the report ?

Thank you
-Bhoj

Comments

  • edited June 2003
    You'll have to read the Report.PrinterSetup to get the paper width, paper
    height or paper name after the template is loaded. I'm guessing this is what
    you mean by layout.

    What do you mean by style?


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    Opps!!! yes, I mean except Orientation how do I set other properties.
    fOrientation: TPrinterOrientation; // get it from PrinterObject
    fLayout: TppReportLayoutType;
    f Style: TppReportStyleType;
    fReportStyle: TppReportStyle;
    fReportLayout: TppReportLayout;
    -Bhoj


  • edited June 2003
    You can't extract the style and layout from a report. Those are used in
    order to create the layout with the Report Wizard. They are not persistent
    on the report once the report is created. They are simply a way to describe
    how the layout should look like when you use our Report Wizard.

    Why do you need these values since the report is already created? Since you
    are loading reports from database, then you should be using the method
    Report.Template.LoadFromDatabase. See the Report.Template.Datasettings
    property on the TppReportTemplate class in the help file.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited June 2003
    Thanks Jim,

    Yes , I am loading the report from the Database.But those values were not
    part of Template anyway.I saved those values in the my table when they do
    the SavetoDatabase and load them from there and at the time of load from
    database.
    I've one more problem ,

    Once I load the report and get there all the setting I want clear all the
    controls and destroy all the band of the report using the following code.

    procedure ClearExistingReportControls;
    var
    i, j : integer;
    Band : tppband;
    lComponent: tppComponent;
    begin
    if EditingExistingReport then begin
    for i := fReport.BandCount - 1 downto 0 do begin
    Band := fReport.Bands[i];
    for j := Band.ObjectCount - 1 downto 0 do begin
    lComponent := Band.Objects[j];
    lComponent.destroy;
    end;
    Band.destroy;
    end;
    end;
    end;


    ****
    Problem with the groups the fReport still thinks it has group on it.
    ***
    If I have a groups in the report isn't the above code destroy all the group
    band and contorls on it.
    When I use the code below it should create a another group which will be
    have "UserName=Group1" but the below group has UserGroup=Group2.


    procedure CreateGroups;
    var
    liGroup : Integer;
    lField: TppField;
    lGroup : tppGroup;
    begin
    {Add code for removing group fields and then re-assign back to that
    FSelected Fields}
    for liGroup := 0 to FGroupFields.Count - 1 do begin
    lField := TppField(FGroupFields.Items.Objects[liGroup]);
    {create group & bands}
    lGroup := TppGroup(ppComponentCreate(fReport, TppGroup));
    lGroup.Report := fReport;
    lGroupHeader := TppGroupHeaderBand(ppComponentCreate(fReport,
    TppGroupHeaderBand));
    lGroupHeader.Report := fReport; //I have added it

    lGroupFooter := TppGroupFooterBand(ppComponentCreate(fReport,
    TppGroupFooterBand));
    lGroupFooter.Report := fReport; //I have added it

    lGroupHeader.spHeight := 550;
    {assign data field and pipeline}
    lGroup.BreakName := lField.FieldName;
    lGroup.DataPipeline := FReport.DataPipeline;
    {assign group & bands}
    lGroupFooter.Group := lGroup;
    lGroupHeader.Group := lGroup;
    {save reference to this field's group}
    lField.ReportComponent := TppCommunicator(lGroup);
    GroupFReportComponent := TppCommunicator(lGroup);
    GroupFReportComponent.FreeNotification( self);
    CreateSubTotalControlsOnGroupFooterBand(lGroup, lGroupFooter);
    end;{for}
    end;

    Please help.

    Thank you
    -Bhoj




  • edited June 2003
    Never mind I got it

    for i := 0 to fReport.GroupCount-1 do begin

    FReport.Groups[i].Destroy;

    end;

    its going to take care of it.

    Thanks

    -Bhoj



  • edited June 2003
    Hi Bhoj,


    better use always method 'Free'.

    regards,
    Chris Ueberall;
This discussion has been closed.