Showing posts with label SSRS. Show all posts
Showing posts with label SSRS. Show all posts

2013/01/30

SQL Parameter Selector

Hi

This is something that i came across couple of times while working on a reporting project , and i hope it might help someone else 

We have a data set that we need to select form the database based on list of parameter , the client requirements was to have a selector that identify which filed to filter against with  start and finish date parameters 

table structure

UserID     ActionID    StartDate   FinishDate

the selection criteria was the user can select if they want to filter based on the start date or on the finish date , that means on the report there is only two date parameter

@startDate  and @EndDate

the solution was simple enough


  • I added a parameter called @filterselector of type boolean in the report 
  • in my query i added the following where 
((@filterselector = 1 OR 
 (dbo.I1_Storm_ProcessInstBuisnessArea.StartDate BETWEEN @StartDAte AND @FinishDate))
 AND
(@filterselector = 0 OR 
 (dbo.I1_Storm_ProcessInstBuisnessArea.FinishDate BETWEEN @StartDAte AND @FinishDate)))


simple and easy solution , please if you know a better way let me know :) 


cheers
Malek 

2012/08/01

SSRS Error

Hi All 


I know it should be about project server 2010 but for this im making a small change and i just want to mention a small error that consumed some of my time trying to figure it out in SQL reporting service .


so basically i was creating a custom report for one of our clients , did a small modification on my SQL statement and let the fun begin the error below appeared 


2 hours wasted 


and as you can notice the error message  is not helpful not in any way  but apparently it was an issue with my Query which is running perfectly on SQL and on the query designer retrieving the data with no issues 


my SQL was something like this (just an example) 


SELECT p.TaskDate , p.TaskName , x.TaskDate FROM 


Table1 p JOIN Table2 x on p.TaskDate = x.TaskDate




the query will never have a problem on SQL or with the query designer , 


but the problem is SQL reporting service couldn't handle the same column name generated so you need to use aliases  , just do that and you are good to go 




Cheers hope this will help 
Malek