简体   繁体   English

Crystal Reports中具有压缩线的组总计

[英]Group totals with supressed lines in Crystal Reports

Have been googling this for a couple of days now and tried various posted solutions, also from Stack Overflow. 现在已经谷歌搜索了几天,并尝试了各种已发布的解决方案,也来自Stack Overflow。

I'm making a report, where there is a check on two fields to see if they have been written before. 我正在做一份报告,检查两个字段是否已经写过。 If they are, they are suppressed 如果他们是,他们被压制

psudo-code: If {customer} and {date} as previous then suppress. psudo-code:如果{customer}和{date}一样,那么就压制。

This works fine, but I need to make a count for each group. 这很好,但我需要对每个组进行计数。 If I use the built in count function, it also counts all suppressed lines and I am running out of ways to search for a way to solve this. 如果我使用内置计数功能,它也会计算所有被抑制的行,并且我没有办法搜索解决此问题的方法。 I have tried to add a custom formula, that counts within each group and resets before next group, but it keeps adding to the total in all the other groups. 我试图添加一个自定义公式,它在每​​个组中计数并在下一组之前重置,但它会不断增加所有其他组中的总计。 Have tried it with both shared NumberVar and local NumberVar 尝试使用共享的NumberVar本地NumberVar

Never mind. 没关系。 Figured it out my self. 把它想出来了。 Some of the "posted solutions" to this specific error was not fitted exactly to my needs, so tried back and forth with various solutions. 针对这个特定错误的一些“发布的解决方案”并不完全符合我的需求,因此需要使用各种解决方案来回尝试。

When making a Running Total Field with group, it only works when it is set to reset with each group. 使用组创建“运行总计字段”时,仅在将其设置为使用每个组重置时才有效。 If you encounter this and need help to fix it, then just ask away and I will help you :) 如果你遇到这个并需要帮助来解决它,那么只要问一下,我会帮助你:)

You have to use DistinctCount instead of using regular Count . 您必须使用DistinctCount而不是使用常规Count

DistinctCount ignores duplicates and only counts records with unique value. DistinctCount忽略重复项,仅计算具有唯一值的记录。

For example, if i have data like 例如,如果我有像这样的数据

customer |   date
---------------------
john     |  01.01.2017
john     |  01.01.2017
john     |  02.01.2017

and i use regular count(customer,date) the result would be 3 . 我使用常规count(customer,date) ,结果将是3 But if i use DistinctCount(customer,date) then the result would be 2 . 但如果我使用DistinctCount(customer,date)那么结果将是2

Hope it helps 希望能帮助到你

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM