Tutorial 4-4. Creating Multi-Value Parameters
The benefit to setting parameter options is that they give the user a more robust user interface for selecting parameter values. Let’s modify the report we created in the previous tutorial so that rather than just selecting a single Customer to print, the user can select multiple customers.
- Open the report Basic Parameter Tutorial.rpt from Tutorial 4-3. Save it as Multi-Value Parameter Tutorial.rpt.
- Look in the Parameter Fields list and find the Selected Country parameter. Right-click on it and select Edit.
- For the optional properties, set the Allow Multiple Values option to True. This lets the user select the customers they want to print by either adding or creating a list of valid customers.
- Click the OK button to save your changes. This immediately opens the Enter Values dialog box so that you can enter a new value for the parameter.
- Refresh the report multiple times and select a different number of customers each time. They will all appear on the report.
Notice that even though we changed the parameter to be multi-value, the selection formula stayed the same. When Crystal Reports compares a single field to an array of values, you can still use the = operator to do the comparison. Crystal Reports automatically scans through the array looking for a value that matches. This is discussed more in the next section.