Confusion in optional Parameters in SSRS
Hi I have some parameter in my report. I want to allow all of them optional. like if I enter some value in any box only that filter will apply. i've found some solutions but i dont think then meet my requirements. :( Thanks for ur time.
October 24th, 2011 6:23am

Hi Syed, It has to be a combination of your report parameter properties and dataset query. 1) You should set the report parameter property to accept blanks/nulls. So if you dont enter, it should work. 2) You should write your query in such a way that if null or blank is accepted as parameter, the dataset query would not be filtered by that parameter. If you give more details of your query as well as your report parameters, I can help furtherCheers, Jason P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Free Windows Admin Tool Kit Click here and download it now
October 24th, 2011 6:30am

Hi Thomas, First of all thanks for ur answer. Here is my query please rewrite it if u can. Thanks SELECT RegNo, MvaNo, Make, Model, Colour, SaleDate ,SalePeriod FROM vi_SSRS_Sale_List_Salglisteokonomisk WHERE (SaleDate >= @FromDate) AND (SaleDate <= @ToDate) AND (SalePeriod = @SalePeriod)
October 24th, 2011 6:51am

You can make your query dynamic, something like shown below ="SELECT RegNo, MvaNo, Make, Model, Colour, SaleDate ,SalePeriod FROM vi_SSRS_Sale_List_Salglisteokonomisk WHERE "+iif(@FromDate="","1=1 AND ", "(SaleDate >= @FromDate) AND ")+iif(@SaleDate="",,"1=1 AND ", "(SaleDate <= @ToDate) AND ")+iif(SalePeriod="","1=1","(SalePeriod = @SalePeriod)") Just make sure that everything is in one line, else you might have to add the concatenation symbols for line breaks. Didn't check the syntax properly but hope you got an idea.Cheers, Jason P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Free Windows Admin Tool Kit Click here and download it now
October 24th, 2011 7:21am

thanks but do I need to write this query in SSRS or in SP? By the way I'm not using SP.
October 24th, 2011 8:24am

In SSRS. Once you have executed the query you have written before, and close the dataset window, then you should see alll the columns in your layout. After this, open the query again, paste this query in the expresssions and close. Dont execute. Now when the report runs, it should run properlyCheers, Jason P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Free Windows Admin Tool Kit Click here and download it now
October 24th, 2011 8:31am

Hi Thomas, T H A N K S A L O T. YOU MADE MY DAY MAN. I did this with the help of your golden guidance. lot of well wishes for you. :) :) :) :)
October 24th, 2011 8:51am

You can make your query dynamic, something like shown below ="SELECT RegNo, MvaNo, Make, Model, Colour, SaleDate ,SalePeriod FROM vi_SSRS_Sale_List_Salglisteokonomisk WHERE "+iif(@FromDate="","1=1 AND ", "(SaleDate >= @FromDate) AND ")+iif(@SaleDate="",,"1=1 AND ", "(SaleDate <= @ToDate) AND ")+iif(SalePeriod="","1=1","(SalePeriod = @SalePeriod)") Just make sure that everything is in one line, else you might have to add the concatenation symbols for line breaks. Didn't check the syntax properly but hope you got an idea.Cheers, Jason P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
Free Windows Admin Tool Kit Click here and download it now
October 24th, 2011 2:19pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics