Skip to Main Content

General Development Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Parameterizing the target base URL (e.g. Domain name) in e-Test scripts

user9528974Jul 7 2008 — edited Jul 8 2008
Hi there,

I am currently building all my functional tests (scripts) using e-Test, given a target TG1 machine with URL (http://www.myfirsturl.com)

Later I am planning to run these tests against another target TG2 environment, let us say (http://www.mysecondurl.com).

Is there a way to do easily it, thus avoiding the need to re-record all tests again (i.e. if the target system changes)?

Many thanks,

Nuno

Comments

InoL

Without displaying the HTML content on the report.
If it is a hidden column, the output is not available for your JavaScript function.

Depending on your database version, you can run the same JavaScript in the database:
https://blogs.oracle.com/java/post/multilingual-engine-executing-javascript-in-oracle%C2%A0database
Maybe you can use html2pdf directly in the database to convert the output of your FUNCTION_RETURNING_HTML.

Another option is open source pdf packages, e.g.:
GitHub - lee-lindley/PdfGen: A PL/SQL PDF report generator providing some of the column, column break and header capabilities of sqlplus reports. Built on as_pdf3 from Anton Scheffer (included). (0 Bytes)Instead of FUNCTION_RETURNING_HTML, create a function FUNCTION_RETURNING_PDF.

Adnan3114

@inol Thanks for the suggestions.
Our live software is running on 11g database and APEX 5.1, but we are migrating it to 19.0c database with APEX 22.1. So we can't actually run the Javascript code from database.
We already have set up the reports as function that returns HTML so it would be really time consuming (which we can't afford at this moment) to convert those to be able to use PL/SQL PDF gen feature.
I am trying to download the hidden div but I am unable to make it work. I even tried to push the div out of displayable regions using CSS but that too was no use.

Adnan3114
Answer

I have managed to find a solution.
Turns out changing Region header type to hidden and setting the WHOLE REPORT on the region header seems to work and downloads the report in PDF.
Here are the steps:
In the APEX page I have created a region (name: reg_1) which has these attributes: Header - Hidden, Style - Remove UI Decoration, Remove Body Padding. This region will only serve for us to download the PDF and nothing else.
Now in the reg_1 region's header, I have added this HTML: <div id="content"></div>
Created a page item :PX_PK_ID.
Then, created a Dynamic action change event for :PX_PK_ID that has 2 true actions. This dynamic action's scope should be set to Dynamic.
Action 1- SQL Statement Set Value: select FNC_RETURN_HTML(:PX_PK_ID) from dual; and for jQuery Selector #content (ID of the header HTML in step-2).
Action 2- Execute Javascript Function that is down_pdf() which will download the elements in #content div using html2pdf.js library after Action 1 is complete.
Finally, create the classic report region: SELECT PRIMARY_KEY, col1, col2, "DOWNLOAD" as DOWNLOAD from TABLE and for the DOWNLOAD column, change its type to link and set the link to URL like this: javascript:$s("PX_PK_ID",#PRIMARY_KEY#);
Voila! It works like a charm!

Marked as Answer by Adnan3114 · Aug 3 2022
1 - 3
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 5 2008
Added on Jul 7 2008
4 comments
1,023 views