[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1668
  • Last Modified:

Page break depending on the number of records on subreport

Hi Experts,

How do I do something like this:

I have a report which utilizes the page header section.
Page header section contains, patient name and address (from table PATIENT).
The report breaks for each patient (a new page for each patient break).

I have created a subreport that also resides on the page header section also.
The subreport contains appointment schedules (from table SCHEDULE).
What I want is that for each page, only 10 records (from the subreport) will be displayed.
So if the subreport have 19 records, it will display the first 10 records
on the first page and the 9 remaining records will be displayed on the second page.
Say if I have 2 patients, if patient1 have 20 appointments and patient2 have 10 appointments,
there will be 2 pages that will be allocated for patient1 where page 1 contains the
schedule 1 to 10 and page 2 will contain schedule 11 to 20.
Page 3 will be use by patient2.

Can this be done?

I'm using Crystal 8.5 and MSSQL server 2000

Please Help,
yorge
0
yorge
Asked:
yorge
  • 5
  • 3
  • 2
2 Solutions
 
GJParkerCommented:
Yorge this can be done but it would get rather complicated and long winded to accomplish with the schedule data as a subreport.

Is it not possible for you to link the SCHEDULE table to the PATIENT table in the main report and retrieve the schedule details in the main report.

Or alternatively if this is not possible make the schedule information the main report and the patient data a subreport

If neither of these alternatives are possible post back and we'll look at working with the report as is.

Gary
0
 
mlmccCommented:
Try this in the subreport.

Open the subreport
CLick FORMAT --> FORMAT SECTION
Select the detail section
Select the NEW PAGE AFTER formula button
Formula
({RecordNumber MOD 10) = 0

mlmcc
0
 
GJParkerCommented:
mlmcc

That's only part of the problem, if you split the records in the subreport, first of all the formula would need to be

not (onfirstrecord) and (RecordNumber MOD 10) = 0

but this would not repeat the main report group header info on each page. that's why I feel it would be easier to change the schedule information to the main report if at all possible

Gary
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
mlmccCommented:
The first record should be 1 therefore my formula won't page break after it.  If he needs the group header information on each page, then there is a check box to repeat the header on each page in the GROUP Setup screen.

mlmcc
0
 
GJParkerCommented:
Modulus Divides x by y and returns a remainder that is a whole number therefore if RecordNumber = 1 then 1/10 = 0.1 MOD will return 1 and a page break will be inserted.

The Repeat Group header on each page option will not work in this case because it is the subreport which is causing the page break and not the main report.

Gary
0
 
yorgeAuthor Commented:
Hi mlmcc,

I've given your solution a try.
I got a  "The page size was not large enough to format the contents of an object in the report." error when I tried to preview the report.
Care to share what seems to be the problem here?

yorge
0
 
mlmccCommented:
GJParker - You are correct that 1 mod 10 = 1 but The formula then compares 1 = 0 which is false.  You only get true for 10, 20, 30, etc.

>>"The page size was not large enough to format the contents of an object in the report."
I have never seen that and I hav esome fairly large object in the report.  Is this preview in the designer?

mlmcc
0
 
yorgeAuthor Commented:
yes, this occurs after I've added the things you've mentioned above on the subreport and when I clicked on the preview tab, this error occured.

yorge
0
 
mlmccCommented:
Glad i could help

mlmcc
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now