Crystal Reports: Showing only first record in each group

北城以北 提交于 2019-12-13 20:25:30

问题


I searched to get the required answer but not found exactly what iam looking for - please help me.

Please follow the steps i made in crystal report:

Using crystal report command (i created a query to get the required business number) --> which gets 5 Business numbers

Note: Every business is having many receipt numbers (1st installment receipt, 2nd installment receipts... like that....) - these receipt details are stored in table_receipts.

In table_business - i have all details about business number, customer, product details...

Please understand the links:

table_business - table_customer - table_product - table_receipts

Relationship between tables are:

  • table_business.Bno=table_receipts.Bno
  • table_customer.Cno=table_customer.Cno
  • table_product.Pno=table_product.Pno

After creating the crystal report command; i just drag the required table in crystal report (table_business, table_customer,table_product,table_receipts)

Now i created a group for Business Number "BNo"

I need to display all the required details about that selected Business Number using parameter - its coming fine except receipts.

I mean its showing all receipts (all installment receipts). I need to display only the first receipt only (i.e: receipt number starst with letter "F" )

Hope you understand my requirement - Please help me in this regard.

Expecting your valuable reply. Regards, Sensa.


回答1:


You should be able to do this by creating a forumla for suppressing the field (table_receipts.Rno).

Right-click the {table_receipts.Rno} field and select Format Field...Common tab...Check the 'Suppress' box and then click the X-2 box to the right. When the new window appears paste this:

not ({table_receipts.Rno} startswith "F")




回答2:


I might have a solution for you.

1)Open the ‘Report’ menu then select ‘Section Expert’

2)Select the ‘Details’ section from the left hand menu

3)Tick the ‘Suppress No Drill-Down’ option and click on the icon to the right of it and in the formula option put

4)RecordNumber > 1

This should suppress the whole ROW/Record and not just the field. I saw your problem from this thread, I needed the exact same solution and this worked.

show only in the first row in crystal reports details section




回答3:


Here is what I tried for the same issue and it worked. It's a 2 step process involving using Running Total Fields and Suppressing in Section Expert.

First step is to create a Running Total Field (Right under Parameter Fields) Right click on it and click New and name your field i.e. CountFirstOnly On the left you will see the fields you can perform functions on.

Select the receipts field. Bring that over to field to summarize and select count.

Under Evaluate select For Each Record

Reset on Change of Group and select your grouping, in this case business number and click OK

Drag that field into your report.

Part 2: Section Expert

Bring up the section expert on details and click on the suppress X-2 button

Your formula should be: CountFirstOnly >1

Click OK

Refresh your report

Hopefully this did the trick.




回答4:


It sounds as though the simplest way to meet this requirement would be to add a selection condition to the report - something like:

Left({table_receipts.Rno},1) = "F"

This should ensure that only the associated products and customers for the first receipt for each business are reported.



来源:https://stackoverflow.com/questions/10265941/crystal-reports-showing-only-first-record-in-each-group

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