SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Display Custom values instead of actual Parameter values


Display Custom values instead of actual Parameter values

Author
Message
npatel 17252
npatel 17252
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 65
I have an inventory report that I am creating I would like to add a Parameter that is a drop down of the 3 transaction Types, which are Inventory Adjustment, Variance and Inventory Transfer. But I only know how to make the Parameter show the Values 1, 2, 3. I want it show what the actual name is to the user (Inventory Adjustment, Variance and Inventory Transfer). I'm not sure what I need to do it make it display the name however use the values 1,2,3 for the actual parameter.
pietlinden
pietlinden
SSCarpal Tunnel
SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)SSCarpal Tunnel (4.8K reputation)

Group: General Forum Members
Points: 4849 Visits: 13165
If you make the parameter get its values from a dataset, it's pretty easy.

Right-click the parameter you want to show as a value list, go to Parameter Properties.
Select "Get values from query" (You'll need to create a dataset to populate this...)
It should include the Numeric value in one column, and then the associated text value. Something like:

SELECT GroupID, GoupName
FROM SomeTable
ORDER BY GroupName


Specify your "value" field to be the number you want to match on (filter your dataset with) - in this example, that would be "GroupID"
Specifiy the Label to be the text field that means something (in this case "GroupName", because the GroupID's don't really mean anything to people).

Then you should be off to the races.
geoff5
geoff5
SSC Veteran
SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)

Group: General Forum Members
Points: 246 Visits: 543
With only three items in the list, manually defining the values would seem the easiest way to go. All you have to do is put the numeric data for the "value" part of the parameter option and the plain text descriptions as the "label" part of the parameter option. The user sees the "label," but the report will use the "value." That is the whole reason each manual entry has two places for data for each option you manually define.
geoff5
geoff5
SSC Veteran
SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)

Group: General Forum Members
Points: 246 Visits: 543
It just struck me that maybe when you say "display," you are not referring to the parameter drop-down but to the final rendered report output. If that is the case, what you need is a way to reference the parameter label in an expression instead of the parameter value, and there is an easy way to do it.

In a placeholder expression, this gets the underlying value (of course):
Parameters!parameter_name.Value


And this gets the label displayed to the user:
Parameters!parameter_name.Label



Hope this helps!

Geoff
gissah
gissah
SSC-Enthusiastic
SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)

Group: General Forum Members
Points: 122 Visits: 329
I am having the same issue here.
my parameter list is from a dataset and I do have 'Allow multiple values' selected.
I do have the parameter filtered by the dataset field. my does not rendered when multiple values are selected.
I get a blank report.
npatel 17252
npatel 17252
SSC Rookie
SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)SSC Rookie (27 reputation)

Group: General Forum Members
Points: 27 Visits: 65
http://arcanecode.com/2010/07/13/adding-query-parameters-to-sql-server-2008-reporting-services-reports/

This helped me alot, and creating a Dataset with the custom values I wanted I.E. 1, 2, 3 and Adjustment/Transfer/Variance
geoff5
geoff5
SSC Veteran
SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)

Group: General Forum Members
Points: 246 Visits: 543
For a multi-select parameter, you have to deal with the values as an array and use the JOIN function to extract the values into a delimited string, like this:

=Join(Parameters!parameter_name.Label, ",")



When you double-click to add a multi-select parameter to any expression, the expression editor will automatically add a (0) at the end. This is an explicit reference to the very first value in the array. Just delete the (0) to reference the entire array of values.

The code above creates a comma-delimited list. If you want a vertical list of selected values, use the vbCRLF constant as the delimiter instead.
gissah
gissah
SSC-Enthusiastic
SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)SSC-Enthusiastic (122 reputation)

Group: General Forum Members
Points: 122 Visits: 329
Thank you all I will try this tomorrow. I was getting ride of the (0), but I guess it should be (3)
for open/completed/closed.
geoff5
geoff5
SSC Veteran
SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)SSC Veteran (246 reputation)

Group: General Forum Members
Points: 246 Visits: 543
To gissah:

If you put Parameters!parameter_name.Label(3), you will be referencing only the fourth selected value of a set of values. I do not think this is your intention.

If I understand your parameter configuration, you have a multi-select parameter with three options: Open, Completed, Closed (these are the labels, with corresponding values of 1, 2, and 3). A user can select one, two, or all three of these options. Let's suppose the parameter is called "Status," and user selects all three options. Consider the following expressions and the strings they return:

= Parameters!Status.Value(0) returns the value of 1
= Parameters!Status.Label(0) returns the value of Open
= Parameters!Status.Value(1) returns the value of 2
= Parameters!Status.Label(1) returns the value of Completed
= Parameters!Status.Value(2) returns the value of 3
= Parameters!Status.Label(2) returns the value of Closed
= Join(Parameters!Status.Value, ",") returns the value of 1,2,3
= Join(Parameters!Status.Label, ",") returns the value of Open,Completed,Closed

So if you want all three listed somewhere on the report, use the last example expression above.

Further, if you have only three options then Parameters!Status.Label(3) will return an error because the array is zero-based, meaning that the three items in the array are indexed with numbers 0 through 2, not 1 through 3. Further, the array only contains the values actually selected by the user, so if the user selected only one of the three items, the index number (0) would be the only one valid; index values of (1) and (2) would return errors. It doesn't matter which one the user selected. If he selected only "Closed," then Parameters!Status.Label(0) would equal "Closed."
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search