如果ENTIRE客户包含一个范围内的1件货物,请予以取消

时间:2014-08-19 22:15:05

标签: sql filter crystal-reports range suppress

希望这是有道理的。首先发布在这里。

我正在尝试抑制父项的所有实例,而我的参数只影响子项。我遇到了一个问题,我希望看到所有发货超出日期范围的客户,只有 客户 的货件超出该范围。

根据我目前的公式,我将退回该日期范围以外的货物的客户,但他们也可能在其中装运货物。

实施例

{customer.arcustname} ={?Customer}
AND
{jobshipment.ccdate} <> {?DateRange}

DateRange = 2014年7月1日至2014年7月31日

CUST1's上次发货时间为6/25/2014,此记录返回true

CUST27/25/2014上发货,此记录返回false

CUST2也是6/25/2014上的货件,此记录返回true并显示在我的报告中。 - 不想要

我希望我的报告仅显示CUST1,因为CUST2的货件在该范围内,但我的报告显示CUST1CUST2,因为它是仅过滤{jobshipment.ccdate}而不是整个{customer.arcustname}

任何帮助将不胜感激。谢谢!


编辑:在我的详细信息中,我所拥有的是{customer.arcustname}。我希望我的报告显示的是一个客户列表(按销售人员提示),他们没有在指定的时间段内订购。我看到的所有答案只显示不在范围内的货物,我只想看到那些在日期范围内没有发货的客户。如果他们有货,我希望我的报告中省略{customer.arcustname}。


HERE是原始SQL:
SELECT customer."armasterid",customer."arcustname", salesperson."arsalesname",jobshipment."ccdate" FROM ( ( "public".customer customer LEFT OUTER JOIN "public".salesperson salesperson ON customer.arsalesid=salesperson.arsalesid ) LEFT OUTER JOIN "public".job job ON customer.armasterid=job.armasterid )
LEFT OUTER JOIN "public".jobshipment jobshipment ON job.ccmasterid=jobshipment.ccmasterid WHERE ((#NUMBER CONSTANT# = customer."arsalesid")) AND ((NOT ( (customer."araccountstatus" = 'I') ))) ORDER BY customer."arcustname"

1 个答案:

答案 0 :(得分:0)

Below solution works assuming you have a customer group and placed dates in detail as you haven't mentioned report structure.
  1. 创建公式@count以计算不在范围内的日期的出现次数。

    if {jobshipment.ccdate} <> {?DateRange}
    then 0
    else 1
    
  2. 2.现在创建一个摘要字段(名为{@countSummary}),其中我们取@count的总和。将其放在组页脚

    3.在组头(客户组)的supress部分,详细信息和组页脚(客户组)中写下以下的supress条件。

        EvaluateAfter({@count});
    
    
     if ({@countSummary}) <> 0
    then true
    else false