Friday, 26 December 2014

Basics of XML Publisher

XML Publisher is used to Generate the Reports. The following are the steps need to follow while developing Report

1.)  Templates
2.)  Data Definitions

Create a Template and save it as RTF. Some of the basics things which are useful while developing a RTF are as follows.


Form Field
==========
138 Characters is the Maximum after that we can write in the Help Tab.

Templates
=========
Calling a Templage 
------------------------
<?call-template:Header?>

Template Definition
-------------------------
<?template:countdown?>
Temp_Param
Recursive_Template
<?end template?>

Simple if
========
<?xdofx:if COMM ='' then 'NULL' else ','?>

Simple Loop
===========
<?for-each:GROUP_NAE?> <?end for-each?>

Setting Variables
=================
<?xdoxslt:set_variable($_XDOCTX, 'net_amt', 0)?>  
<?xdoxslt:set_variable($_XDOCTX, 'dis_amt', 0)?>

Getting Variables
=================
<?xdoxslt:set_variable($_XDOCTX, 'net_amt', 0)?>  
<?xdoxslt:set_variable($_XDOCTX, 'dis_amt', 0)?>

Formatting Dates and Numbers
=============================
<?xdofx:to_char(PaymentDate,'DD-MON-YYYY')?>
<?format-number(PaymentAmount/Value, '#,##0.00;(-#,##0.00)')?>

Choose LayOut
=============
<?choose:?>
<?when:Payer/Address/Country='US'?>
<?Payer/Address/City?>
<?xdofx:if Payer/Address/State !='' then ',' end if?>
<?Payer/Address/S
<?end otherwise?>
<?end choose?>


Eg:2
<?choose:?><?when:Payer/Address/Country!='US'?>
<?Payer/Address/City?>
<?xdofx:if Payer/Address/State !='' then ',' end if?>
<?end otherwise?>
<?end choose?>

Number of Lines Per Pages
==========================
<?xdoxslt:set_variable($_XDOCTX, ’Counter’, 0)?> --outside the for-each 
<?xdoxslt:set_variable($_XDOCTX, ’Counter’, xdoxslt: get_variable($_XDOCTX, ’Counter’) + 2)?> 
<?if: xdoxslt:get_variable($_XDOCTX, ’Counter’) mod 10=0?> <?split-by-page-break:?> 
<?end if?> 


Adding Page Totals
==================

<?add-page-total:pt3;'COUNTED_VALUE'?>
<?add-page-total:pt2;'COUNTED_QTY'?>

Printing Page Total
====================

<?show-page-total:pt2?>
<?if:P_PRINT_ACTUAL_COUNTS='Y'?><?show-page-total:pt3?><?end if?>

Printing Numbers to Words
=========================
<?show-page-total:pt;'to_check_number:0;CASE_INIT_CAP'?>
<?show-page-total:pt2;'to_check_number:0;CASE_INIT_CAP'?>
<?show-page-total:pt3;'to_check_number:RUB;CASE_INIT_CAP;DECIMAL_STYLE_FRACTION2'?>

XXRL_UTILITIES_PKG.money_to_char(:AMT, :CURRENCY,'RU')


Printing Report Totals
======================
<?format-number:sum(ACCOUNTED_QTY);LC_FORMAT_STR?>
<?sum(ACCOUNTED_QTY)?>


Printing Serial Numbers
=======================
<?xdoxslt:set_variable($_XDOCTX, 'RTotVar', xdoxslt:get_variable($_XDOCTX, 'RTotVar') + 1)?>
<?xdoxslt:get_variable($_XDOCTX, 'RTotVar')?>

Printing Only the Decimal Part
==============================
<?xdofx:rpad(substr(ACTUAL_AMT_IN_NUM,instr(ACTUAL_AMT_IN_NUM, '.',1)+1),2,0)?>

Printing the Outer Group Value
========================
../../column_name

SUPPORTING Links
================
http://apps2fusion.com/apps/apps/155-xml-publisher-developing-reports-printed-on-pre-printed-stationary --nO. of Lines per page
http://docs.oracle.com/cd/E21764_01/bi.1111/e13881/T527073T558233.htm
https://community.oracle.com/thread/2379391?tstart=0
https://docs.oracle.com/cd/E10091_01/doc/bip.1013/b40017/T421739T481157.htm
https://docs.oracle.com/cd/E28280_01/bi.1111/e22254/extend_func.htm

Printing Serial Number Based on Condition
=================================
Initialize Variables
<?xdoxslt:set_variable($_XDOCTX, 'slno',0)?>
<?xdoxslt:set_variable($_XDOCTX, 'slf',0)?>

If Condition
<?if: string(../../INVOICE_NUM) != string((xdoxslt:get_variable($_XDOCTX,'slf')))?>
<?xdoxslt:set_variable($_XDOCTX, 'slf',string(../../INVOICE_NUM))?>
<?xdoxslt:set_variable($_XDOCTX, 'slno', xdoxslt:get_variable($_XDOCTX, 'slno') + 1)?>
<?end if?>

Print the Sl. No
 <?xdoxslt:get_variable($_XDOCTX, 'slno')?>

Date Field Issue Excel output  :
======================

When the date field prints in the Excel file

01-JAN-15    as    1-JAN-15    (This is Excel limitation)
12-FEB-15    as  12-FEB-15

But expected output is

01-JAN-15   (zero has to be there )
12-FEB-15

Solution:

Place the cursor in front of rtf tag  and use shift + ctrl+ Space Bar (Which is called non-breaking space)








No comments:

Post a Comment