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
====
for-each loop
• Define groups to notify XML Publisher to loop through repeating information
• Insert the following tag before the first element
<?for-each:XML group element tag name?>
• Insert the following tag after the last element
<?end for-each?>
• E.g. The XML group element tag name “G_INVOICE” for recurring invoice
information
<?for-each:G_INVOICE?>
……invoice lines……
<?end for-each?>
==
Data fields
• Placeholders map the template field to the XML data field
• Syntax - <?XML element tag name?>
• Placeholder must match XML element tag name exactly
• Case sensitive
• E.g. The placeholder <?TRX_NUMBER?> identifies the Invoice Number
====
Page Header/Footer
• Enclose the body area of the report within the following tags
<?start:body?>
<?end body?>
• Elements occurring before the <?start:body?> tag compose the header
• Elements occurring after the <?end body?> tag compose the footer
===
Page Numbering
• Use Microsoft Word page numbering
• From Insert menu, select Page Numbers
• Select the position, alignment and format as desired
===
Sorting
• Insert sort tag within the group
• <?sort:element name?>, for example to sort by transaction number
– Enter the following after the <?for-each:G_INVOICE?>
<?sort:trx_number?>
• No end tag
• Sort on multiple elements possible, use multiple sort tags
– Example: <?sort:trx_number?><?sort:trx_date?>
• Sort on calculated fields supported
====
Additional Sorting
• Sort order descending
• Data type sorting
– Number
– Date
• Separated by semi-colon (;)
• <?sort:trx_number;
data-type=‘number’;
order=‘descending’?>
===
Page Breaks
• Just before the <?end for-each?> tag either…
– Insert a Microsoft Page Break
• Insert->Break->Page Break
-or-
• <Ctrl> + <Enter>
– Use XML Publisher directive
• <?split-by-page-break:?>
• This avoids extra blank page at the end of report
====
Calculated Fields
• Use field names and operand(s)
– + - Addition
– - - Minus
– * - Multiplication
– / - Division
• Example <?field1 + field2?>
• Not required to be in form field
===
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 <?xdofx:function_name(params)?>
It is NOT case sensitive
Not required to be in a form field
===
Conditional logic
• Support for IF and CASE statements
• IF
– <?if:boolean_test?>
<?end if?>
– Example : to display only invoice lines with a line type of “LINE”
– Enclose the invoice line output within the tags below
• <?if:LINE_TYPE='LINE' ?>
• <?end if?>
CASE
<?choose?>
<?when:boolean_test?>
<?end when?>
<?otherwise?>
<?end otherwise?>
<?end choose?>
====
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
===
Dynamic data columns
Dynamic Column Header
<?split-column-header:group element name?>
Dynamic Column Data
<?split-column-data:group element name?>
Example: Print departments in column header and demand qty as column
data
Column header
<?split-column-header:G_DEPT_CLASS?><?DEPT_CLASS?>
Column data
<?split-column-data:G_DEPT_CLASS?><?SUM_QTY?>
====
Rows per page
Define row counter variable in a form field
<?xdoxslt:set_variable($_XDOCTX, ’Counter’, 0)?>
Increment counter for each line (again in a form field)
<?xdoxslt:set_variable($_XDOCTX, ’Counter’, xdoxslt:
get_variable($_XDOCTX, ’Counter’) + 1)?>
Break if the number of rows is reached (say 6 rows in this example)
<?if: xdoxslt:get_variable($_XDOCTX, ’Counter’) mod 6=0?>
<?split-by-page-break:?>
<?end if?
====
Last Page Only Content
• Create a section break in MSWord (Insert->Break->Section break Next
page)
• Insert the following syntax on the final page:
<?start@last-page:body?>
<?end body?>
• Content on the page above and below these tags will appear only on last
page
• Headers or footers previously defined for the report must be reinserted on
the last page
===
Re-grouping XML Data
Not limited by the structure of the data source
Use the tags
<?for-each-group: BASE-GROUP;GROUPING-ELEMENT?>
<?end for-each-group?>
Can establish nested groupings
<?for-each:current-group(); GROUPING-ELEMENT?>
<?end for-each-group?>
Example: CD Catalog XML data is grouped by CD. To change to group
by country, use the syntax below:
<?for-each-group:CD:COUNTRY?>
===
Cell highlighting
• Native XSL embedded within XMLP using xdofo:ctx component
• Example: Change cell color to red if debit amount > 1000
<?if:debit>1000?>
<xsl:attribute xdofo:ctx="block“
name="background-color">red
</xsl:attribute>
<?end if?>
===
Page totals
• Declare variable to hold page totals, following data element declaration
• <?add-page-total:TotalFieldName;'element'?>
• Display total field
• <?show-page-total:TotalFieldName;'Oracle-number-format'?>
• Example: Suppose we want to total the field “debit”
• Create a page total variable called “dt” (it follows the placeholder)
<?debit?><?add-page-total:dt;'debit'?>
• Insert the show page total syntax in the page footer
<?show-page-total:dt;'C9G990D00';'(C9G990D00)'?>
• Page totalling available only for PDF output type
===
Template Builder – Load XML Data
• First step - Load the sample XML output file using Data->Load XML Data
Template Builder – Inserting Placeholders
• Insert placeholders using Insert->Field menu option.
• Text form fields
• Tag name is visible by clicking the Add Help Text button within the Text form field
• Use Microsoft Word tables for better alignment
Template Builder Preview
• Preview template as PDF, HTML, Excel or RTF output
• Finetune till desired output is achieved
• Save template as .rtf file
Template Manager – E-Business Data Definition
• Navigate to XML Publisher Administrator responsibility
• Home->Data Definitions->Then Click on Create Data Definition button
• Enter details * Note: the Code is same as the concurrent program short
name – RAXINV_SEL
Template Manager – E-Business Template
• Navigate to XML Publisher Administrator responsibility
• Home->Templates>Then Click on Create Template button
• Assign the template to the Data Definition created earlier
• Upload the RTF file
Run concurrent using SRS
• Run the concurrent program using SRS
• Click Options button
• Select Output Layout Format – Default PDF
==
Exceptions
• Navigate System Administrator->Concurrent->Manager->Administer
• Select Output Post Processor
• Click on Processes button
• Select the active process
• Click on Manager Log button
• Review the log for exceptions
• More details and options for debugging – Refer Metalink Note 364547.1
==
References and more info.
• XML Publisher Blog
– http://blogs.oracle.com/xmlpublisher/
• XML Publisher Oracle Product Site
– http://www.oracle.com/technology/products/xml-publisher/index.html
• XML Publisher Forum
– http://forums.oracle.com/forums/forum.jspa?forumID=245
• User Guides
– Oracle XML Publisher User’s Guide
– Oracle XML Publisher Report Designer’s Guide
• Metalink Notes
– Metalink Note 422508.1 – About XML Publisher Release 5.6.3
– Metalink Note 364547.1 - Troubleshooting Oracle XML Publisher for Oracle Applications 11i
• Oracle Tutorial for XML Publisher for EBS
– http://www.oracle.com/technology/obe/obe_bi/xmlp_ebiz/index.html
==
• 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
====
for-each loop
• Define groups to notify XML Publisher to loop through repeating information
• Insert the following tag before the first element
<?for-each:XML group element tag name?>
• Insert the following tag after the last element
<?end for-each?>
• E.g. The XML group element tag name “G_INVOICE” for recurring invoice
information
<?for-each:G_INVOICE?>
……invoice lines……
<?end for-each?>
==
Data fields
• Placeholders map the template field to the XML data field
• Syntax - <?XML element tag name?>
• Placeholder must match XML element tag name exactly
• Case sensitive
• E.g. The placeholder <?TRX_NUMBER?> identifies the Invoice Number
====
Page Header/Footer
• Enclose the body area of the report within the following tags
<?start:body?>
<?end body?>
• Elements occurring before the <?start:body?> tag compose the header
• Elements occurring after the <?end body?> tag compose the footer
===
Page Numbering
• Use Microsoft Word page numbering
• From Insert menu, select Page Numbers
• Select the position, alignment and format as desired
===
Sorting
• Insert sort tag within the group
• <?sort:element name?>, for example to sort by transaction number
– Enter the following after the <?for-each:G_INVOICE?>
<?sort:trx_number?>
• No end tag
• Sort on multiple elements possible, use multiple sort tags
– Example: <?sort:trx_number?><?sort:trx_date?>
• Sort on calculated fields supported
====
Additional Sorting
• Sort order descending
• Data type sorting
– Number
– Date
• Separated by semi-colon (;)
• <?sort:trx_number;
data-type=‘number’;
order=‘descending’?>
===
Page Breaks
• Just before the <?end for-each?> tag either…
– Insert a Microsoft Page Break
• Insert->Break->Page Break
-or-
• <Ctrl> + <Enter>
– Use XML Publisher directive
• <?split-by-page-break:?>
• This avoids extra blank page at the end of report
====
Calculated Fields
• Use field names and operand(s)
– + - Addition
– - - Minus
– * - Multiplication
– / - Division
• Example <?field1 + field2?>
• Not required to be in form field
===
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 <?xdofx:function_name(params)?>
It is NOT case sensitive
Not required to be in a form field
===
Conditional logic
• Support for IF and CASE statements
• IF
– <?if:boolean_test?>
<?end if?>
– Example : to display only invoice lines with a line type of “LINE”
– Enclose the invoice line output within the tags below
• <?if:LINE_TYPE='LINE' ?>
• <?end if?>
CASE
<?choose?>
<?when:boolean_test?>
<?end when?>
<?otherwise?>
<?end otherwise?>
<?end choose?>
====
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
===
Dynamic data columns
Dynamic Column Header
<?split-column-header:group element name?>
Dynamic Column Data
<?split-column-data:group element name?>
Example: Print departments in column header and demand qty as column
data
Column header
<?split-column-header:G_DEPT_CLASS?><?DEPT_CLASS?>
Column data
<?split-column-data:G_DEPT_CLASS?><?SUM_QTY?>
====
Rows per page
Define row counter variable in a form field
<?xdoxslt:set_variable($_XDOCTX, ’Counter’, 0)?>
Increment counter for each line (again in a form field)
<?xdoxslt:set_variable($_XDOCTX, ’Counter’, xdoxslt:
get_variable($_XDOCTX, ’Counter’) + 1)?>
Break if the number of rows is reached (say 6 rows in this example)
<?if: xdoxslt:get_variable($_XDOCTX, ’Counter’) mod 6=0?>
<?split-by-page-break:?>
<?end if?
====
Last Page Only Content
• Create a section break in MSWord (Insert->Break->Section break Next
page)
• Insert the following syntax on the final page:
<?start@last-page:body?>
<?end body?>
• Content on the page above and below these tags will appear only on last
page
• Headers or footers previously defined for the report must be reinserted on
the last page
===
Re-grouping XML Data
Not limited by the structure of the data source
Use the tags
<?for-each-group: BASE-GROUP;GROUPING-ELEMENT?>
<?end for-each-group?>
Can establish nested groupings
<?for-each:current-group(); GROUPING-ELEMENT?>
<?end for-each-group?>
Example: CD Catalog XML data is grouped by CD. To change to group
by country, use the syntax below:
<?for-each-group:CD:COUNTRY?>
===
Cell highlighting
• Native XSL embedded within XMLP using xdofo:ctx component
• Example: Change cell color to red if debit amount > 1000
<?if:debit>1000?>
<xsl:attribute xdofo:ctx="block“
name="background-color">red
</xsl:attribute>
<?end if?>
===
Page totals
• Declare variable to hold page totals, following data element declaration
• <?add-page-total:TotalFieldName;'element'?>
• Display total field
• <?show-page-total:TotalFieldName;'Oracle-number-format'?>
• Example: Suppose we want to total the field “debit”
• Create a page total variable called “dt” (it follows the placeholder)
<?debit?><?add-page-total:dt;'debit'?>
• Insert the show page total syntax in the page footer
<?show-page-total:dt;'C9G990D00';'(C9G990D00)'?>
• Page totalling available only for PDF output type
===
Template Builder – Load XML Data
• First step - Load the sample XML output file using Data->Load XML Data
Template Builder – Inserting Placeholders
• Insert placeholders using Insert->Field menu option.
• Text form fields
• Tag name is visible by clicking the Add Help Text button within the Text form field
• Use Microsoft Word tables for better alignment
Template Builder Preview
• Preview template as PDF, HTML, Excel or RTF output
• Finetune till desired output is achieved
• Save template as .rtf file
Template Manager – E-Business Data Definition
• Navigate to XML Publisher Administrator responsibility
• Home->Data Definitions->Then Click on Create Data Definition button
• Enter details * Note: the Code is same as the concurrent program short
name – RAXINV_SEL
Template Manager – E-Business Template
• Navigate to XML Publisher Administrator responsibility
• Home->Templates>Then Click on Create Template button
• Assign the template to the Data Definition created earlier
• Upload the RTF file
Run concurrent using SRS
• Run the concurrent program using SRS
• Click Options button
• Select Output Layout Format – Default PDF
==
Exceptions
• Navigate System Administrator->Concurrent->Manager->Administer
• Select Output Post Processor
• Click on Processes button
• Select the active process
• Click on Manager Log button
• Review the log for exceptions
• More details and options for debugging – Refer Metalink Note 364547.1
==
References and more info.
• XML Publisher Blog
– http://blogs.oracle.com/xmlpublisher/
• XML Publisher Oracle Product Site
– http://www.oracle.com/technology/products/xml-publisher/index.html
• XML Publisher Forum
– http://forums.oracle.com/forums/forum.jspa?forumID=245
• User Guides
– Oracle XML Publisher User’s Guide
– Oracle XML Publisher Report Designer’s Guide
• Metalink Notes
– Metalink Note 422508.1 – About XML Publisher Release 5.6.3
– Metalink Note 364547.1 - Troubleshooting Oracle XML Publisher for Oracle Applications 11i
• Oracle Tutorial for XML Publisher for EBS
– http://www.oracle.com/technology/obe/obe_bi/xmlp_ebiz/index.html
==
No comments:
Post a Comment