Suppress Crystal Reports section if there are no r

2019-01-19 07:34发布

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.

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?

4条回答
对你真心纯属浪费
2楼-- · 2019-01-19 08:04

Create one dummy group,check on its header for each page,add the header in the group header of the dummy group.

查看更多
beautiful°
3楼-- · 2019-01-19 08:06

If the section does only contain database fields and f.e. no text fields, then you could use the setting "Suppress Blank Section" in the "Section Export" (rightclick section) for that section.

As an alternative you could use the following formula in the "Suppress" in the "Section Export" for that section:

IsNull({table.field})

"{table.field}" is one of the fields in the dataset.

Hope this helps.

查看更多
Bombasti
4楼-- · 2019-01-19 08:13

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.

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.

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.

查看更多
唯我独甜
5楼-- · 2019-01-19 08:18

Go to "Section Expert" and click "Supress (No Drill-Down)" and try adding this:

IF {"DragYourFieldHere"} = "" then true else false
查看更多
登录 后发表回答