Friday, 6 January 2017

USEFULL XML TAGS IN BI PUBLISHER

XSL Equivalents
The following table lists the BI Publisher simplified syntax with the XSL equivalents.
Supported XSL Elements
Description
BI Publisher Syntax
<xsl:value-of select= "name">
Placeholder syntax
<?name?>
<xsl:apply-templates select="name">
Applies a template rule to the current element's child nodes.
<?apply:name?>
<xsl:copy-of select="name">
Creates a copy of the current node.
<?copy-of:name?>
<xsl:call-template name="name">
Calls a named template to be inserted into/applied to the current template.
<?call:name?>
<xsl:sort select="name">
Sorts a group of data based on an element in the dataset.
<?sort:name?>
<xsl:for-each select="name">
Loops through the rows of data of a group, used to generate tabular output.
<?for-each:name?>
<xsl:choose>
Used in conjunction with when and otherwise to express multiple conditional tests.
<?choose?>
<xsl:when test="exp">
Used in conjunction with choose and otherwise to express multiple conditional tests
<?when:expression?>
<xsl:otherwise>
Used in conjunction with choose and when to express multiple conditional tests
<?otherwise?>
<xsl:if test="exp">
Used for conditional formatting.
<?if:expression?>
<xsl:template name="name">
Template declaration
<?template:name?>
<xsl:variable name="name">
Local or global variable declaration
<?variable:name?>
<xsl:import href="url">
Import the contents of one stylesheet into another
<?import:url?>
<xsl:include href="url">
Include one stylesheet in another
<?include:url?>
<xsl:stylesheet xmlns:x="url">
Define the root element of a stylesheet
<?namespace:x=url?>

xml tags:
---------
<?if@row:SAL>3000?> 
<xsl:attribute xdofo:ctx="incontext" name=background-color">red
<?end if?>

<?if@row:SAL<2000?>
<xsl:attribute name="background-color"  xdofo:ctx="incontext">silver</xsl:attribute><?end if?>
<?if@row:SAL>3000?>
<xsl:attribute name="background-color"  xdofo:ctx="incontext">red</xsl:attribute>
<?end if?>

<?if@row:SAL>3000?>
 <xsl:attribute name="background-color"  xdofo:ctx="incontext">red</xsl:attribute>
<?end if?>

To apply colors in column depending on condition:
----------------------------------------------------------------
<?if:SAL>5000?>
<xsl:attribute xdofo:ctx="block" name="background-color"> red</xsl:attribute>
<?end if?>

Column level color:
----------------------
<xsl:attribute xdofo:ctx="block" name="background-color">green</xsl:attribute>

To apply colors in row level based on condition:
-------------------------------------------------------------
<?if@row:SAL>5000?>
<xsl:attribute xdofo:ctx="block" name="background-color"> red</xsl:attribute>
<?end if?>

<?if:position() mod 4=0?>
<xsl:attribute name="break-before">page</xsl:attribute>
<?end if?>

<?if:count(G_ENAME)=0?> No data found<?end if?>

<?start@last-page-first:body?> <?end body?>
This is last page
need search

or

<?if:position() = last()?>
                  --------------- Reports is ended bosss-----------------
<? end if ?>


<?if:position() >=1?>
                  --------------- Reports is ended bosss-----------------
<? end if ?>

page total
-------------
<?add-page-total:pagetot;'SAL'?>   dummy column beside the column(means ex:sal) in insideof for-each ex:sal and comm
<?show-page-total:pagetot;’999G999D99’?>   out of foreach just print any where in page

Running total print
-------------------------
1.<?xdoxslt:set_variable($_XDOCTX, 'R', 0)?>   declare this tag  out of foreach just print any where in page

2.<?xdoxslt:set_variable($_XDOCTX, 'R', xdoxslt:get_variable($_XDOCTX,'R') + SAL)?>
<?xdoxslt:get_variable($_XDOCTX, 'R')?>  delare this inside of for loop and take one separate column like empno,sal and
add the showing second tag in helptext field than this tag get the data like sum of sal

Choose condition:
---------------------
take the separate column and paste this in Form field help text inside of For each group.

<?choose:?>
<?when: .//SAL>3000?>
 higher
<?end when?>
<?when: .//SAL<2000?>
lower
<?end when?>
<?otherwise:?>
 equal
