Progress
Language Tutorial
for Windows


Programming Example

The exercise below demonstrates the techniques discussed in this section:

  1. Open lt-10-10.p and run it.
  2. Choose Report. The report dialog box appears as shown below:
  3. Notice the header info at the top of each page. As you scroll through, you can see footers as well.

  4. Choose OK, then Exit, and then press SPACEBAR to return to the Procedure Editor.

The following code fragment shows the report generating code for this procedure:

lt-10-10.p
          .
          .
          .
/*1*/   DEFINE FRAME f-body
           Name NO-LABEL
           Balance AT 40 FORMAT "$zzz,zz9.99 CR" SKIP
           Contact
           Credit-Limit AT 40 FORMAT "$zzz,zz9.99 CR" SKIP
           Address NO-LABEL SKIP
           Holder NO-LABEL SKIP
           Phone SKIP(2)
               WITH SIDE-LABELS STREAM-IO.
/*2*/   OUTPUT TO "tut-temp.txt" PAGE-SIZE 25.
/*3*/   FOR EACH Customer FIELDS (balance Sales-Rep name 
           Contact Credit-Limit Address City State Postal-Code Phone)
          WHERE Balance >= 1400 BREAK BY Sales-Rep:
/*4*/         DEFINE FRAME f-hdr 
                HEADER
              "Date:" TODAY "Customer Report" AT 25
               sales-rep AT 55
               "Page" AT 65
              PAGE-NUMBER FORMAT ">>9" SKIP(1)
/*5*/               WITH PAGE-TOP FRAME f-hdr STREAM-IO. 
/*6*/         DEFINE FRAME f-ftr 
                HEADER 
               "Customer Report"
               "continued next page"
/*7*/               WITH FRAME f-ftr PAGE-BOTTOM CENTERED STREAM-IO.
/*8*/      VIEW FRAME f-hdr.
           VIEW FRAME f-ftr.
           DISPLAY Name Balance Contact Credit-Limit Address
/*9*/           (City + ", " + St + ", " + Postal-Code) @ Holder Phone
                WITH FRAME f-body.
/*10*/       IF LAST-OF(Sales-Rep) THEN DO:
             HIDE FRAME f-ftr.
             PAGE. END. END.
       OUTPUT CLOSE.
          .
          .
          . 

The following notes summarize the techniques shown in this chapter:

  1. The body frame, which has no HEADER section, appears in its normal position, at the top of the file with other definitions.
  2. The PAGE-SIZE option sets the report page size.
  3. The use of the control break changes the report output from one report into a series of smaller reports-one for each sales rep.
  4. This HEADER frame comprises the running report head.
  5. PAGE-TOP places this frame at the top of the report page.
  6. This HEADER frame comprises the running page footer.
  7. PAGE-BOTTOM places the header frame at the bottom of the page.
  8. The VIEW statements force Progress to evaluate the two HEADER frames on each iteration of the block.
  9. Here, the report creates an address string and uses the @ option to place the result at the Holder variable.
  10. The LAST-OF function is for checking for the end of a break group, allowing you to perform special tasks. In this case, the procedure suppresses the page footer because this break group report is complete. It also uses the PAGE statement to start a new page for the next break group report.

Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095