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

Silent report 2

edited September 2010 in Server
Hi ,

What we realy want is for a report to produce a pdf file and store it on
disk whithout enything else happening in web mode:
1) In web mode the report should be called by url parameters (if possible
state pdf-file path as one of the parameters) and the resulting PDF file
stored to given location (later picked up by other application), nothing
else should happen (no preview, no dialog of any kind).
2) In backoffice mode the report would be called by programatic parameters
and should show preview with email and print options.

The reason for this need is that our customers want their "Confirmation
documents" to be the same both for backoffice and web bookings. We do not
want to maintain two similar reports as they are quite detailed and time
consuming.

We have searched both these news groups and rbWiki without finding a way to
do exactly what we want.

I hope it is possible :-)

Greetings,
Hans Christian Stadtler
BoMan AS

Comments

  • edited September 2010

    Web mode

    On the WebModule, create a custom Action and the implement its OnAction
    event to process the custom request. In the event-handler call
    WebTier.CreateClientReport to create an instance of a ClientReport that you
    can use to generate the PDF file.

    BackOffice Mode

    Generate to preview in standard manner.

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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2010
    I am not getting it 100%,

    are you saying that I nead two ClientReports for this; One for producing PDF
    file and one for preview or can I call the same ClientReport and get two
    different results (pdf or preview).

    I have made a test report which produces a pdf file (as suggested in rbWiki)
    called from webTier app, but it also always shows a preview of the report. I
    dont understand how to generate a pdf file without anything else happening.

    Hans


  • edited September 2010
    > I dont understand how to generate a pdf file without anything else

    I am not sure I understand you, but if I do, you can create a service that
    calls the web tier that creates the report and saves it to the correct
    location--that way you only have one place the report is created.

    Ed Dressel
    Team DM
  • edited September 2010
    Did you create custom WebModule action?



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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2010
    I have not had time yet, we are two developers working with RB and Delphi,
    and our main Delphi guy is first in today.

    Hans


  • edited September 2010
    I'll take it from here. I have created a WebModule action. What do i do
    inside this OnAction event?
    I also need to identify the report in this action as it is not all reports
    that need this treatment. How can i identify
    which report is run?

    Best regards,
    Terje Syversen

  • edited September 2010
    >What do i do inside this OnAction event?

    Please re-read my first post on this thread.


    Please re-read Hans' post that started this thread. That post states "In web
    mode the report should be called by url parameters (if possible state
    pdf-file path as one of the parameters)"

    Therefore the URL will be the web action and it can contain the parameters
    that you include with the URL.

    Probably something I am not understanding about the requirements. :)


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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited September 2010
    I can extract the reportname from the URL in thereby identify it, so that
    problem is solved. But i still
    can't figure out what to do with this WebTier.CreateClientReport. Any
    samples on how to use it? Do i set
    TextFileName of the report in this event and then print it?

    Regards,
    Terje


  • edited September 2010
    TrsClientReport is documented in the RB help. The RBServer\Demos\Clients
    folder contains examples of using client report.

    Report, ClientReport, and ArchiveReader all descend from Producer and share
    many common properties and methods. Generating a PDF works basically the
    same with all of them.

    Example:

    uses
    ppTypes;


    rsClientReport1.VolumeName := 'Report Archives';
    rsClientReport1.ReportName := 'Sales History\Customer List';

    rsClientReport1.ShowPrintDialog := False;
    rsClientReport1.ShowCancelDialog := False;
    rsClientReport1.ShowAutoSearchDialog := False;
    rsClientReport1.DeviceType := dtPDF;
    rsClientReport1.TextFileName := 'c:\myReport.pdf';

    rsclientReport1.Print;



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



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2010
    I'm still having trouble. The method WebTier.CreateClientReport needs a
    parameter of class TrsWebRequest. The WebModule.OnAction event have a
    parameter of TWebRequest. Is there a version conflict here? Or am i missing
    something else?

    Also i have a problem when i replace the webtier on webserver. It does'nt
    seem to run the new version. I stop the Report Server before i replace the
    webtier.
    What is the problem? Do i have to restart IIS?


    Regards, Terje


  • edited October 2010
    A good example of performing custom processing is the Demos\WebTier\Custom
    Parameters demo. (Note that to run the demo, requires that you also run the
    Demos\Server\Custom Parameters demo for the server side of things. See the
    ReadMe.doc in each folder).

    See the RBuilder help topic for TrsWebRequest for information about using
    this class. It parses the web parameters for you and makes them accessible
    via properties.

    Yes, you probably need to restart IIS. There are many versions of IIS and
    there are different configurations it uses to load and cache ISAPI.dll's.

    Here is a simple example of creating a webrequest object and passing it to a
    custom method that you would implement to generate the PDF.

    uses
    rsWebRequest;


    var
    lWebRequest: TrsWebRequest;
    begin

    {use the incoming request parameters to create a TrsWebRequest}
    lWebRequest := rsWebTier1.CreateWebRequest(Request.QueryFields,
    Request.Content);

    try
    Response.Content := ProcessMyCustomPDFRequest(lWebRequest);

    finally
    lWebRequest.Free;
    end;






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


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2010
    Hi!

    As soon as got the WebTier running on LocalHost i also got this problem
    solved.
    Thanks a lot for your excellent support.

    Best regards,
    Terje

This discussion has been closed.