Specifying alternate values for display
Data in a data source can sometimes be cryptic or appear in abbreviated form. For example, gender values may be M or F rather than male or female. Credit rankings may be 1 to 5 rather than excellent, good, average, fair, or poor. Similarly, the values displayed by default for zero and null are 0 and an empty value. Your organization prefers to display zero as an empty value and null as “N/A”.
BIRT Report Designer supports the display of alternate values if you do not want to use the original values in a report. You use a data element’s map property to create rules for mapping data values. Create one map rule for each data value you want to replace. For example, to map M and F to Male and Female, respectively, create two map rules.
You can replace a data value with a literal text value. Alternatively, if the report will be viewed in multiple locales, replace a data value with a resource key. A resource key is a text string in an external source that is translated, or localized, into different languages. For information about resource keys and localization, see Localizing text.
How to map data values to different display values
1 Select the data element for which to replace values.
2 In Property Editor, choose the Map tab.
3 In Map List, choose Add to create a map rule.
4 In New Map Rule, specify the following information:
1 In the first field, specify the expression that refers to the data set field for which you want to replace values. You can select, from the drop‑down list, Value of this data item. The following is an example of an expression:
2 In the second field, select an operator from the list. For example:
Equal to
3 In the third field, specify the value to replace. For example:
You must enclose string values in quotation marks (" ").
4 Specify the value that you want to display, using one of the following options:
*Under “Then display following value:”, type the text to display. For example:
*Specify a resource key. Choose Browse to select a resource key. You can access resource keys only if you have assigned a resource file to the report.
Figure 8‑55 shows an example of a completed map rule, which replaces the value A with the value Excellent.
Figure 6-20 A map ruleFigure 6-20 A map rule
Figure 8‑55 A map rule
5 Choose OK. The rule that you created appears in Map List. When you select the rule, the display value appears in the box at the right, as shown in Figure 8‑56.
Figure 6-21 Map rule and its display value in Property EditorFigure 6-21 Map rule and its display value in Property Editor
Figure 8‑56 Map rule and its display value in Property Editor
6 Repeat steps 3 through 5 to create additional rules, one for each data value to replace. Figure 8‑57 shows an example of three map rules created for the selected data element.
Figure 6-22 Three map rules for an elementFigure 6-22 Three map rules for an element
Figure 8‑57 Three map rules for an element
5 Preview the report to check the results of the map rules.