locked
Disable or enable the paramenters RRS feed

  • Question

  • Hi All,

    I have a report with  3 filter . Startdate and  Endate , Year .

    Client can able to view the report with Startdate and  Endate  or Year .

    So how can i disable the Start date and  End date  if select Year  ?

    So how can i disable the Year filter  if select Start date and  End date.

    Please can you suggest the solutions for this ..

    thanks,

    Sri

    Wednesday, November 25, 2015 8:45 AM

Answers

  • Hi Sri,

    Just as Visakh said, in Reporting Service, we can’t set the parameter visibility to Visible or Hidden based on a condition. And we can’t enable or disable a parameter at run time, it is not supported in current release of Reporting Services.

    In Reporting Service, There are only three methods for parameter's Available Values:

    • None
    • Specify values
    • Get values from a query


    The former two methods is not suit for create a relationship between two parameters, we have to utilize the third option, to get these values from a dataset. So we cannot achieve the goal without using Dataset.

    Meanwhile, even if you created the Dataset, you still cannot achieve the goal. Because we can't directly enable or disable a parameter with another parameter (or any code within the report.) To work around this issue, please refer to the following similar thread:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/13fdccf1-9a79-493b-a6a0-97c67585c3f7/cascading-date-parameter?forum=sqlreportingservices

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Thursday, December 3, 2015 6:42 AM

All replies

  • Not exactly disable but you can do workaround.

    You can make the parameters cascaded for this. Just include Year as a parameter in the dataset queries for Start date and End date parameters. Then based on the year value selection populate the values for the date parameters or disable them by setting a default value

    Then you need to change the query filter logic also as below

    WHERE (YEAR(datefield) = @Year
    OR (@Year IS NULL AND datefield >= DATEADD(DATEDIFF(dd,0,@StartDate),0)
    AND datefield <  DATEADD(DATEDIFF(dd,0,@EndDate),1)
    )
    )
    and set default as NULL for year parameter


    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    ----------------------------
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

    Wednesday, November 25, 2015 8:56 AM
  • Hi Visakh ,

    Thanks for the answer . But it seems the script you given is not working and show the syntax error in date add part.

    is there any other way to solve the issue.

    Thanks,

    Sri

    Wednesday, December 2, 2015 11:34 AM
  • Hi Sri,

    Just as Visakh said, in Reporting Service, we can’t set the parameter visibility to Visible or Hidden based on a condition. And we can’t enable or disable a parameter at run time, it is not supported in current release of Reporting Services.

    In Reporting Service, There are only three methods for parameter's Available Values:

    • None
    • Specify values
    • Get values from a query


    The former two methods is not suit for create a relationship between two parameters, we have to utilize the third option, to get these values from a dataset. So we cannot achieve the goal without using Dataset.

    Meanwhile, even if you created the Dataset, you still cannot achieve the goal. Because we can't directly enable or disable a parameter with another parameter (or any code within the report.) To work around this issue, please refer to the following similar thread:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/13fdccf1-9a79-493b-a6a0-97c67585c3f7/cascading-date-parameter?forum=sqlreportingservices

    Thanks,
    Katherine Xiong


    Katherine Xiong
    TechNet Community Support

    Thursday, December 3, 2015 6:42 AM