Search This Blog

Thursday, 20 September 2012

Export Matrix data into a Tabular format in CSV export

Generally we need CSV file format for further operations like in data analysis or as an input file for any data processing etc. But usually we design the report in such a way that makes it rich in visualization and information. So the question comes in our mind is how can we achieve both the things in the one report?
Let’s discuss a scenario where we have placed matrix control on the report and want the data in tabular format in CSV export.
Image-1 is the report output  
Image- 1

and Image-2 is the expected CSV output.
Image - 2

I believe that you can design the matrix as per your requirement. So below I am going to explain the method that will help you to get this expected CSV output.
Step 1:
Select the matrix control and open the property window using F4 key. In the property window, you will see the DataElementOutput property. Set DataElementOutput’s value to NoOutput.
Step 2:
Place a table control on the report and design it for CSV output. Do not place any header row in the table. If you see any header row then delete it. Now give the appropriate name to detail row cells. If you want a specific name for a column in the CSV then you needs to either give that name to cell’s Name property or specify that name in cell’s DataElementName property.
At the end, select this table open the property window using F4 key and set Hidden=True and DataElementOutput= Output.
Image - 3
 In our scenario, table design will look like image-3

Now preview the report and export it into CSV. You will see the desire output in CSV as well as in report view.

Let’s discuss couple of properties of the controls that helps us in getting desire CSV output.
·         DataElementOutput : If you don’t want to see a specific control/cell/column in the CSV export then set it to NoOutput
·         DataElementName : If you specify a value in this property, the same value will appear as a column name in the CSV
·         Visibility/Hidden : If you set a control/cell/column hidden=True then it will not appear in the report preview but it will appear in the CSV export. So apart from hidden=True, you need to set  DataElementOutput= NoOutput

You can download the sample RDL from
You need to only change the DataSource of this sample RDL.