Building Reports with the Visual Basic Report Designer

The Visual Basic report designer enables developers to create and edit reports from within the comfort of the Visual Basic environment. Figure 30.1 shows the report designer active inside Visual Basic.

Figure 30.1. Here a report is shown being editing in the Visual Basic report designer.

graphics/30fig01.jpg


To add a new report to a project, select Add Crystal Reports 10 from the Project menu inside Visual Basic.

NOTE

If Add Crystal Reports 10 is not showing on the Project menu, go to the Project, Components menu, and on the Dialog tab, make sure Crystal Reports 10 has a check beside it. If you turn this on, it permanently appears on the Project menu.


From the dialog that opens, select Using the Report Wizard or As a Blank Report to create a new report from scratch. The From an Existing Report option provides you with the capability to import any existing Crystal Report file (.rpt) and use the Visual Basic report designer to make further modifications, a great way to leverage any existing work an organization has put into Crystal Reports. A report that is added to a Visual Basic project is saved as a .dsr file, which is a container for the actual .rpt file along with some other information. At any point, you can click the Save to Crystal Report File button on the designers toolbar and save the report out to a standard RPT file, so in effect reports can easily go both ways: in and out of Visual Basic. Because the Visual Basic report designer is based primarily on the same code-base as the standalone Crystal Reports designer, the RPT file format is the same. You can also import existing reports from past versions into the Visual Basic report designer.

The Visual Basic report designer supports almost all the features of the Crystal Reports designer and can be used to create everything from simple tabular reports to highly formatted, professional reports. However, even though the capabilities of these two editions are similar, there are some differences in the way the designer works. This is not meant to be inconsistent, but rather to adapt some of the Crystal Reports tasks to tasks with which Visual Basic developers are familiar. Ideally, the experience of designing a report with the Visual Basic report designer should be like designing a Visual Basic form. The following sections cover these differences.

Understanding the User Interface Conventions

Several user interface components work differently in the Visual Basic report designer. One of the first things you might notice is that the section names are shown above each section on a section band as opposed to being on the left side of the window. However, the same options are available when right-clicking on the section band. This tends to be more convenient anyway.

The Field Explorer resides to the left of the report page. Although it cannot be docked, it can be shown or hidden by clicking the Toggle Field View button on the designer toolbar. Other Explorer windows found in the standalone designer such as the Report Explorer and Repository Explorer are not available in the Visual Basic report designer.

NOTE

Reports that contain objects linked to the Crystal Repository are fully supported; however, no new repository objects can be added to the report without using the standalone designer.


The menus that you would normally find in the standalone Crystal Reports designer can be found by right-clicking on an empty spot on the designer surface. The pop-up menu provides the same functionality.

Modifying the Report Using the Property Browser

To change the formatting and settings for report objects in the standalone designer, users are familiar with right-clicking on a report object and selecting Format Field from the pop-up menu. This opens the Format Editor, which gives access to changing the font, color, style, and other formatting options. In the Visual Basic report designer this scenario is still available; however, there is an additional way to apply most of these formatting options: the Property Browser.

The Property Browser is a window that lives inside of the Visual Basic development environment. It should be very familiar to Visual Basic developers as a way to change the appearance and behavior of a selected object on a form or design surface. In the context of the report designer, the Property Browser is another way to change the settings (properties) for report objects. In general, any setting that is available in the Format Editor dialog is available from the property browser when that object is selected. To see which properties are available for a given object, click on it, and check out the Property Browser window shown in Figure 30.2.

Figure 30.2. Changing a report objects settings via the Property Browser is shown here.

graphics/30fig02.jpg


The property names are listed on the left and the current values are listed on the right. To choose a value, simply click on the current value and either type or select from the drop-down list.

One property to pay attention to is the Name property. This becomes relevant in the next section when you learn how to use the Report Engine Object Model to manipulate the report on the fly at runtime. This is the way to reference that object in code. Also of note is that the properties shown in the Property Browser map to the same properties that are available programmatically via the object model. If you see a property there, this means it is also available to be changed dynamically at runtime.

Unbound Fields

The Field Explorer in the Visual Basic report designer has an extra type field not found in the standalone report designer. These are called unbound fields. There is one type of unbound field for each data type. These fields are used to build dynamic reports. Because they do not have a predefined database field mapped to them, they provide a way to change the locations of fields on the report by using some application logic. The reason they each have their own data type is so that type-specific formatting can be applied such as the year format for a date object, or the thousands separator for a numeric object. Unbound fields are revisited later in this chapter.

NOTE

When you create an unbound field, it also shows up as a formula in the Formula Fields list. This is because a formula is used behind the scenes of an unbound field. The best practice is not to edit this as a formula field.



Part I. Crystal Reports Design

Creating and Designing Basic Reports

Selecting and Grouping Data

Filtering, Sorting, and Summarizing Data

Understanding and Implementing Formulas

Implementing Parameters for Dynamic Reporting

Part II. Formatting Crystal Reports

Fundamentals of Report Formatting

Working with Report Sections

Visualizing Your Data with Charts and Maps

Custom Formatting Techniques

Part III. Advanced Crystal Reports Design

Using Cross-Tabs for Summarized Reporting

Using Record Selections and Alerts for Interactive Reporting

Using Subreports and Multi-Pass Reporting

Using Formulas and Custom Functions

Designing Effective Report Templates

Additional Data Sources for Crystal Reports

Multidimensional Reporting Against OLAP Data with Crystal Reports

Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design

Introduction to Crystal Repository

Crystal Reports Semantic Layer Business Views

Creating Crystal Analysis Reports

Advanced Crystal Analysis Report Design

Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting

Part V. Web Report Distribution Using Crystal Enterprise

Introduction to Crystal Enterprise

Using Crystal Enterprise with Web Desktop

Crystal Enterprise Architecture

Planning Considerations When Deploying Crystal Enterprise

Deploying Crystal Enterprise in a Complex Network Environment

Administering and Configuring Crystal Enterprise

Part VI. Customized Report Distribution Using Crystal Reports Components

Java Reporting Components

Crystal Reports .NET Components

COM Reporting Components

Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition

Introduction to Crystal Enterprise Embedded Edition

Crystal Enterprise Viewing Reports

Crystal Enterprise Embedded Report Modification and Creation

Part VIII. Customized Report Distribution Using Crystal Enterprise Professional

Introduction to the Crystal Enterprise Professional Object Model

Creating Enterprise Reports Applications with Crystal Enterprise Part I

Creating Enterprise Reporting Applications with Crystal Enterprise Part II

Appendix A. Using Sql Queries In Crystal Reports

Creating Enterprise Reporting Applications with Crystal Enterprise Part II



Special Edition Using Crystal Reports 10
Special Edition Using Crystal Reports 10
ISBN: 0789731134
EAN: 2147483647
Year: 2003
Pages: 341

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net