Conditional Headers!

No nota post about some prima donna football (soccer) player that does not want to muss his hair up nor loose more precious brain cells putting his head to the ball. Far more exciting than that, its more templating fun.
I have been exchanging a few mails with Tony this morning. How can one conditionally call a header into a report? is the crux of his question.

The answer, is relatively simple, for a change. You can use a sub template (I have written about those elsewhere in this blog) to store the header (and footer) layouts you want to possibly call.
They take the format


<?template:Header1?>
... header 1 layout table, etc
<?end template Header1?>

<?template:Header2?>
... header 2 layout table, etc
<?end template Header2?>

<?template:Footer1?>
... footer 1 layout table, etc
<?end template Footer1?>

and so on, just use an RTF template to make life simple on the layout.
You need to make this sub template accessible either via a URL or directory path, from the root directory - no relative path support at the moment.

In the main template you need to register the sub template you want to use with an import statement:

<?import:http://127.0.0.1:9704/HeaderFooter.rtf?>

Now you can call the various header and footer templates you have in the sub template. In the Word header you can not use formfields so you have to write the clear text such as:

<?if:.//DEPARTMENT_NAME=’Accounting’?>
<?call@inlines:Header?>
<?with-param:ReportName;string('Accounting Report’)?>
<?end call?>
<?end if?>

you can use a choose: statement too, nested 'if' will not work thou.
I built some samples, get em here. You'll notice the parameter passing in the template call, think I have covered that elsewhere too.

Comments:

Hello All I have a requirement wherein i have to merge 20 reports in a single pdf. For this we are making use of the Data Template where in we are putting the queries for those reports and we are preparing a single template where we are merging all the report templates. But the problems that i think can come are: -- The headers and footers needs to be changed for different reports. How to implement this? -- How should different templates needs to be merged in a single template so that we get data? currently we are trying to run it for only 2 reports and we are getting an issue that the reports are not showing any data? -- The other requirement in this is that we need to pull in some static reports in the same template and we dont have the xmls for the same. how can we pull those reports? This is a Prnit All requirement where in we need to prnit all the reports so we cant give the links to those reports, so kindly suggest a way to show those reports? Thanks in advance Rohit

Posted by rohit jain on July 16, 2009 at 06:29 PM MDT #

I have another variation on multiple headers that I have not been able to work through. Most of our customer-facing documents require two different headers - one on the first page which contains the mailing address for a window envelope, and the second on all succeeding pages of the document. When the first document is complete, the first header with the mailing address must be printed for the second document, then changed to the second header after the first page. I have been able to use subtemplates to define the two headers, and it prints correctly for the first document, but I can't get the first header page to print again for the second document. We use this technique for various notices and invoices. All of the reports were developed in report builder, but we want to convert them to BIP. Any suggestions on how to get the headers printed? Thanks for any assistance you can provide, Anne

Posted by Anne Parsons on July 20, 2009 at 04:41 AM MDT #

I have an issue similar to the one Anne has listed. We have a report with 8 separate sections. There are about 7 rows of 'header' information that will print for every section. However, the column headings will be different for each section. I have the column headings printing on the first page of each section but the column headings do not continue onto subsequent pages when a section crosses pages (which happens frequently). Any help would be appreciated. Thanks Eileen

Posted by Eileen Daugherty on July 27, 2009 at 06:33 AM MDT #

Hi Everyone, I see that there is a requirement that different pages will have different headers and footers. Such things are common say in the case of a Purchase order which will have a specific header for the PO and then no header for Terms and conditions. I found a simple solution to this. This can be achieved by using mulitiple cases and . For all newbies, whatever appears before start body is the header and after end body is the footer. Suppose we have a purchase order of 7 pages, out of which 2 pages are the purchase order details and 5 pages of terms and conditions. Both these will have different headers, for the first two pages a big header with PO header details and for the T&C a simple logo as the header. To do this, create a start body and end body containing the PO details, after that, in MS WORD, do a 'INSERT' > 'BREAK' > 'SECTION BREAK TYPES' . 'NEXT PAGE'. In the next page, use another start body and end body with a different header and footer. This works... If you need a sample, please send me an mail... @Anne Parsons You can try what I mentioned above, there is another option. In 'PAGE SETUP' > LAYOUT of MS WORD, there is a 'DIFFERENT FIRST PAGE' option...

Posted by Viju George on August 26, 2009 at 06:07 PM MDT #

Viju, Thanks for the suggestions. I will look further at the first and would love an example from you. Could you send it to anne.parsons@brodart.com? I have already tried the second. It works for a single notice. My problem is that I'm printing 100 or more notices, and can't find a way to change back to the first page setup. Setting it in Word, there is only one first page. The first page of the second customer notice is not considered a first page. I don't know how to fool Word into thinking that it is. Anne

Posted by Anne Parsons on September 02, 2009 at 02:49 AM MDT #

Hello Viju -- thanks for this post. I was able to achieve my desired result using different bodies on page one and page two of my report. However, I often will only ever print the first page. In this scenario, even if there is no data for my second page, it still prints, probably due to the declaration of the body for the second page. I tried to begin my if condition (that determines whether to print more than one page) prior to the page break, but this caused some issues when the body tags on the second page are added (errors -- report wouldn't display). Here's pseudocode example of what I'm attempting: - header for page 1 - start: body - body unique to first page - end: body - if condition determining whether to display second page> - page break via MS Word - header for pages 2+ - start:body - body for pages 2+ - end: body - end if condition determining whether to display second page What I'd like to get is page 2 not to display at all if the if condition is not met. Currently page 2 appears (bad) but is blank (good) so I'm thinking that the second body declaration is somehow forcing the second page.

Posted by Eric E on February 01, 2010 at 06:39 AM MST #

I found a solution that seems to work, but it involves hard coding the header for the first page. For some reason, the header is not duplicated on the first page -- which is good -- but I'm not sure why this is the case. - page 1 body (which includes the text I have in the header for other pages, but it isn't defined as a header -- just as text) - if condition determining whether to display second page - CTRL+Enter line break in MS Word - header for pages 2+ - start:body - body for pages 2+ - end: body

Posted by Eric E on February 01, 2010 at 01:30 PM MST #

Yeah baby!!! New Orleans Saints won the Super Bow! I think I'm going to get some shirts printed up with the Saints logo “saying champions 2010” what you guys think? think i can sell um?

Posted by NY screen printing on February 08, 2010 at 01:33 PM MST #

Tim - I have tried to follow the various steps in the blog but I am not getting the desired results. I have one report with several 'parts' to them. The 'parts' are all part of t a larger group that I am cycling through to generate the report. I need to generate different headers based on the 'part' that I am on. I have used the start/end body solution and it allows me to use different headers or using the section break allows me to use the diffewrent headers as well but then I lose my hierarchial data. I know this blog is dated. Please let me know if there is somewhere I can look to do this. Thanks!

Posted by Nick Kusiak on June 09, 2010 at 07:55 AM MDT #

I have the similar requirement where I need to print different header and footer from second page onward. Could someone please post a working template? TIA!

Posted by AJ on September 03, 2010 at 07:23 PM MDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Follow bipublisher on Twitter Find Us on Facebook BI Publisher Youtube ChannelDiscussion Forum

Join our BI Publisher community to get the most and keep updated with the latest news, How-to, Solutions! Share your feedback and let us hear your voice @bipublisher on Twitter, on our official Facebook page, and Youtube!

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today