This discussion is archived
1 2 3 35 Replies Latest reply: Jul 12, 2013 9:24 AM by Andreas Weiden Go to original post
• ###### 15. Re: How to create multiple PDF files.
Currently Being Moderated
Andreas,

Thanks for your suggestion... I guess I was trying it a bit differently.

my only question for now is how to tweak the code so that I can generate PDF reports for individual shipper and save it locally on my drive....?

Thanks again for your assistance, I think I am almost there.
• ###### 16. Re: How to create multiple PDF files.
Currently Being Moderated
my only question for now is how to tweak the code so that I can generate PDF reports for individual shipper
When i understand you correctly you want to pass a parameter from outside to the report and then query data based on that parameter?

If so, define a parameter in your report-design and use it in the query like
SELECT ..
FROM TABLE
WHERE COLUMN=$P{P_SHIPPER} When calling the report, pass this parameter like DECLARE lParams PK_JRXML2PDF_REPGEN.TPARAMLIST; bl BLOB; BEGIN lParams(1).vcName:='P_SHIPPER'; lParams(1).vcValue:='Your value'; bl :=PK_JRXML2PDF_REPGEN.FK_RUN(i_vcName =>'YourReport', i_lParams=>lParams); PK_JRXML2PDF_REPGEN.PR_SHOW_REPORT(bl); APEX_APPLICATION.STOP_APEX_ENGINE; END; btw... In the future its better to ask specific questions about PL-jrxml2pdf on the forum of the tool itself. • ###### 17. Re: How to create multiple PDF files. Currently Being Moderated where will these reports be saved... I want them to be saved on my local drive, how is that possible...? going forward I will post these questions on PL-jrxml2pdf discussion forum. Thanks again • ###### 18. Re: How to create multiple PDF files. Currently Being Moderated okay I've tried your suggestion to pass parameters and got the error message... here is what I did 1) modified JRXML code (SQL) as follows SELECT NOS, SHIPPER_NAME, COMMODITY FROM T_NORM_ORIG_VOL where SHIPPER_NAME =$P{P_SHIPPER}

2) modified PL/SQL code as follows

DECLARE
lParams PK_JRXML2PDF_REPGEN.TPARAMLIST;
bl BLOB;
BEGIN
lParams(1).vcName:='P_SHIPPER';
lParams(1).vcValue:='Shipper 1';
bl :=PK_JRXML2PDF_REPGEN.FK_RUN(i_vcName =>'Test', i_lParams=>lParams);

PK_JRXML2PDF_REPGEN.PR_SHOW_REPORT(bl);
APEX_APPLICATION.STOP_APEX_ENGINE;
END;

Here is the error message that I got

ORA-22275: invalid LOB locator specified

Technical Info (only visible for developers)
is_internal_error: false
ora_sqlcode: -22275
ora_sqlerrm: ORA-22275: invalid LOB locator specified
component.type: APEX_APPLICATION_PAGE_PROCESS
component.id: 19289591145614960295
component.name: Generate PDF Reports
error_backtrace:
ORA-06512: at "TPARVAIZ1.PK_JRXML2PDF_REPGEN", line 8275
ORA-06512: at line 9
ORA-06512: at "SYS.DBMS_SYS_SQL", line 1926
ORA-06512: at "SYS.WWV_DBMS_SQL", line 973
ORA-06512: at "SYS.WWV_DBMS_SQL", line 999
ORA-06512: at "APEX_040200.WWV_FLOW_DYNAMIC_EXEC", line 830
ORA-06512: at "APEX_040200.WWV_FLOW_PROCESS", line 138

I've created another project @ APEX.ORACLE.COM as Jasper iReport Developer2 (67238) for your review and comments
• ###### 19. Re: How to create multiple PDF files.
Currently Being Moderated
anyone...?
• ###### 20. Re: How to create multiple PDF files.
Currently Being Moderated
There is no shipper with the name 'Shipper 1' in your table. And with the main query returning no rows, no report gets generated, thus the blob is null.

