Home > Mobile >  Report Viewer visibility with sum expression
Report Viewer visibility with sum expression

Time:04-19

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)

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?

CodePudding user response:

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.

  • Related