Toggle Visibility of a Table using Report Parameter

1 Answer 42 Views
Report Designer (standalone) Styling
Joseph
Top achievements
Rank 2
Joseph asked on 26 Apr 2023, 07:03 PM

I have a parameter in my report called "AvailableTables", which is bound to a CSV datasource with:

"table1",1

"table2",2

and the Value is bound to the digits, and the Label is bound to the "table1","table2"

I have a table in my report named firstTable which Visibility = False.  On that table, I have set up a conditional formatting rule such that when the value of a Report Parameter =1, it applys a format where visible is checked.

Similarly, I have a table in my report named secondTable which Visibility = False.  On that table, I have set up a conditional formatting rule such that when the value of a Report Parameter =2, it applys a format where visible is checked.

 

However, when I run my report, and change the report parameter, the "firstTable" and the "secondTable" never become visible.  I know the databinds are correct, as if I set Visible = True on that table, the data shows itself.  I also know that the Report Parameter is outputting the value of "1" and "2", as it is displayed in a textbox in my header.

Does telerik reporting support conditional formatting of visibility of a table based on report parameters?

 

I have attached a zipped TRDP file which illustrates the behavior in the standalone report designer.

1 Answer, 1 is accepted

Sort by
1
Accepted
Ivan Hristov
Telerik team
answered on 29 Apr 2023, 10:20 PM

Hi Joseph,

Thanks for the detailed explanation and attached report. I examined it and found the reason for this behavior. It's due to the way the Style of the Conditional Formatting' rule is applied. The routine that applies the Style properties to the report item (Table in your case), evaluates each property against its default state.

Since the default value of the Visible property is true, it is not detected as changed, hence not applied. The solution is to leave your tables visible by default and make them invisible using the Conditional Formatting rule. 

In this case the corresponding rule for Table 1, for example, should look like this:

I've used the "<>" operator, basically converting the rule expression to "If the ReportParameter value is not equal to 1, make Table1 invisible.". The expression for Table 2 follows the same pattern.

I've attached the modified report as a reference. Please note that I used Telerik Reporting 2023 R1 SP1 to edit it, so if you're using an older version, the report might not open and you'll have to upgrade your version of Telerik Reporting. However, the approach to achieve the desired behavior is the same regardless of the version you're using.

Hope this helps.

Regards,
Ivan Hristov
Progress Telerik

Brand new Telerik Reporting course in Virtual Classroom - the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products. Check it out at https://learn.telerik.com/.
Joseph
Top achievements
Rank 2
commented on 02 May 2023, 04:59 PM

Thank you - this is an excellent explanation, and I have implemented it with success.
Tags
Report Designer (standalone) Styling
Asked by
Joseph
Top achievements
Rank 2
Answers by
Ivan Hristov
Telerik team
Share this question
or