varchar's in Oracle are case-sensitive, so you may try an exsting value, like 'SHIPPER 1'.
• ###### 21. Re: How to create multiple PDF files.
Currently Being Moderated
perfect...

only thing left is to get it automatically downloaded to a repository (ideally my C drive)... any suggestions?

Thanks again Andreas for your assistance
• ###### 22. Re: How to create multiple PDF files.
Currently Being Moderated
There is a method PR_RUN_TO_FILE which can be used to create a file with the report-results in a database-directory. But the resulting file is created in a directory on the database-server not on your local filesystem.

Edited by: Andreas Weiden on 18.01.2013 18:36
• ###### 23. Re: How to create multiple PDF files.
Currently Being Moderated
Andreas,

I looked up PR_RUN_TO_FILE method in gogle and nothing showed up... can you please put me in the right direction

Thanks

Edited by: tparvaiz on Jan 18, 2013 11:12 AM
• ###### 24. Re: How to create multiple PDF files.
Currently Being Moderated
Its is a procedure in the package you already call to show your report, PK_JRXML2PDF_REPGEN. Its also described in the documemtation of PL-jrxml2pdf.
• ###### 25. Re: How to create multiple PDF files.
Currently Being Moderated
can you please confirm that If I need to save a report for Shipper 1 under C:\Repository\ as Shiper 1.PDF then I should use the following code

DECLARE
lParams PK_JRXML2PDF_REPGEN.TPARAMLIST;
bl BLOB;
BEGIN
lParams(1).vcName:='P_SHIPPER';
lParams(1).vcValue:='SHIPPER 1';

bl :=PK_JRXML2PDF_REPGEN.PR_RUN_TO_FILE(i_vcName =>'Test', i_lParams=>lParams, i_vcDir => 'C\Repository', i_vcFilename => 'SHIPPER 1');

APEX_APPLICATION.STOP_APEX_ENGINE;
END;

Thanks again for your assistance... going forward I will post these on JRXML's discussion forum.
• ###### 26. Re: How to create multiple PDF files.
Currently Being Moderated

The directory you pass to the procedure is not a physical directory, but a database-directory (which in the database is mapped to a physical directory again). You also need grants to UTL_FILE first (also described in the docs). And writing to your local directory C:\ will only work if your database is installed on your local computer.
• ###### 27. Re: How to create multiple PDF files.
Currently Being Moderated
Andreas,

I was testing in theory if there is a way to export PDF reports via APEX and apparently there is one... I am about couple of weeks away from implementing the solution, will post a new question @ that time if I'll hit a road block. can you please confirm if the logic posted would work and all I have to do is change the directory name to the database directory name (I am assuming it would look something like this X:\abc\def\) .

Also, can you please post link to the documentation you are referring to. the documentation that I looked into was part of PK_JRXML2PDF_REPGEN package but has no examples.

Thanks again for your assistance I really appreciate it.
• ###### 28. Re: How to create multiple PDF files.
Currently Being Moderated
the directory name to the database directory name (I am assuming it would look something like this X:\abc\def\)
A database directoy is logical object for a physical directory. In the documentation is an example how to create a database-directory. And still, it writes to the db-server, not to the client-pc.
Also, can you please post link to the documentation you are referring to. the documentation that I looked into was part of PK_JRXML2PDF_REPGEN package but has no examples.
That is the documentation is talk of. There is an example of how to create a db-directory in it.
• ###### 29. Question for Andreas
Currently Being Moderated
Andreas,

Thanks you for your great JRXML2PDF tool.

I successfully integrated an iReport report in my APEX application but I am having the following issue:

My report uses a table fed from a different dataset than the main report. Everything works well in iReport and the data displays correctly.
When I copy the XML to the Oracle table and try to run the report in APEX I only get the "string" fields of the data in the table. The "date" and "number" fields are all blank.

Do you know of any reason for this behavior? I am pretty new at iReport so it is likely a rookie mistake!!!

Thanks,

Jean
1 2 3

#### Legend

• Correct Answers - 10 points