Taking Advantage of Crystal Reports
Taking Advantage of Crystal Reports
.3 (ArcInfo, ArcEditor, or ArcView license) with Crystal Reports installed Sample data downloaded from ArcUser Online
2. 3. 4.
Items or Fields to Include Title: Young Adults in Central Region, Logo: trends.bmp, report date Column headings: Region, State, Total Population, Young Adult Population Fields: SUB_REGION, STATE_NAME, POP2000, AGE_18_29 Graphics: crystalmap.map Footer info: ESRI logo, copyright.txt
Hands On
5.
6. 7.
the data required for the report based on the headings in the previous step. Table 1 lists those fields under Details. This report does not use groups so skip sections GH1 and GF1. These were included so that the worksheet could be used for organizing other reports. Under RF, list crystalmap.bmp, the image of the project map that was exported from ArcGIS. Under PF, list ESRI logo and copyright text.
Generating a Rough Version of the Report With the reports data sources and format sketched out on the worksheet, the Crystal Reports wizard in ArcGIS can be used to quickly generate a simple report, which will be further enhanced using Crystal Reports. 1. In the main menu, choose Tools > Reports > Crystal Reports to start the ESRI Crystal Reports wizard. The wizard can be used to view an existing report or create a template in addition to generating a new report. Click the radio button next to Create a Report Using These Layers or Tables. The wizard
2. 3.
4.
pane displays the available map layers. Check the Central Region layer and click next. A personal geodatabase is created for the report. In the next panel consult the worksheet to identify the fields that will be used in the report. Select each field and use the > button to move the field to the Fields to Display box on the right side of the pane. Click Next after all fields listed under Details have been moved. This information wont be grouped, so click Next. Continued on page 54
calculations, and displays the data in the report format. If changes are made to the underlying data or formulas, the Preview should be refreshed so Crystal Reports will use an updated version of the data. On the Preview tab, two views are availablethe Standard Preview and the Group Tree View. The Standard Preview displays the data in the report. The Group Tree View supplies a high-level look at the report that is useful for navigating and visualizing large reports. Fields are the building blocks of a report. On the Design tab, the object frame for a field shows its location, the data type (i.e., XXX for text fields, $55,555 for currency fields), field width by number of characters displayed, and the size and font currently selected. Actual data from the selected data sources is displayed as formatted in the report when it is viewed on the Preview tab. Adding related database fields, such as first and last names, as text objects instead of separate fields ensures that formatting is consistent and eliminates white space between the fields by trimming the fields. Summary information associates information on the reports author, title, keywords, comments, subject, and any template used in the report. Subtotals, grand totals, and summaries are added as summary data that may relate to the entire report or just a grouping.
ArcUser JanuaryMarch 2004 53
Use the worksheet included in the sample dataset to plan out the report. This tutorial uses data in an ArcMap document to generate a report using Crystal Reports. 5. The next section allows records to be suppressed based on a filter applied to the data. A filter is an expression that applies a condition to the data in a field so specific records are selected in much the same way that features are selected by attribute in ArcMap. The records for all states in the region will be included so a filter is not needed. Click Next. In the next pane, type the report title from the RH section of the worksheet next to Title Report. Highlight Table for the report style and click Next. In the final pane, click the radio button next to Edit With Crystal Reports Designer and click Finish. This will save the report using the title typed in the last pane and start Crystal Reports so further refinements can be made to the report that cannot be done in the wizard. the report and displays it on the Preview tab. After noting the location of the fields, click on the Design tab. Right-click on the gray border for the RH section and choose Dont Suppress from the context menu. Right-click on the title and choose Format Field from the context menu. Click on the Font tab and change the color to gray. Click on the Border tab and under Line Style, change Bottom to single. Under Color, change Border to Gray. Click OK. Place the cursor over the title and drag it into the RH section and to the left so that it lines up with the frame on the left side of the first column. Choose Insert > Picture and navigate to the crystal folder to choose trends.bmp. Drag the image to the right of the report. Choose Insert > Text Object. A text box appears. Move it directly under the report title and click once. A text cursor appears in the text object. Type Report date: in the text box and click. Click outside the RH section to see the text displayed. Drag the Data Date object from the PH section to the RH section and position it next to the Report date: text object. Save the report.
2.
6.
7.
3.
Use the Crystal Reports wizard in ArcGIS to generate a rough version of a report that uses data from an ArcMap document. worksheet. Click outside the text box. Right-click on the heading again and choose Format Text. Click on the Font tab and change the font to Arial Black and the size to 12 points. Click on the Paragraph tab and change Horizontal Alignment to Centered. Click OK. Drag the bottom handle on the text box to make it larger. Click outside the text box. Repeat the process for the other three column headings. Drag the Total Population heading so it begins under the 4.5 inch mark on the ruler. Drag the Young Adults heading under the 6 inch mark. The Details fields will be adjusted to align with the headings next. Save the report.
2.
4.
Reviewing and Refining the Report Other items such as page headings, logos, and copyright text for the page footer will be added using Crystal Reports 9. The report is initially displayed in Design view, which indicates the type, approximate location, number of characters in each field, and the section in which each field is located. Before making adjustments, use the Preview tab to check the reports appearance. Report Header 1. Choose File > Print Preview from the menu. Crystal Reports accesses the actual data for
54 ArcUser JanuaryMarch 2004
3.
Page Header 1. Right-click on SUB_REGION in the PH section and choose Edit Text from the context menu. Select the existing text and type Region, the first heading on the
Details 1. Right-click on the first field in the Details section under the Region subheading.
www.esri.com
Hands On
The report is initially displayed in Design view, which indicates the type, approximate location, number of characters in each field, and the section in which each field is located.
Before making adjustments, use the Preview tab to check the reports appearance.
Right-click on text objects in the report to modify the text and format of titles and fields in the report.
Adjust the location and formatting of objects in the report. Add lines and background color to emphasize the figures for the Young Adult population. Continued on page 56
www.esri.com
Hands On
2.
3.
4.
Report Footer 1. Right-click on the gray border for the RF section and choose Dont Suppress from the context menu. Click on the Design tab and adjust the size of the report sections so that there is a little space between the Details section and the RF section and there is a vertical four-inch space in the RH section. 2. Choose Insert > Picture, navigate to the crystal folder, and choose crystalmap.bmp. Position it in the center of the RH section. Choose Insert > Text Object, and use the process described in the Report Header section to add the title Most Promising States. Change the font to Arial Black and the size to 14 points. Save the report. Page Footer 1. Choose Insert > Line and use the line drawing tool to make a line at the top of the Page Footer section. 2. Choose Insert > Picture and locate the corporateproductlogo.bmp. Use the frame handles to scale the image if necessary. 3. Choose Insert > Text Object and type in the text: Copyright ESRI, Inc. 2004 ArcUser
56 ArcUser JanuaryMarch 2004
Adjust the sections on the Design tab and redesign graphics as needed to produce a pleasing report. magazine. Format the text at 8 points and put ArcUser in italics. Additional Resources This tutorial supplies a basic understanding of how Crystal Reports works with ArcGIS. Explore the additional functionality furnished by this product by reading the user guide in PDF format that is included on the installation CDROM. Using the Design tab to examine the sample reports that ship with Crystal Reports will suggest more ways to use the tools in Crystal Reports. These samples are located in the programs installation directory. Several scripts and samples are also available from the ArcScripts Web site (www.esri.com/scripts), including MyReports, a tool that lets the user launch custom reports from ArcGIS.
www.esri.com