NetTalk Central

Author Topic: Calling a FOMIN Run Time Report to generate a PDF?  (Read 2415 times)

Devan

  • Full Member
  • ***
  • Posts: 230
    • View Profile
    • Email
Calling a FOMIN Run Time Report to generate a PDF?
« on: October 26, 2011, 03:40:43 PM »
Hello again Bruce & the gang,

I am in the process of implementing a reporting library in a NT5 webapp... For ease of modifications to the report sets, I've decided to do them in Fomin Report Builder - that way I can just upload the RPT files and add a row to a database table to add reports to the existing set etc.

I have added the FRM -> PDF templates too, and set up FRB to print directly to PDF without any previews etc.

I have a NetTalk WebForm that takes some details from the end user, along with the report name to print, then when they hit the 'Submit' (renamed to 'Print') button, it calls the procedure 'Student_Report', which is a FRB Run Time Report.

If have put in the '(<NetWebServerWorker p_web>)' in Prototype AND Parameters in the procedure, but everytime I hit the 'Submit' button and the browser goes to 'http://xxx.xxx.xxx.xxx/Student_Report', it comes up with a 'Page Cannot Be Found' message.

What have I missed?

Johan de Klerk

  • Full Member
  • ***
  • Posts: 214
  • Johan de Klerk
    • View Profile
    • Designer Software
Re: Calling a FOMIN Run Time Report to generate a PDF?
« Reply #1 on: October 26, 2011, 08:55:22 PM »
Hi Devan,

I have tried a long time ago to make NTWS and FRB work together and could not get it to work.

If you get it to work it would be nice if you can tell me how you did it.

Regards

Johan de Klerk
Clarion 10, NT 11.57

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Calling a FOMIN Run Time Report to generate a PDF?
« Reply #2 on: October 26, 2011, 09:22:19 PM »
The WebHandler needs to "know about" the Report Procedure.
Obviously you can add embed code for that. (The easiest way to know what to add is to create a dummy ABC report procedure, add the NetTalk Report extension to it, then see how it's added to WebHandler).

Cheers
Bruce

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Calling a FOMIN Run Time Report to generate a PDF?
« Reply #3 on: October 27, 2011, 03:35:32 AM »
Hi Devan,

I did a similar thing with legacy List and Label reports from a win32 app.

I took Bruces ServeDocument example and modified it. I call this procedure from all report forms, pass the report procedure as a GV and then use a case statement to run the report procedure passed as a value. I pass the report the filename. Once the report is finished the servedocument procedure push's the PDF report back to the user.

Here is some code snipits:

      Loc:ExtFilename = Sub(loc:filetype,1,2) & Format(Random(1,99999),@n05) & '.pdf'
      L:Filename = LongPath() & '\web\images\' & Clip(p_web.GSV('UserLogin')) & '\' & Clip(loc:Extfilename)

    Case Upper(Loc:Report)
    Of Upper('PRENT1PMTTYPE')
      PRENT1PMTTYPE(L:FileName,L:TranList)

  p_web.SetValue('_parentPage','ServeDocument')
  p_web.publicpage = 1

    p_web.HeaderDetails.ContentDisposition = 'filename="'&clip(Loc:ExtFileName)&'"'
    Do FileHeader
    Do FileFooter





Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11194
    • View Profile
Re: Calling a FOMIN Run Time Report to generate a PDF?
« Reply #4 on: October 27, 2011, 05:47:49 AM »
>> ServeDocument

That's a procedure in the FileDownload example.

cheers
Bruce

Devan

  • Full Member
  • ***
  • Posts: 230
    • View Profile
    • Email
Re: Calling a FOMIN Run Time Report to generate a PDF?
« Reply #5 on: October 27, 2011, 06:03:50 AM »
Beautiful!!! This worked a treat, thanks guys!

So, I basically created a NetWebPage 'placeholder' page after the form that asks the user for all the parameters, then this placeholder page makes a call to the FRB Runtime Report after presetting the PDF filename etc. and then serves it up to the user.

Works brilliantly.  Thank you Kevin and Bruce for the heads up.

One tiny, tiny issue though - I remember from the NT training courses that if you prefix a filename to be served with '$$$', the WebHandler will delete the file after serving.  This doesn't seem to happen.  Is there another flag I have forgotten to set somewhere?

Thanks,
Devan