Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Display Custom values instead of actual Parameter values Expand / Collapse
Author
Message
Posted Tuesday, July 29, 2014 5:28 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Yesterday @ 5:12 PM
Points: 21, Visits: 56
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.
Post #1597528
Posted Tuesday, July 29, 2014 6:20 PM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Yesterday @ 11:26 PM
Points: 925, Visits: 5,882
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.
Post #1597537
Posted Tuesday, July 29, 2014 8:56 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 21, 2014 7:49 PM
Points: 171, Visits: 501
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.
Post #1597559
Posted Thursday, July 31, 2014 6:56 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 21, 2014 7:49 PM
Points: 171, Visits: 501
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
Post #1598234
Posted Wednesday, August 6, 2014 9:34 AM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, November 20, 2014 7:15 AM
Points: 56, Visits: 240
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.
Post #1600294
Posted Wednesday, August 6, 2014 9:42 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Yesterday @ 5:12 PM
Points: 21, Visits: 56
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
Post #1600301
Posted Wednesday, August 6, 2014 9:50 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 21, 2014 7:49 PM
Points: 171, Visits: 501
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.
Post #1600307
Posted Wednesday, August 6, 2014 8:11 PM
Valued Member

Valued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued MemberValued Member

Group: General Forum Members
Last Login: Thursday, November 20, 2014 7:15 AM
Points: 56, Visits: 240
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.
Post #1600448
Posted Wednesday, August 6, 2014 8:41 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, August 21, 2014 7:49 PM
Points: 171, Visits: 501
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."
Post #1600451
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse