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

Setting report filename in server

edited December 2008 in Server
Hello,

One of the scenarios we're using RB Server in is to print employee payslips
via the browser. Depending on who the employee is depends on which report
file is printed, as they may belong to a different company that has a
different report layout.

Can you please tell me if what I'm doing is right and what I need to get it
to work, or if there is a better way?

The web page generates this request directly:

http://localhost/selfservice/RBServer/ssreports.dll?content=viewer&volume=Payslip&name=archive_pay&persno=3745&year=2008&period=1

i.e. a standard call to retrieve the report 'archive_pay.rtm' from the
Volume 'Payslip'. There are custom parameters for the employee number, and
which payslip period to show.

The WebTier adds the content parameters to the report server's custom
session parameters. These gets passed across correctly.

I have a TrsReportTemplateVolume component on a DataModule in my Server
application. StorageType is stFile.
Its OnValidateReportParameters event takes the employee number, period &
year and uses them to add to the query of the report before it is fired.

However, given the employee number, I then run a query to find out which
report file layout I should be using. This returns a full path to the report
file, which I then set the rsReportTemplateVolume.FileDirectory with.

Running this gives me an error that report 'archive_pay' could not be found
in volume 'Payslip'. So it seems that the name from the original web request
is being used. It tried it without passing a "name" parameter but it told me
that no report name had been specified, so I added it back in.

Please can you give me some advice as to how I can change the filename of
the report within the Report Server before it opens? Am I even using the
most appropriate components?

Thank you,
Jason.

--
Jason Sweby
Software Development Manager,
Carval Computing Limited, Plymouth, UK

Payroll - HR - T&A - Access Control

Comments

  • edited December 2008


    1. The ReportTemplateVolume.FileDirectory properties needs to be set prior
    to the server running and should not be modified. The FileDirectory property
    specifies the root directory where all of your reports are stored. The
    ReportTemplateVolume uses that to generate a list of the available reports.

    The Volume represents a collection of reports. The client can optionally
    browse the collection of reports and the cleint can specifiy which report to
    run.

    2. Keep in mind that the Server is request/response.

    3. A client or webtier can call ValidateReportParameters to send parameters
    to the server for validation. ValidateReportParameters is a boolean
    function.

    When the client/webtier calls ValidateReportParameters the params are sent
    to the server and the ReportVolume.OnValidateReportParameters event is
    triggered. You can use the event to perform validation and set the aIsValid
    parameter to true/false.

    4. When a request is made to run a report, the server validates the report
    name against the catalog. Is the report does not exist, then an error will
    be returned.

    5. There is not an event designed to handle what you are trying to do. You
    could try to implement something like this (have not tried it, so I am not
    sure whether it will work).

    a. Use the ReportVolume.BeforePublish event to query the database to
    determine what report to run. Store the result in a private field of the
    datamodule

    FReportFileName := 'c:\somereport';

    b. Use the ReportVolume.OnLoadStart event to replace the aStream with the
    report.

    aStream.LoadFromFile(FReportFileName);




    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

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