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

馋奶兔 提交于 2019-12-23 03:04:25

问题


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





回答1:


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.




回答2:


Write following formula on new page after property of detail section

if recordnumber mod 5 = 0 then true else false




回答3:


Barry's Example given above works perfectly... The only problem I had with it is that I was doing page breaks after a specified group. Since Barry's method was dependent on RecordNumber this threw the RecordNumber count off as their is currently no way to reset the RecordNumber on a page break.

I ended up resolving this by placing the detail section in a sub report off of the main report... this created a recordNumber reset as the RecordNumber resets with each sub report link change.

A lot of work to institute something that Crystal should have implemented by now... but I have researched this a lot and have not found an easier way to handle this.



来源:https://stackoverflow.com/questions/5483252/how-to-set-maximum-number-of-record-in-detail-section-in-crystal-report

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!