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

Have reports use Session Parameters

edited August 2003 in Server
I'm having some trouble get some reports on a form to work with the
session parameters.
I have several reports on a form that all use the the same query, but
different pipelines and sometimes an added detail query.
Functions to create the sql for the main query based on what the user
has selected prior to running report. The fields used are always the
same, just different tables and search criteria.

It would be nice if the report or query had an event to trigger the
function to build the query based on the session parameters set by the
client.

I have tried having the function called on the query BeforeOpen. The
pipeline BeforeOpen. The form create method. All have failed. Looked
into the example
http://www.digital-metaphors.com/tips/ReportModuleVolumEventHandlers.zip
but could not see the report or form on the BeforePublishReport event.
I'm not understanding the object trail to the report and do not see
how to access the form or report before the report is run.

I have many reports that need to rollup data through functions, before
the report is run and would like these reports on the server to cut down
on the amount of data going over the wire. I guess I'm trying to get
stuff done before the report is run and this may be something that the
server was never meant to handle, if so, please let me know and I'll
change what tactics.

Thanks,
Dave

Comments

  • edited August 2003

    This can be done easily.

    The ReportVolume events such as the BeforePublishReport event have an
    aEventParams object passed to them that provides access to relevant
    information. The type of the aEventParams object is different for each
    event.

    The BeforePublishReport event has an aEventParams object that is of type
    TrsBeforePublishReportEventParams. This object is documented in the
    RBServer.hlp.

    TrsBeforePublishReportEventParams properties include:

    - Report
    - ReportModule
    - ReportName
    - ReportParameters
    - SesstionParameters


    Example code (I did not try to compile this...)


    procedure TForm1.rsReportTemplateVolume1BeforePublishReport(
    Sender: TObject; aEventParams: TrsBeforePublishReportEventParams);
    var
    lReport: TppReport;
    lReportForm: TmyReportForm;
    begin

    lReport := TppReport(aEventParams.Report);

    lReportForm := TmyReportForm(aEventParams.ReportModule);


    if (aEventParams.SessionParameters.Count > 0) then
    {do some stuff here}


    end;




    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.