<?end otherwise?>
<?end choose?>

How to insert page numbers:
---------------------------------
first select the header/footer options in view .in header section draw table like column one
after put the cursor on that table next go to insert take page numbers option.ofter run the template .it will show the page
numbers.

or

Now i want to print page numbers and also total page number:
--------------------------------------------------------------------------------
first select the header/footer options in view .in header section draw table like column one
after put the cursor on that table next go to insert take field option-->choose the numpages-->click on OK button.
after run the template we will see like (1/3,2/3,3/3)
here 1,2,3 are page numbers and 3 is total page number.

GROUP BY:
----------------
<?for-each-group:G_ENAME;./DEPTNO?> 
<?sort:DEPTNO;'descending';data-type='number'?>

In above tag display the table data department wise. place this tag outside for-each
 <?for-each-group:ROW;./DNAME?>
<?sort:DNAME;'ascending';data-type='text'?>  <?end for-each-group?>
 The above command is specifying that the ROW group should be then grouped by DNAME.


Currency conversion from number to word:
--------------------------------------------------------
<?xdoxslt:toWordsAmt(round(CS_1))?> 


For system date:
---------------------
Customized ---->     Date:<?xdoxslt:sysdate(‘DD/MM/YYYY’)?>
                     Date: <?xdoxslt:sysdate(‘DD:MM:YYYY  HH:MI:SS’)?>     
Standard ------>     Date: <?xdoxslt:sysdate()?>

Apply color to the  SAL>3000 in SAL column using xml tag:
---------------------------------------------------------
<?if:SAL>3000?>
<xsl:attribute xdofo:ctx="block" name="background-color"> red</xsl:attribute>
<?end if?>

Row level inside the for each group:
---------------------------------------------
<?if@row:SAL>3000?> 
<xsl:attribute xdofo:ctx="block" name="background-color"> red</xsl:attribute> 
<?end if?>

Using position:
------------------
<?if:position() mod 5=0?>
<xsl:attribute name=”break-before”></xsl:attribute>
<?end if?>

<?if@row:position() mod 5=0?>
 <xsl:attribute name="background-color"  xdofo:ctx="incontext">red</xsl:attribute>
<?end if?>

To print deptno descending order:
--------------------------------------------
<?for-each-group:G_ENAME;./DEPTNO?> 
<?sort:DEPTNO;'descending';data-type='number'?>
<?end for-each-group?>

To start body and end body:
-----------------------------------
<?body-start?>
<?body-end?>

To add format to salary:
-------------------------
<?format-number(SELLING_PRICE1,'0.0000')?>

To write description:
---------------------
<?if: CS_MPA_DISP !=0?> Material Price Adjustment <?end if ?>

Calling template at header/footer level:
----------------------------------------------
<?template:footer?>
<?end template?>
if you want to call template footer body in footer section than use given tag
<?call:footer?>
or
<?template:header?>
<?end template?>
if you want to call template header body in header section than use given tag
<?call:header?>
or
<?template:header?>
EMPLOYEE DETAILS
<?end template?>             //WRITE THESE IN HEADER FORM AND CALL IN THE WORKING
<?call-template:header?>  //WRITE THESE WHERE U NEED

If condition for for invoice:
-----------------------------
<?if: TRANSACTION_TYPE_NAME >= ‘Invoice’?> Please Pay this Amount: <?end if ?>
<?if: TRANSACTION_TYPE_NAME != ‘Invoice’?> Amount Credited: <?end if ?>

sum the salary column wise:
-----------------------------------
SUM:<?2+3?>
<?xdoxslt:sum(SAL)+xdoxslt:sum(COMM)?>
<?sum(current-group()//SAL)?>  //when ever we use double group it shows total sal for current group

PAGE BREAK:
-------------------
<?split-by-page-break:?>
(OR)
<?for-each-group@section:G_EMPNO;DEPTNO?>//AUTOMATICALLY IT SPLIT DEPT WISE

ADD & SHOW PAGE TOTAL:
--------------------------------------
<?add-page-total:t;’SAL’?>
<?show-page-total:t?>

SET PASSWORD THAT OUTPUT IS NOT SEEN IN PDF FROMAT:
------------------------------------------------------------------------------------------
1) Open the .rtf
2) Go to File - > Properties
     Create a new custom property
