This blog-post will show how to add toggle visibility feature to your reports.

To start with, I have a simple Customer list report dataset as shown below:
Capture1

 

In my report object, I defined 2 global variables:

CountryRec is a Record variable pointing to Country/Region table and CountryName variable of type text(100).

CountryName is calculated on the OnAfterGetRecord() trigger of the customer DataItem:

Capture2

 

In the Visual Studio Layout Designer, I used a table control to display the data in the body section and I used a text box control to show the title of the report in the header.

Next, to group the customer list country wise, Under row groups, right click on Details group, select Add group and Parent group.

Capture3

 

Select Group by Country, optionally you can choose to Add a group header and click on OK.

Capture4

Now we have a simple customer list which is grouped on country.

The report preview looks like below:

Capture5

When the report data is huge, you might find it difficult to search for relevant data quickly.

For example, if you want to search for customers in South Africa, you have to scroll down/search multiple pages to get the required data.

However, Toggle visibility feature proves to be helpful in such cases.

In the Visual studio layout designer, right click on Details row group to open Group Properties window. Choose Visibility on the left hand side to set the Toggle visibility property. By default if you want to hide all the data, select option Hide under When the report is initially run.

Enable the Toggle Visibility (Display can be toggled by this report item) option. We also need to select the item on which the display is toggled. Hence, select Country from the drop down. Click on OK and save the layout.

Capture6

Now, when you run the report, the preview hides all the data by default.

However, You will be able find the relevant country quickly and expand it to find more details. The below image shows the output where only South Africa data is expanded. You can click on the small + mark for more details under each group.

Capture7

This is another useful interactive report property which lets the end users expand and collapse data on the reports.

More about Microsoft Dynamics NAV reports here

Thanks you :)