PDF file names

Started by Jeff W., October 22, 2010, 08:02:54 PM

Previous topic - Next topic

Jeff W.

To create PDF output I'm using the following reporting API functions.

CALL fgl_report_SelectDevice("PDF")
LET p_handler = fgl_report_commitCurrentSettings()
LET p_stat = fgl_report_RunReportFromProcessLevelDataFile(p_handler, p_filename)

The last function creates unique PDF file names such as:  Report-server-1335448-10-13-13-22-13.6.pdf

Is there a way to generate my own PDF file names?

Gary C.

Hi

I think you need to make a call to the function

fgl_report_setOutputFileName(fileName)


Jeff W.

Can you provide an example of how this fgl_report_setOutputFileName function is used?  I tried some different options, but no luck.  There's not a lot of documentation on it, other than it's suppose to be used with the fgl_report_selectPreview function.

Reuben B.

Quote from: Jeff Wollrabe on October 26, 2010, 11:47:02 PM
Can you provide an example of how this fgl_report_setOutputFileName function is used?  I tried some different options, but no luck.  There's not a lot of documentation on it, other than it's suppose to be used with the fgl_report_selectPreview function.

Using your code example, something like ...

Code (genero) Select
CALL fgl_report_SelectDevice("PDF")
CALL fgl_report_selectPreview(FALSE)
CALL fgl_report_setOutputFileName("myname")
LET p_handler = fgl_report_commitCurrentSettings()
LET p_stat = fgl_report_RunReportFromProcessLevelDataFile(p_handler, p_filename)


... you should end up with myname.pdf

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero

Jeff W.

This didn't work. Here's what my code looks like.

LET p_stat = fgl_report_loadCurrentSettings("region_rpt.4rp")
CALL fgl_report_SelectDevice("PDF")
CALL fgl_report_selectPreview(FALSE)
CALL fgl_report_setOutputFileName("region")
LET p_handler = fgl_report_commitCurrentSettings()
LET p_stat = fgl_report_RunReportFromProcessLevelDataFile(p_handler, p_filename)

If I remove the call to function fgl_report_selectPreview, it works but I get a random PDF file name. Any other suggestions?

Jeff W.

After debugging and walking through the built-in functions (fgl_report_selectPreview, fgl_report_setOutputFileName, fgl_report_commitCurrentSettings), I understand what's happening now.

Reuben B.

Quote from: Jeff Wollrabe on October 27, 2010, 06:40:26 PM
After debugging and walking through the built-in functions (fgl_report_selectPreview, fgl_report_setOutputFileName, fgl_report_commitCurrentSettings), I understand what's happening now.

... out of curiousity what was the issue?
Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero

ORGA-SOFT B.

Hello Reuben,

i have exact the same problem.
I call the following functions
   IF  fgl_report_loadCurrentSettings("wagdrhesgrw.4rp") = TRUE THEN
        CALL fgl_report_selectDevice("PDF")
        CALL fgl_report_setOutputFileName("TEST.pdf")
        CALL fgl_report_commitCurrentSettings() RETURNING hdl   
   END IF

But the PDF is always generated with a random filename. So any suggestions what could be wrong?


 

Reuben B.

QuoteHello Reuben,

i have exact the same problem.
I call the following functions
   IF  fgl_report_loadCurrentSettings("wagdrhesgrw.4rp") = TRUE THEN
        CALL fgl_report_selectDevice("PDF")
        CALL fgl_report_setOutputFileName("TEST.pdf")
        CALL fgl_report_commitCurrentSettings() RETURNING hdl   
   END IF

But the PDF is always generated with a random filename. So any suggestions what could be wrong?

First guess is you are missing a line ... fgl_report_selectPreview(FALSE)

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero

ORGA-SOFT B.

Hello Reuben,

many thanks.
So if we want to bring up the pdf file with the preview param is set to true there is no way to set the filename of the pdf?