Wednesday, March 28, 2012

Report parameter dropdown

Hello,

I need to create a MyPar parameter dropdown list, that is why I created a new dataset that gets data through a stored procedure. I also add @.MyPar into the query string of MyMainDataSet . I defined this parameter in Parameter screen for both available and default values.

When I run the report, I get the following error.

Query execution failed for data set MyMainDataSet.

Must declare the variable @.MyPar

What is problem?

Hello:

If I understand correctly:
The first stored procedure that displays the parameters for MyPar is a straight SQL Select Statement - So this SQL Select just gets the data for the available parameters to display in the dropdown list.
The next step the user selects one value from all of the available parameters in the dropdown list - so once this parameter is selected you need to pass this selected parameter to your next SQL Select statement so you only get the data based on the parameter the user selected!
Include the following in the Stored Procedure (if your are using one for the selection of data based on the parameter the user selected)
CREATE PROCEDURE "Whatever the Procedure name is"
@.MyPar nvarchar(10) or whatever length the parameter is

-- SETUP RUNTIME OPTIONS / DECLARE VARIABLES --
set nocount on

Hope this helps!
Best Regards - Joe

No comments:

Post a Comment