Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: First Page Header info vs a cover page  (Read 10278 times)
Jeff W.
Posts: 31


« on: March 08, 2010, 09:00:26 pm »

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.
Four Js
Posts: 148


« Reply #1 on: March 09, 2010, 07:00:53 pm »

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.


* TwoLoops.jpg (123.66 KB, 1300x840 - viewed 2069 times.)
Reuben B.
Four Js
Posts: 1046


« Reply #2 on: March 11, 2010, 12:55:24 am »

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
  1. DEFINE first_page RECORD
  2.   date DATE,
  3.   time DATETIME HOUR TO SECOND,
  4.   who CHAR(10),
  5.   program CHAR(20),
  6.   param1 STRING,
  7.   param2 STRING,
  8.   param3 STRING
  9.  
  10.  
  11. FIRST PAGE HEADER
  12.   FOR i = 1 TO number_of_parameters_entered()
  13.      CASE i
  14.         WHEN 1 LET first_page.param1 = get_param(i)
  15.         WHEN 2 LET first_page.param2 = get_param(i)
  16.         ...
  17.      END CASE
  18.   END FOR
  19.  
  20.   PRINTX first_page.*

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

Code
  1. DEFINE first_page RECORD
  2.   date DATE,
  3.   time DATETIME HOUR TO SECOND,
  4.   who CHAR(10),
  5.   program CHAR(20),
  6.   param STRING
  7.  
  8. DEFINE sb base.StringBuffer
  9.  
  10. FIRST PAGE HEADER
  11.   LET sb = base.StringBuffer.creaet()
  12.   FOR i = 1 TO number_of_parameters_entered()
  13.      IF i > 1 THEN
  14.         CALL sb.append(get_newline_char())
  15.      END IF
  16.      CALL sb.append(get_param(i))
  17.   END FOR
  18.   LET first_page.param = sb.toString()
  19.  
  20.   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
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines