Please enable JavaScript to view this site.

R:BASE 11 Help

Navigation: Reference Index > Using PAGEMODE

Example: Phone List with Breakpoints

Scroll Prev Top Next More

This example prints a phone list report using breakpoints. Each break is printed on a separate page. The data is not printed in columns to make it easier to see how breakpoints are set up. The employee phone list data is printed by state.

 

*(PHONE2.RMD)

*(example 2 - a report with break points.

 An employee phone list is printed by state,

 each state on a separate page.)

DEL phone.out

CON hifi

CLS

SET MESSAGE OFF

SET PAGEMODE OFF

SET LINES 15

SET VAR vState TEXT

DECLARE c1 CURSOR FOR SELECT DISTINCT state +

 FROM salespeople

DECLARE c2 CURSOR FOR +

 SELECT (LastName + ',' & FirstName), Phone, Lastname +

 FROM salespeople WHERE state = .vState +

 ORDER BY lastname

SET VAR vCol INT = 3, +

       vRow INT = 2, +

       vCount INT = 0, +

       vPage INT = 1, +

       vPageLimit = (CVAL('LINES'))

SET PAGEMODE ON

OPEN c1

FETCH c1 INTO vState ii1

WHILE SQLCODE <> 100 THEN

OUTPUT phone.out APPEND

WRITE 'List of employees in state of:', .vState, +

 '                      Page:', .vPage AT .vRow, .vCol

SET VAR vRow = (.vRow + 1)

WRITE '----------------------------------' +

   AT .vRow, .vCol

OPEN c2

 FETCH c2 INTO vName i1 ,vPhone i2, vLastname i3

 WHILE SQLCODE <> 100 THEN

   SET VAR vRow = (.vRow + 1)

   SET VAR vCount = (.vCount + 1)

   IF vRow >= .vPageLimit THEN

     NEWPAGE

     SET VAR vRow = 2, vPage = (.vPage + 1)

     WRITE 'List of employees in state of:', .VState, +

 '                      Page:', .VPage AT .vRow, .VCol

     SET VAR vRow = (.vRow + 1)

     WRITE '----------------------------------' +

       AT .vRow, .vCol

   ENDIF

   WRITE .vName=21 .vPhone AT .vRow .vCol

   FETCH c2 INTO vName i1, vPhone i2, vLastname I3

 ENDWH

 CLOSE c2

 SET VAR vRow = (.vRow + 2)

 WRITE 'Number of employees for', .vState, 'is', +

   .vCount AT .vRow, 10

 OUTPUT SCREEN

 SET VAR vRow = 3, vPage = (.vPage + 1), vCount = 0

 FETCH c1 INTO vState ii1

ENDWH

OUTPUT screen

DROP CURSOR c1

DROP CURSOR c2

SET PAGEMODE OFF

SET LINES 20

TYPE phone.out