如果数据表中没有行,则取消 Crystal Reports 部分 [英] Suppress Crystal Reports section if there are no rows in a datatable

查看:19
本文介绍了如果数据表中没有行,则取消 Crystal Reports 部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想隐藏 Crystal Report 中的一个部分.如果我正在使用的数据集中的特定表中有 0 行,我需要抑制它.我该怎么做?提供的记录编号特殊字段似乎是报告中记录的内部计数,与基础数据表中的行无关.

I have a section in a Crystal Report that I want to suppress. I need to suppress it if there are 0 rows in a particular table in the dataset I am using. How would I do this? The Record Number special field provided appears to be an internal count of records in the report, and does not relate to the rows in the underlying data table.

我正在从 C# 创建报告,但我无法从代码中隐藏该部分(它不适合项目结构) - 我必须能够从报告本身中完成.相关表肯定会传递给数据集中的报表,但它包含 0 行.必须有一种方法可以在报告本身中建立这一点.....

I am creating the report from C#, but I cannot suppress the section from the code (it doesn't fit the project structure) - I must be able to do it from the report itself. The table concerned is definitely being passed to the report in the dataset, but it contains 0 rows. There must be a way to establish this inside the report itself.....

有人能指出我正确的方向吗?

Can anyone please point me in the right direction?

推荐答案

在 Crystal Reports 设计器中,查看您的部分的属性,应该有一个抑制选项,您可以给它一个公式以返回适当的布尔值价值.

In the Crystal Reports designer, view the properties of your section and there should be an option to Suppress, which you can give it a formula to return the appropriate boolean value.

然后您可以在该公式中使用 Count() 函数,并且(我相信)您可以将数据集的名称传递给 Count() 函数以获取该数据集中的行数.

You could then use the Count() function within that formula and (I believe) you can pass the name of your dataset to the Count() function to get the number of rows in that dataset.

大约 3 个月前,我对一份复杂的报告做了同样的事情,但我换了工作,再也无法访问该报告,所以很抱歉我不能说得更具体,但希望这为您提供了一个起点.

I did the same thing on a complex report about 3 months ago but I don't have access to the report any more having changed jobs so I'm sorry I cannot be more specific, but hoepfully this gives you a starting point.

刚刚使用了一个快速的谷歌 - 试试这个.

Just had a quick Google - try this.

这篇关于如果数据表中没有行,则取消 Crystal Reports 部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