a)  Name   : xdo-pdf-open-password
     Type     : text
     Value    : Either Hard Code the vale / or get the value for xml data
b) Name :  xdo-pdf-security
     Type   :  text
     Value  : true

Concatenation tag:
------------------------
<?xdofx:rpad(FIRST_NAME||LAST_NAME),30,'x')?>
<?value-of:concat(Payee/Address/City,’, ‘,Payee/Address/State)?>

If tag:
-------
<?IF:COMM=’’?>SRY<?END IF?><?IF:COMM!=’’?><?COMM?><?END IF?>

Else if:
--------
<?xdofx:if COMM!='' then SAL+COMM else SAL end if?>

DECODE TAG:
---------------------
<?xdofx:decode(COMM,’’,’sry’,COMM)?>
<?xdofx:decode(COMM,’’,ENAME,COMM||’, ’||ENAME)?>

CHR:
-------
<?xdofx:chr(65)?>
<?xdofx: to_char(sysdate,'dd-mm-yyyy')?>

ROUND:
-----------
<?xdofx: round(9.6)?>

PAGE LAYOUT:
----------------------
IT DISPLAYS INFORMATION LIKE NOTE,TERMS ETC IN THE ODD OR EVEN PAGE.
IN HEADERS AND FOOTERS REGION WE CAN DISPLAY GO TO FILE AND SELECT PAGE SETUP AND
SELECT LAYOUT TAB THERE CHECK THE OPTIONS.
<?section:force-page-count;'end-on-odd-layout'?>
<?section:force-page-count;'end-on-even-layout'?>


OUT SIDE FORMULA COLUMN:
------------------------------------------
function CF_1Formula return Date is
dnm    varchar2(30);
begin
  :cp_1:=SYSDATE;----dynamic current date.
  :cp_3:=:dno;----it is for dynamic deptno
  select dname into dnm from dept where deptno=:dno;--it is for dynamic dname
  :cp_4:=dnm;
  return :cp_1;  end;
IN SIDE FORMULA COLUMN:
----------------------------------------

function CF_2 Formula return Number is
begin
  :cp_2:=(:sal+nvl(:comm,0));----FOR TOTAL AMT
  :CP_5:=NVL(:COMM,0);----where comm is null there assign zero.
  return :cp_2;
end;

MS Word 2003 - rtf Template
--------------------------------------
* Insert a dummy image in the template.
* Right Click --> In the Format Picture dialog box select the Web tab.
* Enter the following syntax in the Alternative text region to reference the image URL:
* url:{'http://image location'}
e.g.: url:{'http://www.oracle.com/images/ora_log.gif'}

MS Word 2007 -- rtf Template
---------------------------------------
* Insert a dummy image in the template.
* Right click --> Size
* Enter the following syntax in the Alternative text region to reference the image URL:
* url:{'http://image location'}
e.g.: url:{'http://www.oracle.com/images/ora_log.gif'}

Type of User Exits

SRW.USER_EXIT (‘FND SRWINIT’);
SRW.USER_EXIT (‘FND SRWEXIT’);
SRW.USER_EXIT (‘FND FLEXSQL’);
SRW.USER_EXIT (‘FND FLEXVALID’);
SRW.USER_EXIT (‘FND FORMAT_CURRENCY’);

Description

1)  SRW.USER_EXIT (‘FND SRWINIT’);
                Is used to initialize profile values.

2)  SRW.USER_EXIT (‘FND SRWEXIT’);
      Is used to free the memory allocated.

3)       SRW.USER_EXIT (‘FND FLEXSQL’);
                Is used to capture description of code combinations.

4)  SRW.USER_EXIT (‘FND FLEXVALID’);
      Is used to capture code combination ID.

5)  SRW.USER_EXIT (‘FND FORMAT_CURRENCY’);
      Is used to format currency.

Where the five User Exits are used

In Before Report trigger
SRW.USER_EXIT (‘FND SRWINIT’);
SRW.USER_EXIT (‘FND FLEXSQL’);
SRW.USER_EXIT (‘FND FLEXVALID’);
SRW.USER_EXIT (‘FND FORMAT_CURRENCY’);
In After Report trigger
SRW.USER_EXIT (‘FND SRWEXIT’);