1) ‘IF ELSE’ condition in XML publisher
XML Publisher supports the common programming construct “if-then-else”. This is extremely useful when you need to test a condition and conditionally show a result. For example:
IF X=0 THEN
Y=2
ELSE
Y=3
END IF
You can also nest these statements as follows:
IF X=0 THEN
Y=2
ELSE
IF X=1 THEN
Y=10
ELSE Y=100
END IF
Use the following syntax to construct an if-then-else statement in your RTF template:
<?xdofx:if element_condition then result1 else result2 end if?>
|
For example, the following statement tests the AMOUNT element value. If the value is greater than 1000, show the word “Higher”; if it is less than 1000, show the word “Lower”; if it is equal to 1000, show “Equal”:
<?xdofx:if AMOUNT > 1000 then 'Higher'
|
if AMOUNT < 1000 then 'Lower'
|
Else
|
|
'Equal'
|
end if?>
|
|
|
|
|
|
|
|
2) How to get SYSDATE in the header section dynamically when we run the report
You cannot insert form fields in the Header section, but you can just insert the code to achieve this. For example: insert this in the header section to view the sysdate: You could format the date as you would like..
<?xdofx: sysdate(‘YYYY-MM-DD’)?>
3) What are the XML publisher tables?
PER_GB_XDO_TEMPLATES
XDO_DS_DEFINITIONS_B
XDO_DS_DEFINITIONS_TL
XDO_DS_DEFINITIONS_VL
XDO_LOBS
XDO_TEMPLATES_B
XDO_TEMPLATES_TL
XDO_TEMPLATES_VL
XDO_TEMPLATE_FIELDS
XDO_TRANS_UNITS
XDO_TRANS_UNIT_PROPS
XDO_TRANS_UNIT_VALUES
4) How to write a loop in rtf template design?
<? For-each:G_invoice_no?>
……………………..<? End for each?>
5) How to design sub templates in rtf layout?
Using following tags..
<? Template: template_name?>
This is Last Page
6) How to call a header or footer?
Using this tag
<?call:header?> and <?call:footer?>
We have to use header section and footer section of the page.
7) How to break the page in specific condition?
<?split-by-page-break:?>
8) How to use section break?
<?for-each@section:G_CUSTOMER(This is group name)?>
9) How to create multi layouts in XMLP?
<?choose:?>
<?when:CF_CHOICE=’VENDOR’?>
Your template….
<?end when?>
<?when:CF_CHOICE=’INVOICE’?>
Your template….
<?end when?>
<?when:CF_CHOICE=’RECEIPT’?>
Your template….
<?end when?>
<?end choose?>
10) How to submit a layout in the backend?
we have to write a procedure for this using the below code
FND_REQUEST.ADD_LAYOUT ( TEMPLATE_APPL_NAME => 'application name',
TEMPLATE_CODE => 'your template code',
TEMPLATE_LANGUAGE => 'En',
TEMPLATE_TERRITORY => 'US',
OUTPUT_FORMAT => 'PDF'
);
11) How to display the images in XMLP?
url:{'http://image location'}
For example, enter:
url:{'http://www.oracle.com/images/ora_log.gif'}
url:{'${OA_MEDIA}/image name'}
12) How to pass the page numbers in rtf layout?
<REPORT>
<PAGESTART>200<\PAGESTART>
....
</REPORT>
13) How to display last page is differently in XML Publisher Reports.
<?start@last-page-first:body?> <?end body?>
14)Hide a Field in Oracle XML Publisher
If You Want to Hide a Field:
<?if@column:FIELD!=' '?><?FIELD?><?end if?>
15) Displaying Page Totals in XML Publisher
Add the below tag in the loop (with in for-each)
<?add-page-total:’INV_AMT’;’INVOICE_AMT_PT’?>
Here INV_AMT is a field name and INVOICE_AMT_PT is a varable which stores the page total.
To show the page total , add the below tag in the footer or Header
<?show-page-total: INVOICE_AMT_PT;’999G999D99’?>
XML Publisher Report Syntax
Sub Templates:
<?template:header?>
This is Last Page
<?end template?>
After that you can type in header or footer section,
<?call:header?>
Last Page:
Take the any one of the insert field type in the following syntax,
Suppose,
Field name : Last page body
Status bar: <?start@last-page-first:body?><?end body?>
This is last page
Page Break:
<?split-by-page-break:?>
Section Break:
<?for-each@section:G_CUSTOMER(This is group name)?>
Properties:
<?PASSWORD?>
In XML we have to write in,
<PASSWORD>welcome</PASSWORD>
Bar Code:
<?register-barcode-vendor:'oracle.apps.xdo.template.rtf.util.barcoder.BarcodeUtil';'XMLPBarVendor'?>
<?format-barcode:JOB;'code128a';'XMLPBarVendor'?>
Conditional Formating:
<?if:ACCTD_AMT(This is column name)<1000?><xsl:attribute xdofo:ctx="block" or “incontext” name="font-weight">bold</xsl:attribute><?end if?>
Incontext means: column level
Block means: row level
Multi Layout:
<?choose:?>
<?when:CF_CHOICE=’VENDOR’?>
<?end when?>
<?when:CF_CHOICE=’INVOICE’?>
<?end when?>
<?when:CF_CHOICE=’PO’?>

