C#我如何以编程方式隐藏水晶“ SubReport”?

时间:2018-09-18 19:21:00

标签: c# crystal-reports

iam使用Viual Studio 2015和Crystal Report 而且我有两个子报告 当行数为0或表为空时如何隐藏节或子报表

我试试这个: 1节专家 2次点击x-2按钮 3在公式上写上

       if ({Alarms.ID1}>1) then true
        if (sum({Alarms.ID1})>0 then false else true
        if (isNull({Alarms.ID1}) then true

尝试乳液,但不起作用

但是没有用 什么是探针? 我应该做什么?

1 个答案:

答案 0 :(得分:0)

You should use the feature to allow to auto suppress when empty.

  1. Go in the main report
  2. Right click the subreport
  3. select "format object"
  4. Click the subreport tab
  5. Check "Suppress Blank Subreport"

Once that is done just make sure all section in the sub report are actually properly suppressed when there is no data then the main report will detect it's empty and will not print it.

To check for empty you can simply do a count over the column of your dataset like the following. In the suppress of each section in the subreport simply put the following. If there is no count (no record) the section will suppress.

count({Alarms.ID1}) = 0

or you could use the long way and write the following if you prefer this syntax

if count({Alarms.ID1}) = 0 then true
else false