44588045 Oracle XML Publisher Basics
Transcript of 44588045 Oracle XML Publisher Basics
-
8/8/2019 44588045 Oracle XML Publisher Basics
1/37
ORACLE XML PUBLISHER BASICS
Author: Abhijit Ray
-
8/8/2019 44588045 Oracle XML Publisher Basics
2/37
Overview2
Traditional approaches of reporting using Oracle Reports or Oracle Discoverer have lot ofdrawbacks in terms of the efforts, maintainability and reworks.
Oracle XML Publisher is a Template Based Solution, which provides a new approach to Report designand a faster way of implementing Reports.
Utilizing a set of familiar desktop tools such as Adobe Acrobat and Microsoft Word users can createand maintain their own report formats based on development delivered XML data extracts. XMLPublisher will then convert these documents to the XSL-FO format.
The collection of the data is still handled by your concurrent request, but now you can design and
control how the report outputs will be presented in separate template files.
At runtime, XML Publisher merges your designed template files with the report data to create avariety of outputs.
-
8/8/2019 44588045 Oracle XML Publisher Basics
3/37
XML Publisher Architecture3
Architecture of XML Publisher and Integration with Different Modules
-
8/8/2019 44588045 Oracle XML Publisher Basics
4/37
Key Features4
XML Publisher will integrate with the concurrent manager-allowing user to schedule and
execute reports and publish documents .
Generate output in PDF, RTF, HTML, EXCEL formats
Rapidly develop and maintain business critical documents utilizing colors, fonts, images, logos,
watermarks, etc
Easy to build report output templates via MS-Word, Adobe, XML Editors maintain using
industry standard technology (Java, XML)
Multiple Language Support
Reduced Complexity, reduced Cost
-
8/8/2019 44588045 Oracle XML Publisher Basics
5/37
Steps for Creating Report Using XMLPublisher
5
Create a Concurrent Program for Generating XML output.
Create a data definition record in Create Data Definition screen.
The Code field in the Create Data Definition screen should match with the concurrent Programshort name.
Design a template following the XML Publisher guidelines. Template can be designed in RTF,Adobe Acrobat or XSL format.
Register the template in the XML Publisher Template Manager. Associate the data definitionwith the template in this screen.
Use standard request submission to run the XML Publisher Concurrent Request.
Select your template, language, and output format from the submit request interface.
-
8/8/2019 44588045 Oracle XML Publisher Basics
6/37
Concurrent Program Definitions6
Set format to XML
Note Short Name
Run the concurrent program to generate the XML output
-
8/8/2019 44588045 Oracle XML Publisher Basics
7/37
Sample XML Output File
Note the structure of the XML file
-
8/8/2019 44588045 Oracle XML Publisher Basics
8/37
Creating Data Definition(Step 1)8
Navigation:
Xml publisher admin > Data Definition > Create Data Definition.
Should be same as
concurrent prog
Short Name
Upload the generated XML file as the XML Schema and Preview
Data
-
8/8/2019 44588045 Oracle XML Publisher Basics
9/37
Creating Data Definition(Step 2)
9
Navigation:
Xml publisher admin > Templates > Create Template.
-
8/8/2019 44588045 Oracle XML Publisher Basics
10/37
Template Registration10
A XML Publisher template has to be created. Steps to create atemplate is shown later.
A template is associated with a data definition
Navigation:
Xml publisher admin>Template>Create Template
-
8/8/2019 44588045 Oracle XML Publisher Basics
11/37
Template Registration (Step 1)11
Should be same as
concurrent prog
Short Name
Navigation:
Xml publisher admin > Template > Create Template
Upload the template
-
8/8/2019 44588045 Oracle XML Publisher Basics
12/37
Template Registration (Step 2)12
Navigation:
Xml publisher admin > Template > Create Template
-
8/8/2019 44588045 Oracle XML Publisher Basics
13/37
Designing RTF Template13
XML Publisher templates are most commonly RTF files created in Microsoft Word.
The XML Publisher plug-in for Microsoft Word can be installed or a template can also be made
manually.
The following example will show you how to create a template manually
-
8/8/2019 44588045 Oracle XML Publisher Basics
14/37
Designing RTF Template14
Design the template using fields. The fields will act as places where the corresponding value from the XMLfile will show in the final report
Form fields in template
-
8/8/2019 44588045 Oracle XML Publisher Basics
15/37
Designing RTF Template15
Right clicking on any field and selecting Properties will bring up Text Form Field Options. Click on AddHelp Text.
Enter XSL . In this case only the XML tag is mentioned. Hence the value of the tag will be displayed in thereport.
Right click on field
Click here
Enter XSL tags here
-
8/8/2019 44588045 Oracle XML Publisher Basics
16/37
Designing RTF Template16
Tags of the form to map elements from the reports XML data file to the field in the
designed template.
The for-each syntax is used to define groups of repeating elements. This is equivalent to therepeating frame feature in a rdf layout in Oracle Report.
A list of XSL tags are given in the following pages for your reference.
-
8/8/2019 44588045 Oracle XML Publisher Basics
17/37
XSL TAGS FOR XML
PUBLISHER TEMPLATES
-
8/8/2019 44588045 Oracle XML Publisher Basics
18/37
Template Builder XMLP Directives
for-each loop
data fields
page header/footer
page numbering
sorting
page breaks
calculated fields
extended functions
conditional logic
images/logos
Dynamic data columns
Rows per page
Last Page Only content Re-grouping xml data
Cell highlighting
Page totals
-
8/8/2019 44588045 Oracle XML Publisher Basics
19/37
for-each loop
Define groups to notify XML Publisher to loop through repeating information
Insert the following tag before the first element
Insert the following tag after the last element
E.g. The XML group element tag name G_INVOICE for recurring invoiceinformation
invoice lines
-
8/8/2019 44588045 Oracle XML Publisher Basics
20/37
Data fields
Placeholders map the template field to the XML data field
Syntax -
Placeholder must match XML element tag name exactly. It isCase sensitive
E.g. The placeholder identifies the InvoiceNumber
-
8/8/2019 44588045 Oracle XML Publisher Basics
21/37
Page Header/Footer
Enclose the body area of the report within the following tags
Elements occurring before the tag compose theheader
Elements occurring after the tag compose thefooter
-
8/8/2019 44588045 Oracle XML Publisher Basics
22/37
Page Numbering
Use Microsoft Word page numbering
From Insert menu, select Page Numbers
Select the position, alignment and format as desired
-
8/8/2019 44588045 Oracle XML Publisher Basics
23/37
Sorting
Insert sort tag within the group
, for example to sort by transaction number
Enter the following after the
No end tag needed
Sort on multiple elements possible, use multiple sort tags
Example:
Sort on calculated fields supported
-
8/8/2019 44588045 Oracle XML Publisher Basics
24/37
Additional Sorting
Sort order descending
Data type sorting
Number Date
Separated by semi-colon (;)
-
8/8/2019 44588045 Oracle XML Publisher Basics
25/37
Page Breaks
Just before the tag either
Insert a Microsoft Page Break
Insert->Break->Page Break
-or- +
Use XML Publisher directive
This avoids extra blank page at the end of report
-
8/8/2019 44588045 Oracle XML Publisher Basics
26/37
Calculated Fields
Use field names and operand(s)
+ - Addition
- - Minus
* - Multiplication / - Division
Example
Not required to be in form field
-
8/8/2019 44588045 Oracle XML Publisher Basics
27/37
Extended functions
Some SQL functions can be used in template RPAD, LPAD, REPLACE
INSTR, SUBSTR, LENGTH
DECODE
SYSDATE
TO_NUMBER, TO_CHAR
UPPER, LOWER
GREATEST, LEAST
ROUND, CEIL, FLOOR
Usage is
It is NOT case sensitive
Not required to be in a form field
-
8/8/2019 44588045 Oracle XML Publisher Basics
28/37
Conditional logic
Support for IF and CASE statements
IF
Example : to display only invoice lines with a line type of LINE
Enclose the invoice line output within the tags below
CASE
-
8/8/2019 44588045 Oracle XML Publisher Basics
29/37
Images/Logos
Use a table for complete control of image behavior
Static Images
Paste the image directly into layout template
URL
Dummy image on template
Specify URL in alternative text section
Double click on image, go to web tab, alternative text field
url:{www.myspace.com/xml_example/myimage.gif}
Server-side Images (in EBS)
Dummy image on template
Specify URL in alternative text section
url:{${OA_MEDIA} /myimage.gif}
Also supported
URLs and Paths in XML elements or combination of elements
BLOBS from database
-
8/8/2019 44588045 Oracle XML Publisher Basics
30/37
Dynamic data columns
Dynamic Column Header
Dynamic Column Data
Example: Print departments in column header and demand qty as columndata
Column header
Column data
-
8/8/2019 44588045 Oracle XML Publisher Basics
31/37
Rows per page
Define row counter variable in a form field
Increment counter for each line (again in a form field)
Break if the number of rows is reached (say 6 rows in thisexample)
-
8/8/2019 44588045 Oracle XML Publisher Basics
32/37
Last Page Only Content
Create a section break in MSWord (Insert->Break->Sectionbreak Next page)
Insert the following syntax on the final page:
Content on the page above and below these tags willappear only on last page
Headers or footers previously defined for the report mustbe reinserted on the last page
-
8/8/2019 44588045 Oracle XML Publisher Basics
33/37
Re-grouping XML Data
Not limited by the structure of the data source
Use the tags
Can establish nested groupings
Example: CD Catalog XML data is grouped by CD. To change togroup by country, use the syntax below:
-
8/8/2019 44588045 Oracle XML Publisher Basics
34/37
Cell highlighting
Native XSL embedded within XMLP using xdofo:ctxcomponent
Example: Change cell color to red if debit amount >1000
-
8/8/2019 44588045 Oracle XML Publisher Basics
35/37
Page totals
Declare variable to hold page totals, following data element declaration
Display total field
Example: Suppose we want to total the field debit Create a page total variable called dt (it follows the placeholder)
Insert the show page total syntax in the page footer
Page totalling available only for PDF output type
-
8/8/2019 44588045 Oracle XML Publisher Basics
36/37
Conclusion36
Oracle XML Publisher offers you the most efficient, scalable reporting solution available
for complex, distributed environments.
Oracle XML Publisher reduces the high costs associated with the development,customization and maintenance of business documents.
-
8/8/2019 44588045 Oracle XML Publisher Basics
37/37
The author would love to get your comments on
abhijit673 @
Thank you37