cancel
Showing results for 
Search instead for 
Did you mean: 

Powerbuilder Footer should only be displayed on the last page of report

Former Member
0 Kudos

Hi,

I am using Powerbuilder 11.5 and I am fairly new to the program.

I want information to be displayed at the bottom of the last page of a report. I used a footer to do this and set it to invisible on every page but the last one using this expression: "IF( page() = pagecount(),1,0)". The result was that I got blank areas on the other pages where the footer would be. Those blank areas are taking up to much space on each page. Does anybody know a solution to this problem?

Thank you in advance.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

How about putting the summary in a separate dw and put it on the Detail band of the composite datawindow with the visible expression like, if(getrow()=rowcount(),1,0)?

Former Member
0 Kudos

I tried using a composite datawindow as well, but I am not sure how this helps. Could you please be more specific? I get it to print in the order I want but how do I get the summary to move down to the bottom of the page? I was told to avoid composite datawindows in the past and I don't have much experience with them.

Former Member
0 Kudos

Did you try to set the height of the footer programmatically in the PrintPage event ?

You have to obtain the pager count. Ether by storing it into an instance variable in the printstart event or like this:

ll_PageCount =  long ( dw_1.describe   ("evaluate('pagecount()'," + string ( dw_1.rowcount() ) + ")"))
(from: Get the page count of a report - Real's PowerBuilder How-to )

So it is in the printpage event:

long    ll_PageCount

ll_PageCount =   long ( dw_1.describe  ("evaluate('pagecount()'," + string ( dw_1.rowcount() ) + ")"))

if ll_PageCount = pagenumber then

    dw_1.Modify("DataWindow.Footer.Height='<an integer of your need>'")

else

  dw_1.Modify("DataWindow.Footer.Height='0'")

end if

I don't have the time to test it now, 😉

But HTH, Ludwin

Former Member
0 Kudos

Thanks Ludwin, i forgot to mention that (in my opinion) this doesn't work for a composite datawindow with 3 dw's.

This might work for a freeform datawindow. Not sure how your code would look like for a dw_1 with dw_header,dw_detail and dw_footer composite datawindow ?

John

Former Member
0 Kudos

Hello,

thank you for your suggestion.

When I put the code in the printpage event as you suggested the format is way off. It seems that as soon as the height is modified in the print page event there are only about two centimeters on the left side of the sheet that have anything printed on them. The remaining area of the sheet is white. Do you maybe have an idea why this happens?

I am currently using a freeform datawindow.

Paul

Former Member
0 Kudos

Hi,

To my knowledge this never worked in powerbuilder.  I asked for this multliple times in the past.

We are having a simple invoice layout with company header/detail invoice lines/footer total of the invoice. All works fine when there's only one page to be printed. In case there are 2 or more , then the footer band takes 'white space' on every page except for the last one. We want the details from the detail band to use the whole first page across the current white space but this never worked for us. My guess is that the autoheight for footer band doesn't work... (?)

This didnt work in PB5, PB8 and neither did it in PB11.

The summary band can be used , but then the totals are printed directly after the last detail records , which we don't want. Its not our standard accepted invoice layout over here . The total of the invoice should be at the bottom of the last page of the invoice, and should not take any whitespace on any other other pages...

Maybe someone has a workaround , tried many, as many failed ....

Kind regards.

John

Former Member
0 Kudos

Hi Paul,

Have you tried setting the height.autosize=yes for the footer band? Be sure and set the band height to zero in the painter and and at run time it should adjust based on content.

hth,

Mark

Former Member
0 Kudos

Hi Mark,

I have tried that and made sure that the band height is set to zero but I still get the blank areas on the other pages where the information of the footer would be. The footer height is the same on every page and doesn't change when the content of the other header bands is set to invisible.

Paul

Former Member
0 Kudos

Try setting the background color for all of the footer fields. If you've missed hiding one, or there's something else off page in design mode, it should show up in preview mode, or on the printed report. That will at least give you an idea of where the problem field is.

Also, any chance there's another copy of the report object in a different pbl that might be taking precedence?

Former Member
0 Kudos

Thank you, but I looked for fields that I might have overlooked and tried using several different datawindows and the effect was the same every time.

No, there are no other copies in another .pbl.

Former Member
0 Kudos

That is the purpose for the summary band.  Is that an option - even if you need to dynamically "push" it down with extra blank lines?

Former Member
0 Kudos

Yes, thanks, that would be an option. But to be honest I don't know how add in the right number of extra blank lines. Is there a way to determine the extra space that is left on the last page of a report?

Former Member
0 Kudos

Perhaps keep adding rows until the pagecount changes and then back off one row?