Refreshing RDLC Dataset in Visual Studio

Refreshing RDLC Dataset in Visual Studio

Getting Changes from the RDLC Dataset

When you design RDL(C) Layouts, you usually work with datasets. The dataset defines which data you can use in your report. When you worked with C/SIDE, there has always been a difference how changes in the RDLC dataset were handled by Visual Studio and Report Builder.

Once you had Report Builder opened with a specific dataset, you could not change the dataset and reload the changes without reopening Report Builder. For Visual Studio on the other hand you could reload the dataset in Visual Studio if you changed it in C/SIDE. You can read more details about RDLC dataset refreshing here.

Let’s say you have a simple report that prints a list with all your customers and some information about them. While you have your layout open, you decide that you want to print a new text on your report.

With C/SIDE, you could simply add a new TextConstant to your dataset and then reload the dataset in Visual Studio. No need to reopen Visual Studio. Sadly this does not seem to work anymore when having a Visual Studio Code Project and designing the RDLC Layout in Visual Studio.

A real example

I can show you an example for this:

For this purpose we will use the standard report 101 (Customer – List).

To get the RDLC Layout and the AL Code, follow the steps in this tutorial. After getting the “.al” and “.rdlc” files I change the ID to 50100 and change the name to make this message disappear:

Now we are good to go:

Right click on “Customer – List.rdlc” and open it externally:

We can see our dataset inside Visual Studio:

Scroll down our “CustomerList.al” file and define our label like this:

This is not enough. To include the new text in our dataset, we add our text after the last column of the dataset:

Build the project with “Terminal -> Run Build Task (Ctrl+Shift+B)”

When you saved your changes in C/SIDE, you were informed in Visual Studio that something changed and you could load the changes. This does not happen with Visual Studio Code and Visual Studio.

If I now try to refresh the DataSet_Result manually, I get this:

“The report editor did not behave correctly. To avoid losing work, please save your solution, close then reopen the report.”

A refresh does not bring you the desired effect. You will have to reopen Visual Studio to let the changes take effect.

Leave a Reply

%d bloggers like this: