Search This Blog

Friday, 18 January 2013

Creating First report with Basic RTF method


Creating First report with Basic RTF method

Here also we have to design data source and an RTF.
In the previous lessons we had learnt how to create data model
In this our data model looks

For above data model we have to generate XML and create one RTF

First generate XML. For that in the report builder go to File=>generate to file=>XML which is shown below


When ever we click on XML system will ask to where to save this XML file which is shown below


Save it in appropriate location for future reference
Click on ‘SAVE’.

Now we have to Design our template layout:

Use the Microsoft word or any word processor to generate the template layout, while saving save the document with RTF extension. Let us call this template file as Usng_basic_RTF.rtf



First and most thing we have to do while creating layout is we have to load data first i.e... we have to load XML data what we had generated.

Now we have to Associate XML data to layout

Once XML publisher is installed successfully, a new menu bar will be found by name “Template Builder”. Navigate through Template Builder => Data => Load XML Data.
        Which is shown below.

In the RTF we are going to create layout
we have to construct Table for placing Column names and their fields shown below.
Why we have to construct table is because if we place directly fields in the RTF the display format of the output is not good. That’s why we have to construct table.

For that follow below navigation in the picture
Table=>insert=>table

When ever click on the ‘Table’ system will ask how many rows and how many columns want which is shown below

Here we are going to take 4 columns and two rows which shown above. After giving proper rows and columns according to our requirement then click on ‘OK’
Then in the RTF we can see the ROWS and COLUMNS what ever the number we had given which is shown below

There we can place column names and fields according to their column name.

First we are going to write column names in each segment which is shown below


Now we have to write XML tags directly to specific column according to that column name by seeing the .xml file what we had generated.
Our XML file looks like



From the above picture we are seeing that there is XML tags which we are going to take as source in the RTF which is shown below

Now we have to publish the report

Click on Template Builder => Preview => HTML/PDF/Excel/RTF (any format).
We can get below output

By seeing above output we are seeing only one record. But in the ‘EMP’ table we have 14 records.

In the report builder we will use repeating frame for repeating the data. In the same way we will use some XML Tags like => <?FOR-EACH:<Group_name>?>(just like loop). When ever we open loop we have to end the loop. Here we use XML Tab like =<?end for-each?>(just like end loop)
For getting all records which are in ‘EMP’ table

<?FOR-EACH:<Group_name>?>   => we have to write before first column itself

<Group_name>=> we will get from XML ouput. Go to XML ouput there we can see ‘G_EMPNO’ which is nothing but group name


There we can see XML tag which we are going to provide in <?for-each:<group name>?> like <?for-each: G_EMPNO?>

<?end for-each?>   => we have to write after the last column.

Now we are going to use these XML tags in RTF.

Which we can see in below picture

Now we have to publish the report

Click on Template Builder => Preview => HTML/PDF/Excel/RTF (any format).
We can get below output

Now all Records got appeared which is shown above

No comments:

Post a Comment