January 20, 2013

Naming Conventions for Report objects, Data Sources, and Datasets

Use naming conventions for data sources and datasets that document the source of data.
  1. Data sources. If you do not want to use an actual server or database due to security reasons, use an alias that indicates to the user what the source of data is.
    1. Start with DS and followed by databasename(Avoid server name as this will change during the deployment) (e.g. DS_AdventureWorks)
  2. Datasets. Use a name that indicates which data source it is based on.
    1. Start with DT and followed by datasorurce name and followed by meaningful name about the dataset (e.g. DT_DS_AdventureWorks_Customerinfo)
All the Report items should be named with three letter abbreviation(as shown below) followed by a meaningful name
E.g. the name of a Tablix which shows the policy summary will be “TBXPolicySummary”
Report Item Three letter Abbreviation
Text Box TXT
Line LNE
Table TBL
Matrix MTX
Rectangle REC
List LST
Image IMG
SubReport SRE
Chart CHT
Gauge GGE
DataBar DTB
Sparkline SLN
Indicatior IND

January 13, 2013

Best Practice for SSRS report development

I have put together a list of best practices for SSRS development based on my experience. Please feel free to add your thoughts
1. Always use the common template to promote a uniform reporting Experience
2. Always convert the complex queries into views and select from the view to produce a result in the report. This will help with your maintenance
· E.g. Any query with more than two Joins will be considered as complex query
3. Don’t use “Select *” in the report query
4. If you require multi stage result building or if you are using T-SQL then convert them into Procedures and call the procedure from SSRS
5. Optimise the report Query: Always follow the best practice whilst writing the SQL code. The performance of the query will directly impact the SSRS report performance so tune the query before using it in the reporting
6. Introduce only the necessary parameters as more than 6 parameters will give a poor user experience
7. Assign the default value to most of the parameters by discussing with users
· Remember if you are assign default parameters to all the parameters then the report will get auto loaded when the user select the report. If the execution time is greater than 1 minute then please go for “null” destination snapshot to cache the report.
8. If the user chooses “All” for multi select parameters then don’t send the parameter list, instead send “All” to the SQL and handle it. This will give a great boost to the performance
i. E.g if we have parameter called Branch and if the user chooses “ALL” then in the SQL use where (Branch in (@branch) or 'All' in (@branch))
9. Don’t retrieve more than what is needed. If the report delivers more than 5-6 pages (or more than 300-400 rows) of data then check with user to deliver them via E-Mail during the offline hours.

10. Use all the space
· Profile the data to understand the maximum length required. As a rule of thumb wrap the text and don’t wrap the numbers and dates
· Don’t assign more space than is required for columns
11. Before starting the report set the report width property to one of the standard paper sizes. This will give you an idea of the maximum size you can get (E.g. The width of A3 is 42 cm in Landscape mode)
12. Once developed export the report into required formats and make sure the users are happy with the extract format
· If the users want to export the report into PDF then make sure the report width fits in a page
· Use the Logical page breaks if needed for rending into different pages (Ex. Pushing each year of account into separate page)
13. If the report looks very lengthy in the report viewer then use soft page breaks via theInteractiveHeight and InteractiveWidth properties.
14. Move the Calculated fields into views. If there are calculated fields in the report then it is better to create them in a view as this will promote two things:-
· Ease of Maintenance
· Less processing load on the report server

15. Use the right data type for the parameters
E.g. Use the DateTime data type for date parameters instead of using strings. There are 3 reasons to do this:
1) Stop the bug "Cannot read the next data row for the data set"
Although a hardcoded string will work, it will not work for all users regional date/time settings.
E.g. a string data type parameter with a value of "26/01/2006" is correct for "dd/mm/yyyy", but it is wrong for "mm/dd/yyyy"
2) When SQL Reporting Services is using the DateTime data type parameter, it will get the datetime value on the user’s setting (aka the Culture DateTime format).
3) The users also get the advantage of a date/time picker control, which automatically works out the correct regional date format. This solves the US/Australian date problem. (i.e. DD and MM are reversed).
16. If your data is getting refreshed via ELT/overnight jobs then please include an additional textbox and label in the header to show the last refreshed date/time.