[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

[sqr-users] Page Break getting weird



I am new to SQRs, and have this task -
in PeopleSoft delivered report PER012 - we made it Department Listings, 
we've done changes so that all employees for each dept (within a company) 
and the total no. of employees for the dept. are shown on 1 page, and each 
dept within a company need to be shown on a new page, and then when the 
comapny changes, it starts from a new company.

It should be like - i.e.
A company
     A Dept 1
           totalsA1
New Page
     A Dept 2
           totalsA2

New Page
B company
     B Dept 1
           totalsB1
New Page
     B Dept 2
           totalsB2
and so on......


Here is the code -

BEGIN-SELECT DISTINCT
EE.COMPANY      () on-break PRINT=never after=Company-Change
EE.DEPTID       () on-break PRINT=never after=Dept-Change
............
............
............

FROM  PS_EMPLOYEES EE
............
............

BEGIN-procedure Company-Change
   NEW-PAGE
END-PROCEDURE !Company-Change

BEGIN-PROCEDURE Dept-Change
  DO Print-Employee-Counts
  IF #current-line >= 51  !ensure a minimum of 2 employees is listed
    NEW-PAGE
  ELSE
    POSITION (+3)
  END-IF
  NEW-PAGE      ! I added this for page break after each dept
  DO Initialize-Subheading
END-PROCEDURE Dept-Change

The code which is almost doing it, well almost because it works fine for all 
depts within a company except, when it reaches the last dept, it displays 
the list of employees, but the total shifts to the next page.
This happens only for the last dept for each company, which is really weird.

I tried changing the code on a friends's suggestion - to changing the order 
in selct like -
BEGIN-SELECT DISTINCT
EE.DEPTID       () on-break PRINT=never after=Dept-Change
EE.COMPANY      () on-break PRINT=never after=Company-Change

but what this does, is that it takes the totals up on the same page where 
the employees are, (for the last dept. in a company), but on the next page, 
just displayes the sub-header for the departments and starts printing the 
employee list for the new dept for the new company from the page after the 
next page.

Please help.

Thanks,
Abhay Sachar.
sachar_abhay@hotmail.com.

_________________________________________________________________
Contact brides & grooms FREE! http://www.shaadi.com/ptnr.php?ptnr=hmltag 
Only on www.shaadi.com. Register now!

_______________________________________________
sqr-users mailing list
sqr-users@sqrug.org
http://www.sqrug.org/mailman/listinfo/sqr-users