Click here to Skip to main content
15,886,067 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi guys,

i have crystal report, just i have designed the report but not yet connected with the database.

Before connecting to the data base. I want to display fixed no.of lines in Details section of the report.

For Maximum no.of records, i have done in: 
Details Section -> Section Expert -> Paging tab. [here its ok].
it will effect after connecting n fetching the value from the data base.


But, if the table had only 5 to 10 records, more or less, the requirement is to display, default maximum no.of lines should be 20.

Can any one please, help me...

Thanks
Posted
Updated 19-Oct-14 21:29pm
v2

1 solution

To limit the number of records per page, you need to create two formulas that create a running total for each page.

1st Formula: HeaderReset - This formula should be placed in the page header of the report. It will reset the counter when the report is processed to the next page. Counter is a variable that stores the number as the report processes each record.

WhilePrintingRecords;
NumberVar counter:=0

2nd Formula: CountDetails - This formula should be placed in the Details section. It will count each record and increment by one.

WhilePrintingRecords;
NumberVar counter;
counter:=counter+1

You will now need to use the CountDetails formula to force the new page based on the necessary number of records. To do this:
bullet

Go to Format/Section and select the Details section.
bullet

Click on the X+2 button to the right of the "New Page After" option. Be sure not to place a check in the New Page After box. Once you click on the button, you will be placed in the formula editor. Enter the following formula:
{@CountDetails}=7
(enter the number of records you need on each page)
bullet

This condition will force a new page when Crystal reaches the seventh record in the details section. The count will reset to zero at the beginning of each page due to the @HeaderReset formula.

If you need to count the Group Header records instead of the Details section, follow the above instructions for the details section, but place the formula and condition in the Group Header section instead of the Details section.

To hide the formula fields in the header and details section, right click on the field and go to format font. Change the color to white and you will not be able to see them.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900