<?end when?>
<?end choose?>
Running Total:
<?xdoxslt:set_variable($_XDOCTX, 'RTotVar', xdoxslt:get_variable($_XDOCTX, 'RTotVar') + ACCTD_AMT(This is column name) )?><?xdoxslt:get_variable($_XDOCTX, 'RTotVar')?>
RTotVar means declare variable=0
Brought forward and carried Forward:
<xdofo:inline-total display-condition="exceptlast" name="InvAmt"><xdofo:show-carry-forward name="InvAmt" format="99G999G999D00" number-separators=",."/></xdofo:inline-total>
Carried Forward:
<xdofo:inline-total display-condition="exceptfirst" name="InvAmt"><xdofo:show-brought-forward name="InvAmt" format="99G999G999D00" number-separators=",."/></xdofo:inline-total>
Page Total:
<?add-page-total:’INV_AMT’;’INVOICE_AMT_PT’?>
<?show-page-total: INVOICE_AMT_PT;’999G999D99’?>
Repeating Headre:
For loop
<?for-each:G_CUSTOMER?>
<?end for-each?>
WATERMARK
PAGE LAYOUTàWATERMARK (Word 2007)
Format à Backgroundà Printed Watermark (Word 2003)
TEXT FIELD
Developeràcontrolsàlegacy toolsàtext field
CONDITIONAL FORMATTING
The XSL code you need is:
<?if:TRANS_AMOUNT_REMAINING >1000?>
<xsl:attribute xdofo:ctx="block" name="background-color">red</xsl:attribute>
<?end if?>
BARCODE
Select File à Properties à Custom Tab
In the Name field enter: xdo-font.Free 3 of 9.normal.normal – notice the name of the font must match the name of the font in the MSWord font drop down
In the Value field enter: truetype.c:\windows\fonts \FREE3OF9.ttf
SORTING:
<?sort:TRANS_AMOUNT;'ascending';data-type='text'?>
DIFFERENT LAST PAGE:To utilize this feature, you must create a section break in your template to ensure the content of the final page is separated from the rest of the report and Insert the following syntax on the final page:
<?start@last-page:body?>
<?end body?>
What is Bursting in XML Publisher?
Lets say we have information of 100 different Customer Invoices in a single report. In case of bursting, XMLP engine upon a predefined criteria (Bursting criteria), helps generates single output file for each customer invoice i.e. 100 report files for 100 Customer Invoices and emails each report output file individually. We can even fax the output.
Bursting Criteria is nothing but a grouping criteria upon which report output gets splitted.
How to use Variables in XMLP
Declaring the Variable R and Assigning the Values 4 to R
<?xdoxslt:set_variable($_XDOCTX, ‘R’, 4)?>
Get the Variable value
<?xdoxslt:get_variable($_XDOCTX, ‘R’)?>
This adds 5 to variable R and displays it
<?xdoxslt:set_variable($_XDOCTX, ‘R’, xdoxslt:get_variable($_XDOCTX, ‘R’)+5)?>
This subtracting 2 to varaible R and displays it
<?xdoxslt:set_variable($_XDOCTX, ‘R’, xdoxslt:get_variable($_XDOCTX, ‘R’)-2)?>
Setting the Password for PDF File sent through XML Publisher
Open the rtf for which you want to set password and do the following things
1) Open the .rtf
2) Go to File – > Properties
Create a new custom property
a) Name :xdo-pdf-security
Type : text
Value :true
b) Name : xdo-pdf-open-password
Type : text
Value : password
<PASSWORD>welcome</PASSWORD>