ArcUser Online

Search ArcUser





























ArcView GIS Version 3.1 includes a Report Writer extension that allows you to access Seagate Crystal Reports for Esri from an ArcView Table, View, or Project. This article describes how to launch a template report using the Report Writer Wizard, add a map to a report either manually or as an OLE object, launch a template report from a button in ArcView GIS, and create and launch a report executable file from a button inside ArcView GIS.

You should have the full installation of Crystal Reports on your machine to take advantage of the Report Writer extension. Be sure to load this extension by choosing File, then Extensions, and then checking the box next to Report Writer. This extension streamlines the process of selecting and preparing data for reports. Inside ArcView GIS, a Report Wizard allows you to choose the type of report you want before launching the Seagate Crystal Reports application. You can access the Report Wizard by choosing Theme then Create a Report from the View menu or by choosing Table then Create a Report from the Table menu.

Once inside Crystal Reports, your data will already be loaded and a Report Expert will guide you through the report design process. If you have never designed a report using Crystal Reports, go to the ArcUser Online Jump Station for a link to a tutorial that will help you get started.

Using Report Templates

One of the nice features of Seagate Crystal Reports for Esri is the ability to design a report and then use that report as a template for future reports. If you need to create the same report over and over and only need to change the data each time, using a report template is an ideal solution.

Once you have designed a report template, you can access the template from ArcView GIS through the Report Wizard. From the Report Wizard, select Create a Report Based on Another Template. Select the report you want to use as a template. A new report based on the data in the current project will automatically be generated once Crystal Reports is launched.

Adding a Map to Your Report

You may want to include a map in a report you are generating with Crystal Reports. In ArcView GIS, export the view you want to include in the report as a Windows bitmap (.BMP) file by choosing File then Export from the menu. Give the bitmap file a name such as MyMap.bmp. Next, switch to Crystal Reports to manually insert the map into the report as a picture by choosing Insert and then Picture from the menu.

With this method, if your map changes, you must delete the original map and insert the updated new map into the report manually. To automatically update a map in a report, you can add the map image as an OLE object in Crystal Reports.

Follow these steps to add a map as an OLE object.

  1. Export the desired view from ArcView GIS as bitmap.

  2. Now switch to the Crystal Reports designer. You will probably want to place the map in the Report Header since anything placed in the Report Header is printed only once per report. Click on the Design, tab which is located in the upper left-hand corner of the screen. Different sections of the report are listed in the gray area under the Design tab.

  3. If you do not see the Report Header listed, open the Section Expert dialog box by choosing Insert and then Section from the menu or by clicking on the Section Expert button. With Report Header highlighted, uncheck the Suppress (No Drill-down) box. The Report Header area of the report should now be visible.

  4. To add the map as an OLE object to the Report Header, select Insert then OLE Object from the menu. An Insert Object dialog box will appear. Select Create from File and navigate to MyMap.bmp. You can also type in the file name. Before closing the dialog box, check the Link box. This step is very important. If you forget to check this box, changes to the image will not automatically be updated in the report.

Place the image in the Report Header area. Now, when you export MyMap.bmp, the report will automatically be updated the next time it is opened.

Create a Report from a Template Without Report Wizard

Now that you have created a template and added a map, you may want to automate report generation even more by launching a template report from a button on the view or table GUI rather than from the Report Wizard. This can be done by creating a button and attaching an Avenue script to it. For information on adding a new button to a GUI document refer to Chapter 12, "Working With the Document User Interface," in Using Avenue, one of the manuals that came with ArcView GIS.

In sample Script 1, a template report was first designed and saved as TemplateReport.rpt. The new output file created will be MyReport.rpt. Note that the database file, TemplateReport.dbf, has the same name as the template report.

Creating a Report Executable (EXE) File

What happens if you want other ArcView GIS Version 3.1 users to access your report without actually launching the Crystal Reports for Esri? You can create a Crystal Report executable file that is a read-only version of your template report.

First, follow the special instructions below when designing your report in the Crystal Reports for Esri Designer.

  1. In ArcView GIS, select a subset of your current data set before launching Crystal Reports. You can either select a few items on your map or select several records in the database file. Using a subset creates a new database file with the same name as the report. This will be important later on when you create the executable file.

  2. Access the Report Wizard from the View or Table menu. Choose Selected Set as the data option.

  3. Once Crystal Reports has launched, design your report.

  4. When you are done designing your report, toggle off the option to save data with the report. The menu item File|Save Data with Report should NOT have a check by it.

  5. In Crystal Reports, set the location of the database file by selecting Database then Set Location from the menu. This will open the Set Location dialog box. In the dialog box, click on the Same as Report button. This will remove any path names currently associated with the database file. With the database file and the report in the same directory, it will be much easier to run the executable file on different machines. When you are finished, click the Done button.

    Now you are ready to create the executable file.

    1. From the Report menu, select Report then Compile Report. The Compile Report dialog box will open.

    2. You will see two settings that have a default choice of Yes. The first setting determines whether you want to create a program item for the report in the program. If you do not want the report to be added to Crystal Reports for Esri group in the Start menu, select No.

    3. The second setting is to distribute the report. Select Yes if you are planning to distribute the report to users who do not have Crystal Reports on their computer. This option creates a run-time, read-only version of Crystal Reports. If you are distributing reports to users who have Crystal Reports, you can select No.

    4. Click on OK to create the executable file.

    After you have created the executable file, you can launch it from a button or menu item in a view or table document using the Avenue code contained in Script 2 both GUI document types

    If you are including a map image in an executable file, set your view size to approximately two inches by two inches (5 cm by 5 cm) before you export the map image as a bitmap from ArcView GIS. This is a good practice because while Crystal Reports executable will automatically adjust to accommodate a larger map image, it will not resize to a smaller image. Replacing a large image with a small one will result in large areas of white space. When adding the map in Crystal Reports designer, place the map image at the left margin of the page. This is done so that portions of larger images will not be cut off.

    Visit the ArcUser Online Jumpstation page for links to download the sample scripts shown in Figures 1 and 2 and other useful scripts available from the ArcScripts page.

Contact Us | Privacy | Legal | Site Map