Posts

Showing posts from June, 2012

SSRS Switch statement with Not IsNothing condition

Sometimes it is required that you have display one of the available contact numbers such as either home phone or work phone or cell phone. I came across this requirement for one of our SSRS reports where we have to display the table of customers with one of their contact numbers. Here is the expression i used: Switch (   Not(IsNothing(Fields!home_phone.Value)),Fields!home_phone.Value,   Not(IsNothing(Fields!work_phone.Value)),Fields!work_phone.Value,   Not(IsNothing(Fields!cell_phone.Value)),Fields!cell_phone.Value,   1=1,"No # Listed" ) It works like a charm. How it works: The Switch statement will first check if home phone is present. If its not null then select home phone. else it will check for work phone. If work phone is not null then select it else check for cell phone, so on and so forth. The last condition is "1=1" meaning it is always true. So in case if none of the numbers are available, then select this value  "No # Listed"

[rsMissingDataSetName] The data set name is missing in the data region ‘DataSetName’

It is a very common compilation error that Visual studio throws when you try to add multiple datasets to your report (.rdl) file. At the time of this writing, i am using MS Visual studio 2008 and developing a report to be deployed on SQL Server 2005 database. I had the following two datasets : 1. dataset1: To retrieve the stored procedure and fill the table in the report with the data 2. dataset2: The stored procedure requires two input parameters (one is date and other is list of valid values) To populate the list of valid values, i need to get the data from database. I used this dataset to query the table and return the list of valid values. Here is how you can fix this compilation problem: 1. Open the layout tab of your report. 2. Select the table where dataset1 is being used. 3. Right-click and select the "properties" menu option. You should be able to see the table properties on right hand side lower pane. 4.  Under the table properties, look for DataSetName. Yo