keepWithNext trick

Reinhard
Member Posts: 249
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.
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.
0
Comments
-
[Topic moved from 'NAV/Navision' forum to 'NAV Tips & Tricks' forum]Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
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: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 someone0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions