Now that you have completed the task of implementing a parameter field within a report, you learn how a parameter field can also be used to filter the data retrieved by a report. Parameter values that business users enter can be used within record selection formulas to determine what data is retrieved from the database. In the following exercises, use the same World Sales Report to implement the Countries parameter field (created earlier in the chapter) to filter the report results by including the parameter field within a record selection definition (using the Select Expert dialog). In this case, you enable the business user of the report to select one or more country values to be included in the record selection, thus filtering the report results to include only the desired data. The following steps demonstrate how a single report can be segmented many different ways:
Figure 5.10. Business users can now select one or more countries to be included in the report results.Figure 5.11. Based on the selected parameter field values, the report results display only the desired data.Tip As Figure 5.11 highlights, when adding a multivalue parameter (Countries in this case) to a report for display, only the first value is displayed. This is because the multiple values of the parameter are stored in an array and the Parameter field only shows the first element of the array by default. To show different values, you can create a formula with the parameter and an index (for instance, {?Countries}[2] to show the second country in the list). To show all the values, you could create a formula like this: Local StringVar CountryString := ""; Local NumberVar i; For i := 1 To Ubound({?Countries}) Do ( CountryString := CountryString + ", " + {?Countries}[i] ); CountryString |