First Page Header info vs a cover page

Started by Jeff W., March 08, 2010, 09:00:26 PM

Previous topic - Next topic

Jeff W.

I'm displaying some dynamic data on a cover page separate from the actual report.  The dynamic data displays report parameters that an end-user has chosen to narrow down the select criteria, so there may be several rows/lines of data to display.  I do this with an ON EVERY ROW in a separate report block.  Is there a way to accomplish this, say with a FIRST PAGE HEADER, and produce just one report instead of two?


Alex G.

Using the FIRST PAGE HEADER is the natural choice but it can't be used because the language does not allow repetitions of PRINTs in this section. The compiler will refuse to compile such code. You can however perform the loop in a BEFORE GROUP as shown in the attached report. Please note that the example will NOT work with the current released version due to a bug. The example is operational in the 2.21 maintenance release which will be available soon. The screen shot shows the first two pages of the report output. The example is a modification of the OrderReport sample and it will actually print the "prolog" page for each customer followed by the sales items for the customer. In your case you would need to make sure that the report has only one group. Please contact the support for the source files of the example since the attachment size is limited here.

Reuben B.

Alex,

The fact that FIRST PAGE HEADER doesn't allow a variable number of PRINT statements doesn't mean it shouldn't be used.

You could do ...

Code (genero) Select
DEFINE first_page RECORD
   date DATE,
   time DATETIME HOUR TO SECOND,
   who CHAR(10),
   program CHAR(20),
   param1 STRING,
   param2 STRING,
   param3 STRING


FIRST PAGE HEADER
   FOR i = 1 TO number_of_parameters_entered()
      CASE i
         WHEN 1 LET first_page.param1 = get_param(i)
         WHEN 2 LET first_page.param2 = get_param(i)
         ...
      END CASE
   END FOR

   PRINTX first_page.*


or if the variable number of parameters could be appended into a string for display inside a WordWrapBox

Code (genero) Select
DEFINE first_page RECORD
   date DATE,
   time DATETIME HOUR TO SECOND,
   who CHAR(10),
   program CHAR(20),
   param STRING

DEFINE sb base.StringBuffer

FIRST PAGE HEADER
   LET sb = base.StringBuffer.creaet()
   FOR i = 1 TO number_of_parameters_entered()
      IF i > 1 THEN
         CALL sb.append(get_newline_char())
      END IF
      CALL sb.append(get_param(i))
   END FOR
   LET first_page.param = sb.toString()

   PRINTX first_page.*



As for the first page in the report structure couldn't you have the following structure ...

report.4rp
   Page Root
      Contents of first page (X-size, Y-size=max)
   Page Root
      Contents of second and subsequent pages as per normal report

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero