Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Dataset for Microsoft reporting

When we use SSRS to create reports, we can use query box in Dataset window to create custom queries. But in local reports (.RDLC) when we want to create reports we should set a designed Dataset for report.

enter image description here

The problem is when we have 100 reports we should also have 100 Datasets.Currently we use a Dataset with these fields (F1,F2,F3,...,F100) and before binding our datatable to reports we change name of the datatable columns. but it's readability is low.

I want to ask that is there better way to solve this problem?

Thanks

like image 551
Arian Avatar asked Jul 26 '16 05:07

Arian


People also ask

What is a dataset in reporting?

A dataset contains the information that is needed to retrieve a specific set of data from a data source. There are two types of datasets: embedded and shared. An embedded dataset is defined in a report and used only by that report.

Can you import Microsoft Excel data to SSRS?

The first thing you will need are executables from Microsoft to enable OLEDB and ODBC connections to the source data. SSRS will not be able to use ODBC or OLEDB until the specific drivers for these types of files are installed on the server. You will need to download and install the following on your SSRS server.


2 Answers

Its the best solution is grouping the datasets. You can group dataset avoid by their business. For example POLICY.xsd , USER.xsd, INVOICE.xsd and add to other dataset into to the xsd file.

For example In visual studio you see 10 dataset file. But every item have different datatables.

Second upgrade is you will write better t-sql. When you general select your column for similar report you will use same datatables.

For example A report include 5 columsn A1,A2,A3,A4,A5 B report include 6 column A1,A2,A3,A4,A5,A6

for these report you will use B report's datatable

like image 99
Emre Ekşioğlu Avatar answered Oct 25 '22 21:10

Emre Ekşioğlu


I may need more information in order to help - are you really saying that you have Datasets with fields labeled F1, F2, F3, ... and that you now need to bind to the actual tables with columns labeled (for example) Id, CustType, IsActive, ... ?

If this is the case then I would suggest using Views that alias each fieldname to be F1, F2,... This may sound like just as much work as your original problem but everything can be automated.

Creating these 100 views can be achieved via a script. This script can be produced by running some smart T-SQL that obtains the schema data stored in SQL Server and outputs the script required.

Have a look at How can I get column names from a table in SQL Server? to get started.

You will probably need to use cursors in your T-SQL to loop through the schema data and output the script to create the views.

Finally, if you need to modify each of your 100 SSRS reports in the same manner then don't forget that each is stored in Report Definition Language (XML) so you may be able to write a small utility that reads each XML file and makes the necessary changes. Don't forget to backup those files first before letting a new utility loose on them.

I hope all this helps and that the answer has not arrived too late.

like image 44
Jason Werry Avatar answered Oct 25 '22 23:10

Jason Werry