Crystal Reports 10: The Complete Reference
To insert a map on your report, choose Insert Map from the pull-down menus , or click the Insert Map button on the Insert Tools toolbar. The Map Expert appears, containing three main tabs: Data, Type, and Text.
The Data Tab
The Data tab is where you choose the type of map you want to create, as well as the fields and summaries from the report that you want to base your map on.
Group Maps
To create a group map, click the Group button on the Data tab.
The Place Map drop-down list lets you choose how often you want the map to appear on the report. The options in this list will vary according to how many groups you have on your report. If you only have one group on your report, the only option available in the drop-down list is Once Per Report. If you have more than one group, you also have For Each Group Field options for every group, except for the bottom-level group, because you must always place a map at least one level higher in your report than the group your map is based on.
For example, if you only have a state group on your report, the only option for a group map is Once per Report, because you must have the map at a level higher than the group. However, if you have a country group, and a region group within the country group, the drop-down list allows you to choose Once per Report or For Each Customer.Country. If you choose this lower country level, you ll have a map appearing in every country group, showing the geographic breakdown by region for that country.
You can then choose whether to have Crystal Reports initially place the map in the group or report header or footer, by clicking the desired radio button. After the map has been created initially, you can drag the map object from the header to the footer, or vice versa.
Use the On Change Of drop-down list to choose the geographic group that you want the map to be based on. Continuing with the preceding example, if you choose once per report, then the options are on change of Customer.Country or on change of Customer.Country and Customer.Region. However, if you choose to place the map per country, then the only option in the On Change Of list is Customer.Region.
From the Show drop-down list, choose the summary or subtotal field you want the map to depict.
Tip | Because Group Maps must be based on a summary or subtotal field in a group, any groups that don t have at least one subtotal or summary field won t show up in the Map Expert. If you only have one group on your report and it doesn t contain a subtotal or summary field, the Group button in the Map Expert will be dimmed. |
Advanced Maps
To create an advanced map, click the Advanced button on the Data tab.
The Place Map drop-down list lets you choose how often you want the map to appear on the report. The options in this list will vary according to how many groups (if any) you have on your report. If there are no groups, the only option available in the drop-down list is Once per Report. If you have one or more groups, you also have For Each Group Field options for every group.
You can then choose whether to have Crystal Reports initially place the map in the group or report header or footer, by clicking the desired radio button. You are also free to drag the map object from the header to the footer, or vice versa, after the map has been created.
The Available Fields list contains all the report, database, and formula fields available for the map. Choose the geographic field that you want your map to use, and then click the right arrow next to the Geographic Field box to choose the field. The same field will also automatically be placed in the On Change Of box. If you wish to just summarize values for the geographic field (for a range or dot density map, for example), simply leave the same field in the two boxes. If, however, you wish to show a pie or bar chart on the map for another field (for example, to show a pie chart in each country comparing states), then choose the field you want to compare in the Available Fields list and click the right arrow next to the On Change Of text box. Finally, click one or more fields (using CTRL-click or SHIFT-click) in the Available Fields list that you want summarized in the map. Use the right arrow next to the Map Values box to add them. If you wish to remove a Map Value field or fields, click it in the Map Values box and click the left arrow. If you wish to remove all the Map Value fields, click the double left arrow.
Even though this is an advanced map (based on individual report records), Crystal Reports still summarizes values by default, as though report groups exist for the fields you ve placed in the Geographic Field and On Change Of boxes. You can choose the summary function (Sum, Average, Count, and so on) you want the map to use when summarizing the detail fields you ve added to the Map Values box. Select a field in the box, click the Set Summary Operation button, and choose the function (Sum, Average, Count, and so on) that you wish to use.
Crystal Reports mapping can sometimes be particular about the geographic field you base your map on. For example, if the field contains USA, the map will recognize it. If it just contains US, the map won t recognize it. The same holds true for state names. Two-letter abbreviations and completely spelled state names are recognized, whereas inconsistently abbreviated state names or standard two-letter state names followed by periods may not be recognized. Sometimes you ll need to experiment, and in some cases you may want to create a formula (discussed in Chapter 5) that changes the way the geographic data is presented, and then base the map on the formula field. Also, Crystal Reports provides the ability to resolve data mismatches that exist between the geographic names that maps recognize and the actual data in the database (see Resolving Data Mismatches later in the chapter).
Tip | If you add a nonnumeric field to the Map Values box, it is automatically summarized with a count function. The only other choice in the Change Summary Operation list is DistinctCount. |
Cross-Tab Maps
To create a cross-tab map, click the Cross-Tab button on the Data tab (this button will be grayed out unless you have a cross-tab object in your report).
The Place Map drop-down list will be dimmed, because you must place the map on the same level as the cross-tab (in the same group, once per report, and so forth). You can choose whether to have Crystal Reports initially place the map in the group or report header or footer, by clicking the desired radio button. You can also drag the map object from the header to the footer, or vice versa, after the map has been created.
In the Geographic Field drop-down list, choose the row or column of the cross-tab that contains the geographic field the map will be based on. If you want the cross-tab to be mapped as a pie or bar chart map, choose the other row or column in the Subdivided By drop-down list. In the Map On drop-down list, choose the summary field from the cross-tab that you want depicted. If you have multiple summary fields, you ll have multiple options here.
OLAP Maps
To create an OLAP map, click the OLAP button on the Data tab.
The Place Map drop-down list will be dimmed, because you must place the map on the same level as the OLAP grid (in the same group, once per report, and so forth). You can choose whether to have Crystal Reports initially place the map in the group or report header or footer, by clicking the desired radio button. You can also drag the map object from the header to the footer, or vice versa, after the map has been created.
In the On Change Of drop-down list, choose the dimension of the OLAP grid that contains the geographic field the map will be based on (this may be a lower-level dimension; go back and look at the results of your OLAP grid if you re unsure where the geographic data is). If you want the OLAP grid to be mapped as a pie or bar chart map, choose another dimension in the Subdivided By drop-down list.
Note | Cross-tab and OLAP maps aren t available if you don t already have a cross-tab or OLAP grid on the report before you launch the Map Expert. The Cross-Tab and OLAP buttons will be dimmed in the Map Expert in these cases. |
The Type Tab
After you ve chosen the data elements for your map, click the Type tab to choose the type of map you want to display. Click one of the following buttons to select a map type:
-
Ranged Presents options for a ranged map, including how many intervals the map will contain, how the intervals are broken down, the beginning and ending color for the intervals, and whether the map should show empty intervals.
-
Dot Density Enables you to choose large or small dots for the map.
-
Graduated Presents the symbol used for the graduated map. A circle symbol is chosen by default, but you can click the Customize button to change the symbol and color and add special effects to the symbol, such as a halo or drop shadow.
-
Pie Chart Presents options for a pie chart map. You can choose small, medium, or large pies. If you click the Proportional Sizing check box, the pies will be sized according to the quantities contained in the data being mapped: larger quantities create larger pies, and smaller quantities create smaller pies.
-
Bar Chart Enables you to choose the size of the bars: large, medium, or small.
Tip You are restricted to either the first three or the second two buttons, depending on how many data elements you ve chosen for your map. If you chose only one data element to map, you can use only the Ranged, Dot Density, or Graduated option. If your map contains multiple elements from a detail report, or you chose a Subdivided By item with a cross-tab object or OLAP grid, you can use only the Pie Chart or Bar Chart option.
The Text Tab
The Text tab lets you customize textual elements, such as the title and legend, which appear with the map. In the Map Title box, type the title you wish the map to display. Crystal Reports automatically creates a legend for the map. You can choose whether to display a full legend, a compact legend, or no legend at all by clicking the appropriate radio button. If you choose to include a legend, you can display the map-generated legend or specify your own by using the radio buttons and text boxes in the Legend Title section.
After you choose all the necessary options, click OK. Crystal Reports creates the map and places it in the report or group header or footer that you specified. To modify an existing map, simply click the map to select it in either the Design or Preview tab. Then, choose Format Map Expert from the pull-down menus or right-click the map and choose Map Expert from the pop-up menu.