分组摘要

时间:2012-09-24 18:06:26

标签: crystal-reports

所以我想知道有多少货物运送了多少件不同的物品。例如:我有一份报告按发货对数据进行分组。即每件货物多件。现在,我想要做的是将那些项目的数量分组来回答问题,"出货4件物品的数量是多少?"

这样的事情:

5 Shipments with 2 items <--------------------- How do I get these groups?
    Shipment # 123443     Number of items: 2  \
    Shipment # 342312     Number of items: 2   \
    Shipment # 218245     Number of items: 2    = These are already groups with a
    Shipment # 342523     Number of items: 2   /   count of items per shipment
    Shipment # 345234     Number of items: 2  /

2 Shipments with 3 items  
    Shipment # 218154     Number of items: 3
    Shipment # 1518451    Number of items: 3 

1 个答案:

答案 0 :(得分:1)

您必须在数据库端或通过CR中的SQL命令或SQL表达式实现此功能。例如,类似下面的SQL表达式将起作用:

(select count(item)
from shipment
where shipmentID = "shipment"."shipmentID")

然后,只需对此新表达式进行分组,该表达式将为您提供报表中每行的每件货物的数量。