Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Report Viewer visibility with sum expression

I’m trying to show or hide a tablix depending on if it has elements to show or not.

My idea is to do something like this:

=IIF(SUM(IIF(IsNothing(Fields!Country.Value),0,Fields!Country.Value), "NameOfTheDataSet",Recursive) = 0, True, False)

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I’m trying to count the field "Country", since it is the only compulsory field from the tablix.

But that throws an error when there is data in the table. When the table is empty the report works fine.

Any ideas?

>Solution :

I do not know how you fire your report, but most likely through visual studio code like C# or VB.

If that is the case, the data source of your report would be a datatable/dataset from the code. Why don’t you test for number of records in your datatable before calling the report? e.g if (MyDt.Rows.Count == 0 ). If it is true, do not fire the report, just send a message to the user "No Record to Show".

But if you still want to do it within RDLC, that your formular will not work for record count.

Maybe you drop a summary field on your report that is the Count of your country field. There is Count function in RDLC when you right-click and see the expression of a field, study it. It is not what I can explain here.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading