Tuesday, June 21, 2016

Simple RTF Template report in BI Publisher

RTF- Rich Text Format is a document file format which is used for common word processing applications such as Microsoft Word. Word file is saved as a RTF just by giving ‘.rtf’ extension to the file name. This file format is very useful and easy to create reports for business scenario accomplished with oracle’s Business Intelligence Publisherknown as BI publisher.
This is a very powerful and efficient tool for creating business reports. There is tons of content to learn about BI publisher. We will start learning this one by one so let’s start with creating one simple report.
For that we require one XML file as input or to load into RTF. Consider a book.xml which is easily available on web and you can easily access it for practice. I paste some sample XML data from book.xml so that you can identify and use same XML.
XML Data
Now we have to create report considering following one simple requirement.

Requirement:

Get the detail list of the books of ‘Price’<10.

Solution:

Now for the given XML there are 12 books. We have to filter out those books from the list which has their price less than 10. First of all we will list the total book-list then will try to apply this filter to get the requirement work. Now to get the list of total books we will proceed step by step.
Step #1: Create RTF file.
Open a blank word document. Save that word document with ‘.rtf’ extension. Lets give here ‘books.rtf’.
Step #2: Load the XML.
Now we have to load that Books.xml into created Books.rtf. To do this, click on the ‘Add-Ins’ from the title bar of word file. Following window will pop up.
Load XML Data
Click on ‘Data’ and then ‘Load XML Data’. Refer below image.
Load XML Data 1
Then you have to select the XML which you want load into RTF. If the XML load is successful then following window will pop up.
Load successful
Step #3: Insert Table.
As the XML is loaded successfully next step we have to get the table form of this XML data. To do so navigate to ‘Insert’ tab which is next to ‘Data’. Refer above image. After that select Table wizard as shown in below image.
Insert Table
After selecting ‘Table Wizard’ following window will pop up.
Insert Table 1
Select ‘Table’, click on ‘Next’. You will see the hierarchies available in loaded XML. But for our XML there is only one so its showing that one as default. Refer below image. Click ‘Next’
Insert Table 2
Insert Table 3
Above image shows list of all the field names for particular Book ID tab. You can select which are necessary. In our case we have to get detailed list so will select all field names. Those which are selected will get shifted to the right pane as below.
Insert Table 3

If we click on ‘Next’, click on ‘Finish’. Following table will get loaded in your RTF pane.
Table form
You can adjust the column width, font, font size, column header etc. as per your requirement.
Step #4:After this table get inserted we have to check it’s giving correct output or not. To do so navigate through ‘Preview’ tab. You will find options like PDF, HTML etc. refer below image. You will get the idea.
PREVIEW tab
These PDF. HTML, EXCEL etc. options gives facility to show output in different format. Let’s take our output in PDF format. Click on ‘PDF’. If your word document is not saved as RTF file it will ask you to save it in RTF format. Just save it using ‘.rtf’ extension. Otherwise it will show your PDF output as below.
Detail Book-List
Step #5: Work on requirement.
Now we have to get our requirement work. For that we have to apply some logic like “If price < 10 then show corresponding records”. Follow the following procedure. You will get the clear idea.
  1. As we have to deal with ‘price’, double click on it, following window will pop up.
PRICE Field
  1. Click on ‘Advance’ Tab.
Price Field
This symbol <? ?> gives the value of field whichever is inside it. As per now we are getting ‘price’ value because of it.
  1. Now we have to apply our logic. To do so write following code or query in advance tab as shown in following image.
IF condition
  1. Now run the report by navigating through ‘Preview’ -> ‘PDF’. You will get detailed list of books of having price less than 10 as below. All the record of having price > 10 will get omitted.
Final Output
I hope this will help you to create your BIP report. This is efficient and easy to understand method I followed when I started working on BIP. There are another method to put ‘If’ condition also but it needs some modification. We will see those in detail along with “Group by”, “Sort”, “Color formatting” etc. from next article.

2 comments: