Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not removing blank lines from Report footer 3

Status
Not open for further replies.

SitesMasstec

Programmer
Sep 26, 2010
508
Brasil
Hello collegues!

I created a report with some labels in the Footer, and gave directions to remove blank lines if they are blank:
FormListaPrecos_kcgrex.jpg


In "Print only if expression is true" I have:
Code:
LEN(ALLTRIM(XObsRodape1))>=1

I have the same commands in the Detail band and it works fine.

Or this command ("Remove line if blank" checked) does not work for the Footer of a Report?


Thank you,
SitesMasstec
 
Hi,

In the Page Footer replace the two controls with one, high enough to contain two lines. Then add

Code:
icase(LEN(ALLTRIM(XObsRodape1))>=1, XObsRodape1 + chr(13) + XObsRodape2, XObsRodape2)

th
MarK
 
Hi, Mark.

I tried the command ICASE..., but it does not worked...

Mark said:
Page footer has static height.
So I think there is no solution.

Thank you,
SitesMasstec
 
SitesMasstec, you have to use the icase expression as the expression to print in the larger single report control MarK suggest to use instead of your 2 controls.

Chriss
 
Yes, Cris, I understood, I changed the 2 controls by just one, and used the expression Mark suggested.

Thank you,
SitesMasstec
 
But not in the section "Print only when expression is true". In the expression you set in the General tab.

Or does it fail on you not using VFP9?

Chriss
 
Yes, I am using VFP9 and I put it in the General Tab.

I made some tests and find out why it makes no difference: the Detail band uses 1,25 inches for each record. When I take out some space from the Detail band, there is difference when using ICASE for the Footer control!


Thank you,
SitesMasstec
 
Hi SitesMassTec

So I think there is no solution.

Com'on. It works. You have to put the ICASE() statement in Field Properties - General - Expression of the Page Footer control - as Chriss already told you.

You may even use a variable in your page footer control to display a dynamic page footer text e.g.

Code:
lcPageFooter = IIF(MOD(INT(SECONDS()/60), 2) = 1, "Printed by Jane", "Printed by Jeff, Chris and Others")

and put "lcPageFooter" (witout the quotes) in Field Properties - General - Expression of the Page Footer control

hth

MarK
 
The Icase expression prints either only XObsRodape2, when XObsRodape1 is empty or it prints both XObsRodape1 and XObsRodape2. There's no resizing in the expression, just either skipping the empty XObsRodape1 or not.

Therefore the size has to fit both XObsRodape1 and XObsRodape2 or you set "stretch with overflow". It removes the need to use the "printwhen" condition.

There's one more thing to correct about mJindrova's remark, though: In the general properties of the footer you can set a constant band height or not.

Nevertheless, for a constant composition, especially having the page number at the same position, I'd always use "Fix realtive to bottom" for all fields in the footer, and then also the field displaying XObsRodape1 or both XObsRodape1 and XObsRodape2 would always start at the same offset from the bottom and expand as necessary. You should just put it far enough from the bottom that it will not be cut off when both XObsRodape1 and XObsRodape2 are not empty.

Chriss
 
Hi SitesMassTec,

You may want to check Float under Object position and also check Stretch with overflow

hth

MarK
 
SitesMasstec said:
...there is difference when using ICASE for the Footer control!

So, yes, Mark, it really woks! But I mistankly had said the contrary before, because I had not paid attention to the Detail band, which uses 1,25 inches for each record, and even as the use of ICASE in the Footer control, as there is not enough space for the printing of next record, the next record goes to another page.
I will be using the ICASE in another Form, when a record will be using just one line.

This is another tip from Cris: I fixed some controls in the Footer relative to bottom (really necessary when using ICASE).


Thank you,
SitesMasstec
 
SitesMasstec said:
I fixed some controls in the Footer relative to bottom (really necessary when using ICASE).

That has nothing to do with ICASE or not, you just want the page number, for example, to be in the same position from the page bottom margin in the end, and you get that from fixing things to the bottom of the page instead of the top of the footer. I have not experimented whether stretching with overflow then stretches a report field to the top instead of the bottom, but I think that overflow stretching always is to the bottom.

