Print a report with only 2 items per page

scovillescoville Member Posts: 11
edited 2005-03-10 in Navision Attain
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:)

Comments

  • alanperualanperu Member Posts: 23
    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;
  • SavatageSavatage Member Posts: 7,142
    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?
  • alanperualanperu Member Posts: 23
    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?
  • scovillescoville Member Posts: 11
    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:)
  • awarnawarn Member Posts: 261
    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.

    -a
  • awarnawarn Member Posts: 261
    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.

    -a
Sign In or Register to comment.