New Blog Post: RESTful Reporting

Report creation on REST Server

Hello,
I try to generate reports on a Rest-Server (Delphi 10.3). It seemed to work, but sometimes it has strange behaviour, and maybe I do something fundamently wrong.
I create all my components runtime :

TfdQuery <->datasetprovider<->ClientDataset<->Datasource<->TppDataPipeline

From my FormUnit, from wich I also start the REST server, I can open the designer, load my template from the database, and edit the report.

All the changes I make to my report are saved EXCEPT the dataPipeline which I created runtime just before executing the designer
During the design, I see the pipeline, I see the data it provides, but as I click the save button, the name is not saved to the template in the database. All the other changes to the template are saved.

This makes me wonder: is it possible to edit, save and generate reports without dropping the datapipelines on the form or datamodule ?

The reason I do this, is that my requests to the servermethod always fails the second time if I use components on the datamodule. Also, this way, the datapiplines appear multiple times in the designer. It looks like they are created everytime I call the servermethod, and everything gets mixed up …

Any help hints or tips are very welcome !

Kind regards,

Dirk Janssens.

Comments

  • Hi Dirk,

    I recommend creating more apps. Dedicated REST Server app. Report Designer app, etc.

    REST Server App
    - create a DataModule call it 'myReportModule'. Add the report, datapipelines, data connection, etc. Add one or more public methods GenerateReport, etc.
    - to process a REST request, create a myReportModule instance, call GenerateReport method, and destroy myReportModule instance. Return REST response

    Report Designer App
    - Add button or menu, 'Design Report'. In the button OnClick, create a myReportModule instance, create a TppDesigner instance owned by myReportModule, set Designer.Report to reference the TppReport. Call Designer.ShowModal. Then call myReportModule.Free.



    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • Thank you Nard,
    I have found a work around by putting it all in a VCL form application, which responds to database-events, triggered by the Rest-server.
    Maybe later I will try your solution, but for now I am fine,

    regards,

    Dirk,
Sign In or Register to comment.