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

REST issues

I've been playing with the REST server and client demos. Some questions and observations:

1. I had to modify the source of ppTypes and ppComm in order for them to compile (expose {$DEFINE FMX}). This seems a bit cumbersome if I want to run multple RB projects, some for FMX and some for VCL. Couldn't this be done with INCLUDE files, e.g. ppTypes uses an include file that defaults no {.$DEFINE FMX}, but if I put a copy of that include file in my FMX project folder I can uncomment it out there:

unit ppTypes;

interface

{.$DEFINE FMX} <---- lose this
{$I FMX.inc} <---- add this
{$I ppIfDef.pas}

2. Is TrbRestClientDocumentService.Format supposed to support all the file types that the RB natively exports to? I note that TrbMobileExplorerManager.OpenReport hardcodes this to 'PDF'; but if I change to XLXS in the RB source then I get:

exception class : EIdHTTPProtocolException
exception message : HTTP/1.1 500 Output format not supported: XLSX.

Are there plans to extend the REST services to support other file formats?

3. When the build target is Windows, then if Acrobat Reader is not installed on the client machine then when running a report the embedded browser doesn't know what to do with the .tmp file that it navigates to. So the user is asked to Save or Open the file and if Open is selected then Windows tries to open the .TMP file. If the file had been given the appropriate file extension (e.g. .pdf) then any other registered pdf viewers installed on the client would have kicked in. As it happens on a test machine I was using it opened in Programmer's Notepad.

4. The REST demos use Datasnap but Tokyo Professional doesn't have it and AFAIIA it's not been needed for quite a few Delphi releases for WebApi stuff, so I had to remove all the references to Datasnap get the demos to compile.

Comments

  • Hi Paul,

    1. Access the Delphi project options, select Delphi Compiler node on the left, then on the right add FMX to the Conditional defines.

    2. Starting with RB 19.01, you can set TrbRestClient.DocumentService.Format to control the format. The default is PDF. (PDF is all that officially works right now.)

    3. Xlsx is not recognized by the server, because its looking for a device name. The server will recognize XlsxReport, XlsxData. For the next major release, we can work on enhancements to support Xlsx.

    4. Starting with RB 19.01, the tmp extension is replaced with the Format. (This works great for PDF, but for XlsReport, you get .xlsreport, so not good). We can work on enhancing this for the next major release. Using the local file is only done on Windows, to work around TWebBrowser behavior)

    5. Starting with RB 19.01, the demos no longer use DataSnap. (Looks like Delphi Tokyo has made some nice improvements there!)

    Thanks for the feedback. Exciting that Delphi Professional now includes mobile!





    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
Sign In or Register to comment.