Saturday, August 7, 2010

XML/BI Publisher Basics

1.      What is a template Builder?

The Template Builder is an extension to Microsoft Word that simplifies the development of RTF templates. The Template Builder is tightly integrated with Microsoft Word and allows you to perform the following functions:
•        Insert data fields
•        Insert data-driven tables
•        Insert data-driven forms
•        Insert data-driven charts
•        Preview your template with sample XML data
•        Browse and update the content of form fields
•        Extract boilerplate text into an XLIFF translation file and test translations
Valid template file types are:
eText - Inbound, eText - Outbound, PDF, RTF, XSL-FO, XSL-HTML, XSL-TEXT, and XSL-XML.

2.      Sub Template into Main Template:
Import the subtemplate

In the subtemplate we are calling

3.      Translatable (check box)
Select this check box if you want this template to be translatable. Only RTF templates are translatable. After the template definition is created, the following fields are not updateable: Application, Code, and Type. Update the template from the View Template page.

4.      To handle parameterized layout
If the requirement is to display a different layout based on a user parameter value or a List of Value selection, then the parameter can be passed to RTF layout and conditionally display the layout.
On the Report Editor you first need to define a parameter with name DeptName. If this parameter has to be associated with a List of Value (LOV), then create a LOV on the Report Editor page.
Next, in the parameter definition select parameter type as “Menu” and then select the LOV from the selection.
In the RTF template define a parameter using syntax -
Now when user selects a department name from the List of Value on the report viewer page, the value gets passed to RTF layer into the DeptName parameter. To display the layout based on this user selection, you can use an IF statement or a CHOOSE statement to evaluate the parameter value and call the associated sub template.
Use CHOOSE statement when too many conditional tests are to be done and a default action is expected for rest of the values, for example, for each department here we have a different sub template and if the user parameter has a department name with no associated sub template, then a default sub template can be called in otherwise section.

Format à Backgroundà Printed Watermark (Word 2003)

6.      TEXT FIELD
Developeràcontrolsàlegacy toolsàtext field

7.      Add Totalà Sum in calcualtion in a new row.

8.      Adding Page/Brought Forward/Carried Forward Total
Placed before the column nameà PT

9.      Display Page Total in Footer
<xdofo:show-page-total name="pt" format="99G999G999D00"/>

10.  Display Brought Forward Total in Header

11.  Display Carried Forward Total in Footer

The values for the form fields in the template are shown in the following table:

Form Field
Declares the "RTotalVar" variable and initializes it to 0.
Starts the Invoice group.
Invoice Number tag
Invoice Date tag

xdoxslt:get_variable($_XDOCTX, 'RTotalVar')?>
Sets the value of RTotalVar to the current value plus the new Invoice Amount.
Retrieves the RTotalVar value for display.
Ends the INVOICE group.

  1. For loop

In order to have different set of page number for each customer’s document you can use a section break.
Double click on the first ‘for-each’ for Customer Name text form.
Change the ‘for-each’ loop to ‘for-each@section’
Click OK.

The XSL code you need is:

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

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:

18.  CHART
Follow the following steps to modify the XSL definition.
Double click on the Chart image
Click Web tab
Change it to
Notice the extra ‘/’ between ‘current-group() and ‘TRANS_AMOUNT’.

·         Type and remove CUSTOMER_NAME text form, this is because the Table of Content function can not handle the text form.
·         Change the font setting for the to be ‘Heading 1’.
·         Insert a section break before the first page header so that you will have a blank page as the first page. You can use MS Word’s section break for this. (Insert->Break->Section Break->Next Page)
·         Move to the inserted first page and place your mouse cursor into the first page.
·         Click Insert from the tool menu and select Reference-> Index and Tables
·         Click Table of Content tab and choose how you want to display your Table of Contents
·         Click OK.
·         Make sure that the table of contents has tag inserted.


  1. Add the following tag before the table of contents.
  2. Add the following tag after the table of contents.

  • Create a new RTF template
  • Load Crosstab_Sample_Data.xml
  • Go to File->Page Setup and choose Landscape as Orientation
  • Select Crosstab from the Template Builder tool bar. (Insert->Crosstab)
  • Drag and Drop ‘Flows’to data area
  • Drag and Drop ‘Bus Grp’ to Row Header area
  • Drag and Drop ‘Type’ to Column Header area
  • Click OK.

21.  Bursting
What is a bursting file ?
Its an XML file which tells bursting engine
a)      to split the XML File created.
b) to deliver the Documents.
Advantages of XMLP bursting
a. No Additional Coding, just need to create XML bursting File. ( Isn't it exciting , otherwise we would have to write java program to split the XML File and then use XMLP delivery manager API to send emails .
b. Process of Creating XML data Definition and Template remains AS – IS .
22.  BLOB & CLOB
  • Can’t generate xml data for CLOB more than 40 kb in report builder.
  • BLOB Images are supported in XML Publisher 5.6.2 or later.
  • Encode BLOB to CLOB use this following function:
    CREATE FUNCTION getbase64( p_source BLOB )
    v_result CLOB;
    DBMS_LOB.createtemporary(lob_loc => v_result, CACHE => FALSE, dur => 0);
    Wf_Mail_Util.EncodeBLOB ( p_source, v_result);
    RETURN ( v_result );
    END getbase64;
  • To show BLOB Images use the following code:
  • XML Publisher supports in general right now only JPG, GIF and PNG.

No comments:

Post a Comment