Thursday, December 3, 2009

Common Header and Footer with Sub Template – Part 4

This is the last post for this Sub Template series. Thanks for your reading!

Before moving to a different topic, I just wanted to post some little tips around the Sub-Template.

Dynamic Report Title, Not Hard-coded

The header section often contains a report title, which should be

unique per each report, so you don’t want to hard-code the title in the common header. While there are many other ways to make this dynamic, I usually use the report parameter in the BI Publisher Edit UI to type the report name like shown in the picture below and get the value in the XML data file so that you can just use the place folder in the RTF template like <?REPORT_NAME?>.

Snap2

Make sure you select ‘Hidden’ as the Parameter Type so that the users don’t need to see this parameter in the report view window.

 

One Sub Template for Both Header and Footer

You don’t need to have separate sub-template files for each section, for example, one for the header and one for the footer. Instead you can have just one sub-template file and contain two sections in the same template file, one for the header and one for the footer. And then you can name the header section as ‘header’ and the footer section as ‘footer’ so that you can call them separately in the main RTF template.

Sub TemplateSnap4

Main Template


<?call-template:header?>

Body


<?call-template:footer?>

4 comments:

  1. group ROW by _saw_0_

    Account ID: _saw_0_

    Total _saw_17_
    page breakend ROW by _saw_0_


    i have a column saw_0 which i want to show as header in each page. and for each new saw_o i want to show it in next page.

    but currently in the header it shows the last row fetched by saw_o.

    while saw_0 has more than 1 value.

    ReplyDelete
  2. You need to add '@section' in your for-each.

    e.g. for-each@section

    ReplyDelete
  3. Very good. Documented Nowhere oficially. Thanks Kanichiro.

    ReplyDelete
  4. Thanks.. But when we call a subtemnplate can we pass a variable value also. I mean say a variable 'PG' is defined in the RTF template and its value is set to 3. Now I am displaying this variable value in the sub template. Now whenever I call the sub template with statement I want to pass the variable value also alomng with template name. Pls let me know if it's possible and what is the syntax for it.

    ReplyDelete