Print a report with only 2 items per page

scoville
Member Posts: 11
I need to print out a report with only 2 items per page. Presently the report just prints items sequentially so half of one item can be printed on one page and the other half on the next page.
Problem is I dont know where to start to put a Counter that counts the number of items that have been printed and to initiate a page break if the Counter exceeds 2. In which section should I place the code - OnPreSection in Item Body or Header or Footer ??
I have tried reading through smart books on how to create reports but no luck in understanding how to solve this particular problem so far....
Thanks in advance O:)
Problem is I dont know where to start to put a Counter that counts the number of items that have been printed and to initiate a page break if the Counter exceeds 2. In which section should I place the code - OnPreSection in Item Body or Header or Footer ??
I have tried reading through smart books on how to create reports but no luck in understanding how to solve this particular problem so far....
Thanks in advance O:)
0
Comments
-
Put your counter in the OnAfterGetRecord trigger of the DataItem.
Something like this:
counter += 1;
IF counter = 2 THEN
BEGIN
CurrReport.NEWPAGE;
counter := 0;
END;0 -
MaxIteration = 2
no? #-o
On the Check Report 1401 - It used to print 10 entries MAX before it create a new check. So I set MaxIteration to 25. now it prints 25 lines per page. works fine.
on the dataitem: Integer ->PrintSettledLoop
see the report to get an idea
Maybe this is or isn't what your looking for?0 -
Hi again,
Not sure if MaxIteration is going to do the job here. There could be 2 or 200 items to output, but specifying MaxIteration=2 will stop the output after the first 2. We just need to make it move to the next page after each block of 2.
Have you managed to fix this one yet, Scoville?0 -
Hi alanperu and savatage
Thanks guys for your help!
Alanperu, I used your code in the OnAfterGetRecord and instead of checking for a static number I used
IF (Counter mod 2) = 0 THEN CurrReport.NEWPAGE
to check whether the Counter was an even number. It worked !
Now my report prints out 2 items per page, except for Page 1 which only prints 1 item and Page 2 which is completely empty. The other pages are fine.
Am I missing something here or is it my report that is built up wrongly ?
Would appreciate some advice again.
By the way, this forum is in my opinion the best MBS Navision forum on the net. Everyone is helpful and intelligent O:)0 -
If it only works for Counter = 5 and above, then change the code to this:
If Counter < 5 then begin
if (counter = 2) OR (counter = 4) then
CurrReport.NEWPAGE;
end else
IF (Counter mod 2) = 0 THEN CurrReport.NEWPAGE
I don't know if this is the *best* solution, but if it works it works.
-a0 -
If it only works for Counter = 5 and above, then change the code to this:
If Counter < 5 then begin
if (counter = 2) OR (counter = 4) then
CurrReport.NEWPAGE;
end else
IF (Counter mod 2) = 0 THEN CurrReport.NEWPAGE
I don't know if this is the *best* solution, but if it works it works.
-a0
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