Answered by:
SSRS 2008r2: how we can use a checkbox as a parameter?

Question
-
Hi,
I am new in SSRS world. Is it possible to use a check box as parameters? e.g. Suppose There are 3 parameter in my reports. 1st one is Site, 2nd one is Component and Third one is a Check box (name 'ISComponentIncluded'). If we check the third parameter then the 2nd parameter will be considered otherwise it will be disabled.
Can anyone help me regarding that?
Thanks,
Rana
Friday, January 25, 2013 9:19 AM
Answers
-
As mentioned before, a checkbox to disable a parameter won't be possible unless you go for custom coding in an application.
But there is a way to get the functionality that you require. Are you populating the Available Values of your Component parameter through a query? I hope you are, if not I really recommend it.
Then in the dataset that fetches the values for the parameter, add an additional record that indicates "no selection". You can use the UNION ALL for that:
select Field1 as ParamLabel, Field2 as ParamValue from YourTable UNION ALL select '(N/A)' as ParamLabel, 0 as ParamValue
The above assumes that the data type of your parameter is numeric and that value zero doesn't occur in your dataset, such as would be the case if you use a primary key ID of type int.
MCITP SQL Server 2008 (DEV); MCTS SQL Server 2008 (BI, DEV & DBA)
Check out my articles at BI: Beer Intelligence?
- Edited by Valentino Vranken Friday, January 25, 2013 10:43 AM
- Marked as answer by Rana_Hasan Monday, January 28, 2013 4:31 AM
Friday, January 25, 2013 10:40 AM -
Rana,
As i said earlier you won't be disable a parameter totally in SSRS you can use casacading and pass some default value but still it will be visible with that value.
Regards,Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.
- Marked as answer by Rana_Hasan Monday, January 28, 2013 4:52 AM
Monday, January 28, 2013 4:46 AM
All replies
-
1. There is no checkboxes in SSRS. You can use button.
2. Your requirement is not possible with SSRS, hiding a parameter based on other parameter is not possible. A parameter is either hidden/visible.
Regards,Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.
Friday, January 25, 2013 9:48 AM -
Hello,
Agree with Eshwar. There is no checkboxes in SSRS. You can use button. for rest of your requirement You can use Cascading parameter. for more detail see this link
http://technet.microsoft.com/en-us/library/aa337498(v=sql.105).aspx
blog:My Blog/
Hope this will help you !!!
Sanjeewan
- Edited by Sanjeewan Kumar Friday, January 25, 2013 9:56 AM
Friday, January 25, 2013 9:50 AM -
As mentioned before, a checkbox to disable a parameter won't be possible unless you go for custom coding in an application.
But there is a way to get the functionality that you require. Are you populating the Available Values of your Component parameter through a query? I hope you are, if not I really recommend it.
Then in the dataset that fetches the values for the parameter, add an additional record that indicates "no selection". You can use the UNION ALL for that:
select Field1 as ParamLabel, Field2 as ParamValue from YourTable UNION ALL select '(N/A)' as ParamLabel, 0 as ParamValue
The above assumes that the data type of your parameter is numeric and that value zero doesn't occur in your dataset, such as would be the case if you use a primary key ID of type int.
MCITP SQL Server 2008 (DEV); MCTS SQL Server 2008 (BI, DEV & DBA)
Check out my articles at BI: Beer Intelligence?
- Edited by Valentino Vranken Friday, January 25, 2013 10:43 AM
- Marked as answer by Rana_Hasan Monday, January 28, 2013 4:31 AM
Friday, January 25, 2013 10:40 AM -
Kumar,
The requirement is to disable a parameter totally based on the check box selection i don't think it is possible with SSRS. Cascading is different M I missing something here?
Regards,Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.
Friday, January 25, 2013 10:48 AM -
Depending on your requirement,
1. Create a cascading parameter b/w parameter 1 and parameter 2
2. Make parameter 2 to accept nulls
3. Pass a null value to parameter 2 if they select "Your required choice" in parameter 1
This will make the parameter 2 disabled if not hidden.
In reporting services ,
1. Runtime visibility change of parameter cannot be done
2. You can have radio button (Yes/No),single select,multiselect parameters . No combo box as of now.
Friday, January 25, 2013 11:02 AM -
Hi All,
Thanks a lot for your reply. Now I did that by another way. I changed the data type as 'boolean' for the parameter. Two radio buttons is come. But not able to disable the another parameter by the selection of the radio buttons.
thanks
Rana
Monday, January 28, 2013 4:30 AM -
Rana,
As i said earlier you won't be disable a parameter totally in SSRS you can use casacading and pass some default value but still it will be visible with that value.
Regards,Eshwar.
Please don't forget to Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful. It will helpful to other users.
- Marked as answer by Rana_Hasan Monday, January 28, 2013 4:52 AM
Monday, January 28, 2013 4:46 AM