Sunday, February 19, 2012

default value for a parameter to select all

Hello,

I'm using SQLServer 2005 and I build a report in the visual studio.

I need a way to set as default value for a multi-value parameter

its option of 'Select All'.

Thanks, Talia.

Sorry, you cannot pre-select the actual "Select All" entry because it is a client only UI representation item.

The closest you can get is to define the same dataset field as valid value and default value. Then all valid values should be pre-selected.

-- Robert

|||

Thanks.

If somebody has another idea - I'll be happy to hear...

talia.

|||

Well, you could implement your own frontend application that handles the parameter visualization and selection and then use e.g. the new VS 2005 ReportViewer controls (www.gotreportviewer.com) to execute and display the report.

-- Robert

|||

Hey, I think I found the way:

In the Default Values of the parameter, we must choose:

From Query

then, choose the same dataSet and the same ValueField of those

of the parameter - and it select all!

Talia.

|||

Talia,

I'm not sure I understand completely, but I'll offer a workaround and hope that it helps.

It sounds like you have a multi-select parameter with values that do *not* come from a database table. Since the "out of the box" method of defaulting a multi-select parameter to "<Select All>" is to set the default parameter source to a dataset, and you don't have a dataset, you're seeking another solution.

The workaround uses a table variable that you create and populate as part of a dataset definition. You set the Default Values of the multi-select parameter (and the values list as well, if you wish) to that table. Here's how you would do this for a parameter named "StatusCriterion":

Define a dataset named "ValidStatuses" as follows:

-- begin dataset definition

DECLARE @.tblValidStatuses TABLE(
Status VARCHAR(20)
)

INSERT @.tblValidStatuses VALUES('Future Low')
INSERT @.tblValidStatuses VALUES('Future Medium')
INSERT @.tblValidStatuses VALUES('Future High')
INSERT @.tblValidStatuses VALUES('Future Critical')
INSERT @.tblValidStatuses VALUES('Working Medium')
INSERT @.tblValidStatuses VALUES('Working High')
INSERT @.tblValidStatuses VALUES('Working Critical')

SELECT * FROM @.tblValidStatuses

-- end of dataset definition

Then in the Default Values section of the parameter dialogue (bottom of the dialogue) select the "From Query" radio button and choose "ValidStatuses" for the Dataset and "Status" for the Field.

I hope this helps.

-NFox

|||

In SP1, microsoft ruined the select all functionality. I do not know why but they did. I would not invest any time into doing this if you are going to have to redo it all after applying SP1. It is the worst software change I have ever seen.

I digress. Since, you will have to manually create the ALL section. You can just set your default to ="All" or something like that.

|||

In a report based on a Cube (Analysis Services 2005), Is it possible set "All" as default value for a parameter based on dimension

Thank you very much,

Viky V

No comments:

Post a Comment