Conditional visibility of a textbox based on a filter

1 Answer 234 Views
Report Designer
Derek
Top achievements
Rank 1
Iron
Derek asked on 27 Feb 2023, 09:11 PM

Good afternoon!

I am currently working on a report that needs to be limited to a single page. In order to accomplish this, I limited a subreport containing a list of case charges using the Top N filter (shown in the attached picture). This operates exactly how I'd like it to- it limits the charges list to 5 if there are more than 5 charges.

I would; however, like there to be an indicator on the page if the list exceeds the limit of 5 (or if the top n filter is active). I believe the best way to accomplish this would be to have a textbox that is visible on the page if there are more than 5 charges and invisible if there are less than five charges.

I tried using various filters and conditional formatting rules, but nothing I have tried so far has worked.

Is there an easy way to accomplish this, or a function I should be using? Would it be beneficial to create a second subreport?

Thank you!

1 Answer, 1 is accepted

Sort by
1
Accepted
Momchil
Telerik team
answered on 02 Mar 2023, 12:13 PM

Hello Derek,

To achieve the functionality you described, you can Bind the Visible property of the "indicator" TextBox to an Expression that has access to the number of records in the data source of the sub-report.

The approach that I would suggest to implement the above is the following.

1. Set the DataSource property of your sub-report to the data source you wish to use.

2. Add a Report Header section to the sub-report if you do not have it already. We want to use it because it has access to the entire data set of the report which allows us to count the number of records in the data source.

3. Move any report items from the Detail section of the sub-report to the Report Header section and bind them to the DataObject of the sub-report.

3.1 Set the Visible property of the Detail section of the sub-report to False.

3.2 Apply the Top N filter to the aforementioned report items.

4. Add an "indicator" TextBox to the Report Header section of the sub-report and apply the following binding to it.

For reference, I am attaching a short demo that illustrates the above.

I hope you find this example useful.

Best Regards,
Momchil
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Derek
Top achievements
Rank 1
Iron
commented on 02 Mar 2023, 05:59 PM

That worked! Thank you!
Tags
Report Designer
Asked by
Derek
Top achievements
Rank 1
Iron
Answers by
Momchil
Telerik team
Share this question
or