How to set MAXIMUM number of record in DETAIL SECTION in crystal report

crystal-reports

How to set MAXIMUM number of record in DETAIL SECTION in crystal report
I am making Report which has Pre-Printed Format.
Which allows Six Lines of row to be PRINTED.
So in report if i get More then Six row in detail Section then it should be set on next page of report.
Now say i get 8 rows in detail section then First Page with Six rows should be set & remaining 2 rows should be set on second page & 6 rows blank space should be automatically added in second pages detail section.

I have tried like :
section expert for the detail section and against New Page After add the formula (x-2)
recordnumber mod 6 = 0

But it only works when i just have to set Maximum row for Page but
IT DO NOT ADD ANY BLACK ROW IF THERE ARE LESS ROW IN DETAIL SECTION
but i want to add blank row.

Ex:
Order Description Quantity

123 Item 1 500

124 Item 2 350




Best Solution

This is possible to do but it is a bit of hack. I'm pretty sure there is nothing built in to Crystal that will do this for you.

First you need to add a new formula field to your report in the Detail Section, with the following formula:

(RecordNumber Mod 6)

I have called this formula mod_record.

You then need to add 5 new sections below your main Detail section. Add a single line to each of the new sections you have just added.

In the first detail section (Details b) go to Section Expert and click the formula button next to Suppress (No Drill-Down). In the formula you need to put the following:

If OnLastRecord = true Then
  If {@Mod_Record} <= 1 Then 
      false 
  Else 
      true
Else
  true

The formula is the same for each detail section apart from one change. You need to replace the <= 1 with the following for each section:

  • Details c should be <=3
  • Details d should be <=4
  • Details e should be <=5
  • Details f should be <=6

This will give the impression that the details section is a fixed width of 6 lines.

Hope this helps.

Related Question