0
votes

I have a Crystal Report I made with Crystal Reports 2008 that has a parameter value that allows multiple selections from a static list.

Does anyone know how I can display on the report the chosen values from that parameter list?

The list is "Number" type and each entry has a corresponding description. I'd like to display the descriptions (there is only 4 so if I need to put in a switch or an if statement, I won't be upset).

1

1 Answers

0
votes

A multi-select parameter is an array when you get right down to it. The code below was tested in Crystal XI, basically it loops through each value in the parameter array and does a select/case statement to get the value. As far as I know, you can't use the description in the code, only on screen during the parameter selection.

I put a newline carriage return between each description (+ chr(13) + chr(10)), you may want to treat them differently.

Local NumberVar i;
Local StringVar output := "";
Local StringVar paramDesc; //the current parameter's description

for i := 1 to UBound({?MyParameter}) do (
    paramDesc := "";
    select {?MyParameter}[i]
        case 1 : paramDesc := "Option 1" + chr(13) + chr(10)
        case 2 : paramDesc := "Option 2" + chr(13) + chr(10)
        case 3 : paramDesc := "Option 3" + chr(13) + chr(10)
        case 4 : paramDesc := "Option 4" + chr(13) + chr(10)
        default: paramDesc := "";
    output := output + paramDesc;
);

output