Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
81
Добавлен:
11.05.2015
Размер:
2.11 Mб
Скачать

Seagate Crystal Report Engine Automation Server

This topic is only supported by the Professional Edition of Seagate Crystal Reports.

The Seagate Crystal Report Engine Automation Server allows you to build powerful active web sites with any web server that supports ActiveX and Active Server Pages. This section demonstrates how to bring the full power of the Report Engine Automation Server to your Microsoft Internet Information Server (IIS) web sites.

Although the Seagate Crystal Web Reports Server provides many features for viewing reports from a web browser, the ability to format and select data is limited to a few simple commands. The Seagate Crystal Report Engine Automation Server, on the other hand, gives you all the power of the Seagate Crystal Report Engine.

For adding the Report Engine Automation Server to a web site, Seagate Crystal Reports provides the Visual InterDev Design-time ActiveX Control for use with Microsoft Visual InterDev. In this chapter, you will learn how to use the Visual InterDev Design-time ActiveX Control to automatically set up VBScript code in your Active Server Pages that uses the Report Engine Automation Server and the Active Data Driver.

NOTE: For additional information on the objects, methods, and properties provided by the Seagate Crystal Report Engine Automation Serve, Please see Crystal Report Engine Object Model for the Automation Server, Volume 3, Chapter 6.

Visual InterDev Design-time ActiveX Control

When you install Seagate Crystal Reports, if you select the Custom installation option and choose to install the Development tools, the Crystal Report Engine Automation Server and the Visual InterDev Design-time ActiveX Control will be installed and registered on your system. However, to successfully use these tools with a web site, you must also install them on your web server system.

When used from within Active Server Pages, the Crystal Report Engine Automation Server dynamically produces reports that are displayed in a web browser by using one of the Crystal Smart Viewers (see Configuring the Crystal Smart Viewers, Page 49). Using the powerful server-side scripting capabilities of Active Server Pages, you can design useful web-based interfaces and query tools for accessing reports over an intranet or extranet.

The Visual InterDev Design-time ActiveX Control has been designed specifically for Microsoft Visual InterDev. With the Design-time ActiveX Control, you can quickly and easily add server-side VBScript code to your Active Server Pages. The design-time control lets you select an existing report, or build a dynamic report at runtime that accesses data from an ActiveX data source, such as ActiveX Data Objects (ADO).

This chapter takes you through the steps of building a basic web site inside Visual InterDev using the Designtime ActiveX control, the Report Engine Automation Server, and ADO. Use the examples in this chapter as a basis for building your own web sites. Most of the steps illustrated will work in either version 1.0 or 6.0 of Visual InterDev. Differences between the two versions, though, will be indicated with notes.

Building Active Web Sites

44

The following topics are discussed in this section.

Using an Existing Report, Page 45

Building a Report at Runtime, Page 46

Using an Existing Report

This section demonstrates how to add code to your Active Server Pages with the Visual InterDev Design-time ActiveX Control, in order to display an existing report in the Crystal Smart Viewer for ActiveX.

Use the following steps when working in version 1.0 of Visual InterDev:

1With a web project open in Visual InterDev, add a new Active Server Page. For more information on opening web projects and adding ASP pages, refer to the Visual InterDev documentation. For this example, the web project will be named MySite and the new ASP page will be named ReportPage.asp.

2Choose the ACTIVEX CONTROL command from the Insert|Into HTML menu. The Insert ActiveX Control dialog box appears.

3Click the Design-Time Tab to display design-time ActiveX controls that are registered on your system.

4Highlight the CrystalReport.DTC design-time control, and click OK.

5Close the Properties dialog box if it appears. The Visual InterDev Design-time ActiveX Control appears in the Microsoft Developer Studio window.

6Toggle the Use Existing Report check box on, if it is not on already. This disables most of the controls in the design-time control. If you have not added a data connection to your web project, this check box will automatically be toggled on and disabled.

7Click Browse to select the report you want displayed in your web site. The Select Report Name dialog box appears.

8Use this dialog box to locate and select the desired report. Enter a standard DOS path to the report. Do not use a URL address or a UNC path. Click Open when finished. The selected report appears in the Report Name text box of the design-time control.

9From the Viewer drop-down list, select the Crystal Smart Viewer you want to use to display the report.

10 When finished, close the window that contains the Visual InterDev Design-time ActiveX Control.

Once you close the design-time control, the ReportServer Active Server Page (RPTSERVER.ASP) is added to your project, along with the report file you selected in the design-time control. The ReportServer Active Server Page contains the VBScript code that communicates with the Crystal Report Engine Automation Server. This page is required by any web project that uses the Crystal Report Engine Automation Server to display reports.

In addition, the design-time control adds several lines of VBScript code to your web page. This code is designed to work with the ReportServer Active Server Page and the Crystal Report Engine Automation Server to display the report selected inside the specified Crystal Smart Viewer. For information on how to edit this code, see Editing Active Server Pages, Page 47.

To test your new Active Server Page, save the file to your web server, select the page in your Project Workspace window, and choose the PREVIEW IN BROWSER command from the File menu. Visual InterDev will open your web browser and display the Active Server Page that contains the instructions to open the report.

Building Active Web Sites

45

Building a Report at Runtime

The Visual InterDev Design-time ActiveX Control can build a report dynamically at runtime based on an ActiveX data source such as ActiveX Data Objects. The design-time control uses the Crystal Active Data Driver to dynamically design a generic report based on tables and fields you select from a data source connected to your project. To use the dynamic reporting features of the design-time control, first add a data source to your web project.

1With a project open in Visual InterDev, choose the DATA CONNECTION command from the Project|Add To Project menu. The Select Data Source dialog box appears.

2To select an ODBC data source, click the Machine Data Source Tab.

3Select a data source from the Data Source Name list, and click OK, or click NEW to create a new data source. Once you click OK in the Select Data Source dialog box, the data source will be added to your project.

4Save your project.

NOTE: You may be required to specify logon information when you select a data source. For complete information on adding data sources to a web project, refer to your Visual InterDev documentation.

Now that your project contains a data source, the Visual InterDev Design-time ActiveX Control can be used to create an Active Server Page that dynamically creates and displays a report based on this data source.

1Choose the NEW command from the File menu. The New dialog box appears.

2On the Files Tab of the New dialog box, select Active Server Page.

3Enter a name for the new Active Server Page in the File name text box, and click OK. The new Active Server Page is created and appears in the Microsoft Developer Studio.

4Make sure the comment <!-- Insert HTML here --> is highlighted, and choose the ACTIVEX CONTROL command from the Insert|Into HTML menu. The Insert ActiveX Control dialog box appears.

5Click the Design-Time Tab to display the design-time ActiveX controls that are registered on your system.

6Highlight the CrystalReport.DTC design-time control, and click OK.

7Close the Properties dialog box if it appears. The Visual InterDev Design-time ActiveX Control appears in the Microsoft Developer Studio window.

8Toggle the Use existing report check box off, if it is not off already.

9In the Data Connection drop-down list, select the database corresponding to the data source you added to your project.

10In the Record Source drop-down list, select a database table from the database.

11In the Columns list box, toggle the check box on for any field you want as a column in your report.

Building Active Web Sites

46

Соседние файлы в папке crystal