mibuso.com

Microsoft Business Solutions online community
It is currently Thu Aug 28, 2014 5:08 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: keepWithNext trick
PostPosted: Tue Nov 03, 2009 12:25 am 
Offline

Joined: Sat Mar 29, 2008 1:19 am
Posts: 241
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.

_________________
Oztera


Top
 Profile  
 
 Post subject: Re: keepWithNext trick
PostPosted: Tue Nov 03, 2009 5:46 pm 
Online
Moderator
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Wed Jul 02, 2003 10:13 am
Posts: 7687
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 2014 - 20 & 21 November 2014 ««« Visit the conference website: http://www.navtechdays.com


Top
 Profile  
 
 Post subject: Re: keepWithNext trick
PostPosted: Tue Sep 06, 2011 3:08 pm 
Offline

Joined: Tue Sep 06, 2011 3: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
CurrReport.SHOWOUTPUT(FALSE);

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


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

Maybe this helps for someone :)


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

All times are UTC + 1 hour [ DST ]


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: