Tuesday, December 17, 2013

How to edit .rdlc file to add new column

I have a requirement to add new column in existing report. Unfortunately rdlc file was given by a third party vendor and we don’t have the complete project and dataset to edit the file.

As you are aware .rdlc is just an XML file, once you open that in notepad or any editor you can see what and all contents are visible in reports. But if you start editing the .rdlc file manually it will be a never ending process.

Here we are going to edit .rdlc file by using Visual Studio. Of course you require Visual Studio Business Intelligence to edit .rdlc file, also I am expecting you to have an access to the database to add new field in your stored procedure or SQL query which is executed from .rdlc to populate the data in reports.

Now we will go to step by step procedure.

1. Convert .rdlc to .rdl first—> This is a very simple technique. You just need to change the extension from .rdlc to .rdl. This will automatically convert the file.

2. Open Visual Studio business intelligence and select new—> Project—> Report project.

3. Right Click solution and select Add—>Existing Items—> Locate your renamed .rdl file.

 1. Add RDL file

2. Add Existing RDL file

4. Double Click .rdl file to open it in design mode.

5. Select the last field or the field near to the new one you are going to add. In this example I am adding the new column as the last one.

6. Right Click on the selected field and select Insert Column. You can opt either left or right depends on your choice.

3. Insert New column in RDL file

7. Provide required name for the new fields. Here I am giving the name as Test.

4. New column in RDL file

8. Now we will add new field in the DataSet. Click on View menu and select report Data to show the dataset.

5. View DataSet and DataSource in SSRS

9. Right Click Dataset and select DataSet Properties.

6. Add new column in DataSet

6. Click on Add button to add new field in the DataSet.

7. Add new column in DataSet

8. Add new column in DataSet

7. And the last steps is to modify your Stored procedure/SQL query to add the new field you added in the reports.

8. Now it’s the time to convert .rdl to .rdlc. and it is exactly same as the firs step, just change the extension from .rdl to .rdlc.

Just copy the .rdlc file in your project folder where it has been placed earlier and access it from your application…That’s it!!!

If you have any doubt or confusion in above steps you can always contact me using my mail ID or write comment below.

No comments: