Display Custom values instead of actual Parameter values

  • 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.

  • 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.

  • 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.

  • 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

  • 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.

  • 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

  • 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.

  • 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.

  • 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."

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply