I need to force the number of lines of a section that prints on a report to be fixed. The problem presents itself due this being a body section, and this section may have multiple lines. The maximum no. of lines will never exceed 5, so I need to force this section to be 5 lines regardless of the number of records. I have seen once before in code where a “Filler Line Section” has been used, so that if the no. of records printed is not = to 5 then the filler lines would add the extra lines needed. I hope this is easier to follow, than for me to write. Many thanks in advance.
There is a property on a dataitem called maxiteration. If you put a value in there then the dataitem will only run x amount of times. You could have a counter(integer variable) on this dataitem that increments everytime it is run. You could then have an integer dataitem(filler) that is also set to run a maximum of 5 times(maxiteration=5). Now on the OnPreSection of the integer dataitem(filler) you could have it show the amount of lines that is left to print from the first dataitem. (ie. if the first dataitem printed 3 lines, then the integer dataitem would prints 2 lines of filler) dataitem1(I.e Customer) Property maxiteration=5 OnAfterGetRecord() recCount += 1; //how many times is this dataitem running dataitem2(Integer) Property maxiteration=5 OnPreSection() fillCount += 1; currreport.showoutput(fillcount <= (5-reccount)); NOTE: Must reset your counters at the appropriate places I hope that made some sense. Cheers Taylor McCartney Development Specialist CSB Systems email@example.com Edited by - tmccartney on 2001 Nov 28 16:29:24
Hi Dean Try the search function. We have had this question a few times. David Cox email: firstname.lastname@example.org
David, Maybe I used the wrong keywords, but I did not get a relevant match when I tried this. Any suggestions ?
Originally posted by Dean Axon: David, Maybe I used the wrong keywords, but I did not get a relevant match when I tried this. Any suggestions ?
Simple the Search String = Roport Result Bad I just looked it up as I remembered the Question. I searched on “Sections” but “Roport Result Bad” was the question David Cox email: email@example.com
David, Your soultion works great if I only use one filler section. But to make life interesting I need two. I have prefixed the code with the relevant section and the relevant tables, but I get the second “filler Section” printing all the time( I stopped the report at 350 pages). Can I do this ?
Hi Dean Another Way to Do it. //Set MaxLines on PreReport Maxlines := 55; //PageLoop or Newpage CurrLine :=0; On your Sections Code Count the lines in the section Header Section OnPreSection() IF CurrReport.SHOWOUTPUT THEN CurrLine:=CurrLine + 5; Line Section OnPreSection() IF CurrReport.SHOWOUTPUT THEN CurrLine:=CurrLine + 1; Then for your Integer OnPreDataItem() IF CurrLine >= Maxlines THEN CurrReport.SKIP ELSE SETRANGE(Number,MaxLines-CurrLine); Try this! David Cox email: firstname.lastname@example.org Edited by - David Cox on 2001 Nov 29 13:45:27
Originally posted by Dean Axon: I need to force the number of lines of a section that prints on a report to be fixed.
This sounds like a similar situation to standard Navision reports such as the invoices or the check report (#1401). These reports handle your problem by sending the output to 2-dimensional arrays. The code gets quite complex… ------- Tim Horrigan email@example.com