Skip to main content

Report Layouts and Report Queries in Oracle APEX 4.2

Objective:

To create PDF, Excel, RTF, HTML reports using report Layouts and report Queries in Oracle APEX 4.2.

Solution:

Step 1: Go to Shared Components ==> Reports



Fig 1: Reports

Step 2: Create report query using below SQL Query.



<<SQL QUERY >>
<< begins >>

SELECT ROWNUM AS sno,
  isin,
  noofrecords,
  fundid,
  quantity,
  sd
FROM
  (SELECT fd.fundidentificationnumber AS isin,
    COUNT(atd.transactionnumber)      AS noofrecords,
    atd.fundid,
    SUM(atd.unitsconfirmed)      AS quantity,
    TO_CHAR(SYSDATE,'DD-MON-YY') AS sd
  FROM smf_apexrps.unitholderaddinfotbl uai,
    smf_apexrps.consolidatedtxntbl atd,
    smf_apexrps.funddemographicstbl fd,
    smf_apexrps.groupdefinitiontbl gd
  WHERE uai.unitholderid = atd.unitholderid
  AND atd.fundid         = gd.fundid
  AND atd.fundid         = fd.fundid
  AND fd.latestrule      = 1
  AND uai.otherinfo29   IS NOT NULL
  AND uai.otherinfo30   IS NOT NULL
  AND uai.otherinfo30 NOT LIKE 'I%'
  AND atd.datealloted =:p128_date_allotted
  AND gd.groupid      =:p128_groupid
  GROUP BY fd.fundidentificationnumber,
    atd.fundid
  )

<< END >>


Fig 2: Report Query


Fig 3: Setting Bind Variables

Step 3: Create RTF template using BI Publisher. Sample template given below for reference.


Date: SD


To, 

Central Depository Services (India) Ltd.
P J Tower 16th Floor
Dalal Street, Fort
 Mumbai 400 001


We hereby certify that names of the allot tees of the Mutual Fund units of Sundaram Mutual Fund issued consequent to New Fund Offer have been verified with the names provided by CDSL, based on the list of the DP Id and Client Ids of the allot tees provided by us. We hereby certify that the credits are being affected only to those accounts which are in “active” status and where the names and order of names as per the application matched with that of the names and order of the names as provided by CDSL. The details of the Corporate Action are given under:


S NO
ISIN
NO OF RECORDS
QUANTITY
SNO
ISIN
NOOFRECORDS
      E


Yours Faithfully,
For XXXYYYZZZ Fund Services Ltd



Authorized Signatory

Step 4: Upload RTF Template, which we created.


Fig 4: Load Template

Step 5: Tag report layout with corresponding report query.

Edit report query attributes then set report layout as “COB” (which we created)


Fig 5: Report Layout Tagging


Step 6: Create report generation screen.


Fig 6: Report Screen

Step 7: Call the report.

Create Button. By two way we can download the report, 

1)  Button Action = "Download Printable Report Query"


Fig 7: Report Calling

2) Button Action = "Redirect URL"

f?p=&app_id.:0:&session.:print_report=unitholder_details 

(OR)

http://yyyy.xxx.home:8080/ords/f?p=&app_id.:0:&session.:print_report=unitholder_details



Fig 8: Report Calling


Step 8: Download the report.


Fig 9: Download Report

Conclusion: Using report queries and report layout, we can create WORD, PDF, EXCEL, HTML reports by creating custom templates in Oracle APEX 4.2.

Related Posts:

Comments

Popular posts from this blog

Printing Page Numbers in RTF Template [Oracle BI Publisher]

Here I am giving an example to print the page numbers dynamically in the RTF (Rich Text Format) template. Step 1:  Go to page footer and copy and paste the below script. Page |  <?fo:page-number?>  of  <?fo:page-number-citation:xdofo:lastpage-joinseq?> <fo:page-number> :   This is the object, which is used to represent the current page-number. <?fo:page-number-citation:xdofo:lastpage-joinseq?> :  This is the syntax, which is used to represent the total number of pages. Step 2:  Load the XML and preview the result. Output: That's it. References: fo:page-number Printing Page Number Code in Oracle XMLP RTF Template

Generating the report with APEX_DATA_EXPORT

With the APEX_DATA_EXPORT package, you are able to export data from Oracle Application Express in the following file types: PDF, XLSX, HTML, CSV, XML, and JSON. Step 1: Create a table and populate it with some sample records. CREATE TABLE emp   (     empno        NUMBER,     first_name   VARCHAR2(240),     last_name    VARCHAR2(240),     mgr          NUMBER,     deptno       NUMBER,     sal          NUMBER,     created_date TIMESTAMP (6),     comm         NUMBER,     hiredate     DATE,     JOB          VARCHAR2(240),     ename        VARCHAR2(240),     PRIMARY KEY (empno) USING INDEX ENABLE   ); /    INSERT INTO emp (empno, first_name, last_name, mgr,                   deptno, sal, created_date)         VALUES                 (1, 'Larry', 'Ellison', ,                  10, 5000, LOCALTIMESTAMP);   INSERT INTO emp (empno, first_name, last_name, mgr,                   deptno, sal, created_date)         VALUES                 (2, 'Juan', 'Juan', 1,  

Save Selected Interactive Grid Records into a Collection - Oracle APEX

Here I am giving an example to save selected interactive grid records into a oracle apex collection. Step 1: Create a new blank page. Note: Mine was page 20. You will need to update reference to " P20 " with your page number if it's different. Step 2: Create a new interactive grid report region to the page using below query. Set Static Id "EmpDetails" to the region. SELECT  *     FROM   ( SELECT  emp . empno ,                emp . ename ,                emp . JOB ,                dept . dname department ,                dept . loc  LOCATION ,                mgr . ename  manager ,                emp . hiredate ,                 nvl ( emp . sal , 0 )  salary ,                 nvl ( emp . comm , 0 )  commission            FROM  eba_demo_chart_emp emp ,                eba_demo_chart_dept dept ,                eba_demo_chart_emp mgr           WHERE  emp . deptno = dept . deptno             AND  emp . mgr      = mgr . empno  ( + )           ORDER   BY  emp . ename