SitesMasstec said:
I had not paid attention to the Detail band, which uses 1,25 inches for each record
Well, two things are naturally true:
1. The page footer is a per page thing, not a per record thing, so comparison with the detail band is not leading to any valuable conclusions, is it?
2. Enough records may cause a second page, as the height for the page footer, of course, is not available for detail band printing. But then you have as many footers as you have pages, that has to be taken into account by you, of course.

If you want something that only prints once on the last page footer that'd be a summary band.
If you want something that prints after a group of records, that means using group bands, which have a group header and group footer band

All in all, watch out what you pick for what intent.

Chriss
 
I woke up today with the same doubt I went to bed yesterday: If Print when / Remove line if blank (checked) has not effect in the Footer height why does ICASE... has the desired effect?

Thank you,
SitesMasstec
 
Hi SitesMasstec,

Chriss already answered this question

Chriss said:
The Icase expression prints either only XObsRodape2, when XObsRodape1 is empty or it prints both XObsRodape1 and XObsRodape2. There's no resizing in the expression, just either skipping the empty XObsRodape1 or not.

... and since the ICASE() statement includes CHR(13) (= go to next line) it prints XObsRodape1 and XObsRodape2 on two lines or XObsRodape2 on first line

hth

MarK
 
Hi SitesMasstec,

BTW, if you're working a lot with reports you may want to read

The Visual FoxPro Report Writer: Pushing it to the Limit and Beyond Paperback – January 1, 2002 by Cathy Pountney (Author) ISBN 1-930919-25-5

and chapters 5, 6 and 7 in What's New in Nine - Visual Foxpro's Latest Hits ISBN 1-930919-64-6

hth

MarK


 
SitesMasstex,

and I woke up on this thought...
SitesMasstec said:
there is not enough space for the printing of next record, the next record goes to another page.

If you have such a packed page and always want to avoid page breaks, then the shrinking footer would only help you, if it always shrinks, i.e. you would need to ensure either XObsRodape1 is empty or XObsRodape2 is empty. So what does it help, really? If your report is that packed, then reduce the font size in detail bands and you can print one or two more detail records.

There will be somee day when data is too much for a single page output and will need two pages anyway, if a repeating page footer is not what you want, then you want to use the summary band for XObsRodape1 and XObsRodape2 and the page footer only for page number printing. Use the right band types for the right job. You're idea is flawed and your complaining is futile, when you always need the footer to be shorter than designed, then you clearly have a design flaw, don't you? Get straight to the problem and solve it.

Instead, you stick to solving a detail that only helps you in special cases anyway, solve your problem on a more general level of report design, the book MarK suggested would surely teach you a lot of reporting tricks that help with getting the best design for individual cases.

Chriss
 
Hi Mark and Chris!

I have "What's New in Nine - Visual Foxpro's Latest Hits" book, and I use to read its contents randomly.

Do you think this book is enough, or is it adviseble to acquire "The Visual FoxPro Report Writer: Pushing it to the Limit and Beyond" also?

I did a change to save space (for the expected last record in the page) in the Detail band:
ReportsListasPre%C3%A7os_yl4baz.jpg


Even if I use Remove line if blank,when the last record is to be printed the report sees if there is enough space for 6 (six) possible lines to be printed. If there is not, it goes to the next page and leaves a lot of unused space before the footer.
So I save the first version of the design (the left in the picture above) to redesign when needed and saves as another report name (right side) with fields in the Detail band overlaid (this overlaid version is impossible to make changes).

I need the Footer to be printed in all pages.

Thank you,
SitesMasstec
 
So your problem is now in the detail band, fine. Do you have "remove line if blank" checked in your original (left layout)?

Chriss
 
You're printing groups, so whether the end of a page after a group is used to start printing the new fgroup or the new group starts at a new page is decided here:

where_a_new_group_starts_jgk73q.jpg

To save space set this to new line, not new page.

If that's the reason it has nothing to do with the band height of detail band or grooup footer or page footer or whether "remove line if blank" seems to fail or not, that's just lack of knowledge about report band properties. You'll also not learn this from "What's new in nine" as that is not new in nine, it's old.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top