Microsoft Business Solutions online community
It is currently Sun Mar 29, 2015 2:05 am

All times are UTC + 1 hour

Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: keepWithNext trick
PostPosted: Mon Nov 02, 2009 11:25 pm 

Joined: Sat Mar 29, 2008 12:19 am
Posts: 240
Location: California
Country: United States (us)
Hi... I had this problem and I saw that others have had it too. Basically, when creating a report, you want to avoid a page break between certain sections. But the KeepWithNext property does not help you.

Specifically, it will not keep a "Header" section with a "Body" section, even for the same data item.

So what I did was add in another "Body" section that I only print for the first record, so it behaves like a Header, but keepWithNext will still work.


 Post subject: Re: keepWithNext trick
PostPosted: Tue Nov 03, 2009 4:46 pm 
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Wed Jul 02, 2003 9:13 am
Posts: 7723
Location: Milan
Country: Italy (it)
[Topic moved from 'NAV/Navision' forum to 'NAV Tips & Tricks' forum]

Regards,Alain Krikilion
Use the SEARCH,Luke! || No PM,please use the forum. || May the <SOLVED>-attribute be in your title! || Read Forum Rules before making a posting

»»» Mark your calendar: NAV TechDays 2015 - 19 & 20 November 2015 (!) ««« Visit the conference website: http://www.navtechdays.com

 Post subject: Re: keepWithNext trick
PostPosted: Tue Sep 06, 2011 2:08 pm 

Joined: Tue Sep 06, 2011 2:00 pm
Posts: 1
Country: Germany (de)
Thanks for this helpful post. In addition to this, I had the problem, that I need the heading on the next page again (e.g. when you have a lots of lines after the heading and the lines continue on the nextpage). With a header-section you would have been set "PrintOnEveryPage" = True, but with a body section you have to do a small workaround.

I did it this way:
Code: Select all
XXX Line, Body (1) - OnPostSection()

// Don't show generally

// Check if it is the first Record
IF IsFirstRecOfDataItem THEN BEGIN
  IsFirstRecOfDataItem := FALSE;
  // Remember the page
  HeaderLastPrintedOnPage := CurrReport.PAGENO;
  // Was printed on last page? Print again :)
  IF HeaderLastPrintedOnPage <> CurrReport.PAGENO THEN BEGIN
    HeaderLastPrintedOnPage := CurrReport.PAGENO;

Don't forget to set IsFirstRecOfDataItem and HeaderLastPrintOnPage to correct init-values in the OnPreDataItem.

Maybe this helps for someone :)

 Profile E-mail  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 1 hour

Who is online

Users browsing this forum: No registered users and 1 guest

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: