Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicate report

Status
Not open for further replies.

Strannik

Programmer
Jul 4, 2002
132
UA
I have pretty complicated report with several groups, difficult formatting and so on.
This report can take up to 3-4 pages.
I need to modify the report but I don't know how and is it possible.
I need to separate each page into two equal parts.On the each part will be displayed the mentioned report. So the contents of upper part will be the same as contents of lower part. And new report will take up to 6-8 pages.
I tried to insert this report as sub-report and place it into page footer. Everything works for the first page but contents of next pages(lower part) just copy the contents of first page(lower part).
 
I think you would need to create an outer group that clusters records or inner groups so that you can force a page break after a group footer. The group would need to be populated by the amount of records/groups that would appear on half the page. The group footer would contain the subreport linked to the main report on the new group field. The hard part is that you can't group based on a running count of fields or groups. But let's assume the best. Say you have existing groups A to F, and that each group contained about the same number of records. You could then create an outer group using a formula like {@newgrp}:

if {table.field} in ["A","B"] then 1 else
if {table.field} in ["C","D"] then 2 else 3

You would insert a group on this, and using the change group expert, make it your outermost group. Then use the section expert to format "New Page After" for the group footer.

In the subreport you would create the same group structure, link the subreport to the main report on the formula field, and place it in the group footer. This should give you a report output like:

Page 1

A
B
---
A
B

Page 2

C
D
--
C
D

etc.

Of course, this depends upon your ability to make a group structure that consistently would appear on half a page.

-LB
 
to lbass:

Sorry, I was out for a long time.
So the problem still exists. The only thing I don't know is how to design report that both parts occupy exactly a half of page.
I can place second part on page footer but then another problem arrise: how to link main report and subreport ?
 
Probably the best solution is to create the proper data source on the database using SQL. Keep in mind that you're not trying to produce a report, this is more of a form

That would require that you either pass SQL to the database, or create a View or Dtored Procedure.

Dependencies are Crystal version, database and connectivity used, none of which you bothered to post.

Other than LB's suggestion, which you didn't explain if you'd tried it, you might cheat this by placing multiple subreports in report footers and then use a SQL Expression to return a row number from the database to allow for each subreport to have a record selection formula for only the records for it's 1/2 a page.

You might also use this means to create faux groups for LB's suggestion.

Dod everyone and yourself a favor, try posting the following when requesting technical information:

Crystal version
Database/connectivity used
Example data
Expected output

-k
 
to synapsevampire:

Well ... your post makes sense.So
Crystal version: 8.5
Database/connectivity: used MSSQL2000(Native)
Example data

For example:

<GROUP 1>
<GROUP 2>
<ITEM 1>
<ITEM 2>
.................................
<GROUP 3>
<GROUP 4>
<ITEM 3>
<ITEM 4>
<GROUP 5>
<ITEM 5>
.................................

Dots are displayed on the screen.So it's a problem to figure out the number of records on half a page.

Expected output:

Page 1

<GROUP 1>
<GROUP 2>
<ITEM 1>
<ITEM 2>
.................................
<GROUP 3>
<GROUP 4>

<GROUP 1>
<GROUP 2>
<ITEM 1>
<ITEM 2>
.................................
<GROUP 3>
<GROUP 4>

Page 2

<ITEM 3>
<ITEM 4>
<GROUP 5>
<ITEM 5>
.................................

<ITEM 3>
<ITEM 4>
<GROUP 5>
<ITEM 5>
.................................
 
To count lines, create a formula {@linecnt}:

whileprintingrecords;
numbervar linecnt := linecnt + 1;

Place this formula in ALL displayed sections of the subreport: group headers, details, group footers. Observe the total on your first page. Let's say it is 54, so that a half page = 27 lines.

Use SV's suggestion of multiple report footer sections. Save the subreport as a standalone report and then import add it multiple times to the main report. If you expect to have 8 pages, then add the subreport to 16 different report footer sections and then create a separate suppression formula for the subreports on each page. On page 1 (the first two subreports), you would go into each subreport and go to the section expert(format->section) and for each section displayed on the subreport (group headers, details, group footers) go to the x+2 button and enter:

{@linecnt} > 27

On page 2 (second set of two subreports), repeat, using this formula:

not({@linecnt} in 28 to 54)

On page 3:
not({@linecnt} in 55 to 81)

...etc. This is not elegant, but worked when I tested it.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top