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

rough design on paper helps them create a look for each page. It helps them find a balanced way of positioning the various elements before they begin working with sophisticated graphics tools. You will find a similar exercise helpful in designing your reports. See How to design a prototype, Page 104.

While a paper prototype is useful regardless of your expertise with Seagate Crystal Reports, it is particularly valuable when you are first learning the program. With the paper prototype in hand, you can put your full effort into learning and using the commands instead of trying to design and learn at the same time.

How to design a prototype

Get paper of the size you will be using for your finished report.

Position your title and other descriptive header information, using boxes or lines to represent report elements.

Position your footer information.

Review the page for balance.

Look at the information you intend to include in the body of your report.

¾Count the number of fields you will be using and estimate the appropriate spacing between fields.

¾Use rectangles to pencil in the fields using your estimated spacing.

¾Change the spacing if you need to.

¾Decide on a logical sequence for presenting the data in the body of the report.

¾Label the fields to indicate that sequence.

Use small boxes to indicate group values and totals.

Place some random flags in the column where you want the flags to appear.

104

Seagate Crystal Reports User’s Guide

Darken any elements you want highlighted so they stand out from the rest of your prototype.

Review your finished product for look and balance, and make changes as needed.

Concepts in reporting

Report Expert,

Another Report, or Custom Report?

The purpose of this section is to give you a conceptual understanding of the tasks necessary to create a fairly standard report such as the one created in Tutorial - Customer List, Page 165. Each topic is discussed in relation to the Tutorial; please refer to Tutorial - Customer List, Page 165, throughout for an illustration of these concepts.

The concepts are presented in the order you may use to create such a report and sources of additional information will be provided.

Each time you create a new report, you have three options:

1.using a Report Expert,

2.using Another Report as a template, or

3.creating a Custom Report from scratch.

You will probably use all options at some point in time.

REPORT EXPERT

The Report Experts help you create reports as quickly as possible and many new users and developers alike prefer to create the majority of their reports using them. All you have to do is choose the Expert that most closely matches your report type. The Expert walks you through the process of creating your reports step-by- step.

You can quickly create the report and see how it looks against your actual data. And best of all, if you then decide you want to make changes you can get back to the Report Expert to further modify your report. Search for Experts Index in Seagate Crystal Reports online Help.

Reporting 101

105

Selecting your data

ANOTHER REPORT

If you want to build a new report based upon one that already exists, you can use another report as a template to base your report on. The program will make a duplicate of the original report, which you can modify however you please to create your new report. Use this option whenever you think templates can save you time. Templates are useful:

when you need to create a new report with a different grouping or different record selection than that of an existing report,

when you need to create a series of reports, each a little different than the last,

when you need to reconstruct a report based on an earlier time period using the same report structure used today, or

when you need to create an entirely new report based on a set of databases that are linked in another report. You can create a report and delete the fields without disturbing the underlying links. Then, without relinking, you can build all your new reports based on this report.

CUSTOM REPORT

The Custom option is used when you want to create your report from scratch. This is used often when you want the full flexibility and control of building your reports from the ground up or if your report type is different than the many report types available in the Experts.

The Custom option was chosen for the Tutorial - Customer List, Page 165, because creating a report from scratch most fully illustrates the basics of reporting.

The next step when creating your reports, is to select the data you want to use in your report. This is a two step process. The first step is to determine what type of data you want to work with and the second step is to actually select the data. See How to select data and begin creating a report, Page 113.

106

Seagate Crystal Reports User’s Guide

Seagate Crystal Reports provides four different data types:

data file,

SQL/ODBC,

dictionaries, and

queries.

DATA FILE

Choose the Data File option if you want to use any of the standard (not client-server) PC databases to report on. These are typically databases whose data and all software used to access that data are on a single machine. Seagate Crystal Reports can access many of the most common PC database formats directly; the program has built-in capabilities to directly open database files and tables designed in dBASE, FoxPro, Clipper, Btrieve, Paradox, and Microsoft Access, among others. Once the program is installed on your system, you can immediately begin creating reports based on these databases simply by selecting the appropriate file. See

Data Sources, Page 583.

The Data File option was chosen for the Tutorial - Customer List, Page 165, because the sample data, CRAZE.MDB, is a Microsoft Access database.

SQL/ODBC

Choose the SQL/ODBC option if you want to use SQL or ODBC data sources.

SQL (Structured Query Language) databases are perhaps the most popular and most powerful database formats. They usually work over a client/server network architecture and they use:

¾an SQL server to create, store, and manipulate database files, tables, fields, and records, and

¾an SQL client interface allowing workstation users to retrieve data.

See Using SQL and SQL databases, Page 545.

Reporting 101

107

ODBC (Open Database Connectivity) is a standard developed by Microsoft through which many different types of data can be accessed by a single application. An application need only communicate with one set of files, ODBC, to instantly be able to work with any source of data that can be accessed by ODBC.

See ODBC data sources, Page 606.

Seagate Crystal Reports provides direct drivers for many of the most popular SQL systems, and ODBC capabilities as well.

DICTIONARIES

In many large organizations, data is stored in a variety of places. It may be in different databases, on different servers, and so forth. IS departments often use naming schemes for tables and fields that are logical and predictable, but the names assigned may seem cryptic to non-technical staff. Enabling staff to create reports themselves in such an environment can create extensive training and support problems and possibly compromise data integrity. Dictionaries provide a solution to these problems. They allow you to provide your staff with ready access to the data in a form that they can understand, but they also allow you to maintain complete control and security over your data resources.

A dictionary is a structured, simplified, and secure view of organizational data that you can create for some or all of the users in your organization.

A dictionary is an optional metalayer that you can place between the user and the data. Using the capabilities of the metalayer you can:

design a single, dynamic view of all the data that is necessary to create organizational reports and queries,

include multiple data sources, tables, and links,

organize the data and rename tables and fields to make it easier for users to understand the content and purpose of the data,

limit access to specific columns of data (for example, letting only executives see the salary column of the employee data files),

108

Seagate Crystal Reports User’s Guide

place restriction formulas on specific rows of data (for example, allowing managers to view employee information only for those employees with a salary under $40,000),

create complex data manipulation formulas that users can access without the need to understand formula concepts.

Dictionaries reduce support cost and time, increase user productivity, and enable you to add an additional layer of security between the user and the data.

NOTE: When you create a report using a dictionary, the only data you can use in the report is the data you access through the dictionary; you can not use a dictionary and some other data source in the same report. Because the dictionary is often used to impose data security, it would breach that security to allow unrestricted data access in a dictionary report.

NOTE: You can include a subreport based on a different data source in a primary report based on a dictionary.

NOTE: Dictionaries are an optional metalayer. You can use Seagate Crystal Reports without ever using dictionaries.

See Dictionaries, Page 491.

QUERIES

A query is simply a request for specific information from a database. If you are requesting that information from an SQL database (or from a database that you access via ODBC), your query must be written using the Structured Query Language (SQL). The SQL language is not difficult to learn, but mastering the fine points of creating and retrieving data using SQL can take quite a while. Since the Query Designer eliminates the need to understand SQL, it can get you building effective queries right away.

The Query Designer has been designed to meet the needs of individuals with little or no query background as well as the needs of experienced SQL professionals.

If you are new to querying, you will enjoy the way the Query Designer helps you create queries, even if you have no knowledge of SQL whatsoever. By answering a few questions on a set of sequential tabs, you give the program all the information to generate a query that fits your needs.

Reporting 101

109

Linking

Placing data on your report

If you are an SQL professional, you will appreciate the facility that enables you to fine tune the queries that the Query Designer generates. If you are more comfortable writing your own SQL queries, you will find it easy to enter your queries directly or even paste them in from another source.

The Query Designer can be a powerful tool for many of your information gathering needs.

NOTE: The Query Designer can only access data stored in an ODBC data source.

If your report contains data from two or more database tables you will need to link at this point when creating your reports. You link database tables so records from one database will match related records from another. For example, if you activate a Suppliers table and a Product table, you link the databases so that each product (from the Product table) can be matched up with the supplier that made the product (from the Supplier table).

The majority of your reports will probably require data from two or more tables so linking will be necessary. The process of linking is made easy with the Visual Linking Expert. See How to add and link multiple tables, Page 116, and search for Visual Linking Topics Index in Seagate Crystal Reports online Help.

NOTE: You will never find it necessary to link tables in reports from a query because any links required by the data have already been processed.

Placing data on your report is a very important task. You have to know what type of data you want to place on your report and also where on your report you want to place them.

DATABASE FIELDS

Much of the data you place on your report will be database fields, displaying data as it is stored in the database. For example, in

Tutorial - Customer List, Page 165, the Customer Name, City and Country fields are placed on the report. Normally, you will place database fields into the Detail section, but in certain circumstances you will place them in other sections of your report. See How to insert database fields, Page 118.

110

Seagate Crystal Reports User’s Guide

Formatting data

Record selection

TEXT OBJECTS

Text objects will be used in your reports for a multitude of purposes. They are a powerful way of inserting titles; labelling summaries and other data on your report; and for easily combining database fields. For example, in the Tutorial - Customer List, Page 165, text objects are used to easily display the two contact name database fields as one object, to insert a column heading for the concatenated contact name, and to insert a title in your report. See How to insert text objects, Page 120.

SPECIAL FIELDS

To display information such as Page Numbers, Print Date, and Report Comments use the commands on the Insert|Special Field menu. See How to insert special fields, Page 118, and search for

Special Field commands in Seagate Crystal Reports online Help.

FORMULA FIELDS

If you want to display data that is a calculated value, you will need to create a formula field and place that formula field on your report. For example, if your database only stores the order and ship dates for orders but you need to display the number of days it takes to ship the order, you will need to create a formula field that will calculate the number of days between ordering and shipping. This is just one simple example of the use of formula fields. See Formulas 101, Page 321, for an introduction to formulas.

At this point in creating a report, you may want to do some basic formatting. Perhaps you would like to change the font size and style of a text object used as a title. Or, if you have a number field, such as a sales figure, you might want to place a dollar sign before the number or change the number of decimal places displayed.

For example, in the Tutorial - Customer List, Page 165, you format the title, add a text object to identify the Contact Name information, and insert the company logo. See Formatting, Page 231.

Record selection, the task of paring down the data in your reports to include only the data required for your report, is a crucial step in report creation. You will rarely want a listing of all the information in a database. Most often you will be interested in

Reporting 101

111

Grouping,

sorting, and summarizing your data

only the sales in a given time period or for a certain product, etc. For example, a sales report may be designed to only include sales from one product line for the last calendar month.

The sample data used for the Tutorial - Customer List, Page 165, has information from both United States and International customers. Record selection is used to create a report that lists only those customers in the United States. See Record and Group Selection, Page 249.

Once you have created a basic report you will want to organize the data by grouping related information, sorting individual records, and summarizing, subtotaling, and grand totalling.

GROUPING RECORDS

To organize your data, you may want to group related data together. For example, in the Tutorial - Customer List, Page 165, after grouping the Customer List by region, you divide the list into region groups. That way, a sales manager for the California region could quickly locate the California group and see the customers within their region only. See How to group data, Page 285.

SORTING RECORDS

Seagate Crystal Reports allows you to specify the order in which you want the records on your report displayed. For example, after grouping in the Tutorial - Customer List, Page 165, you sort the records within each region in alphabetic order by Customer Name. Many of your reports will use some type of sorting. Depending on the report, you will sort the records in a list or sort in conjunction with grouping. See How to do a single field sort, Page 281, and How to sort records within groups, Page 287.

SUMMARIES, SUBTOTALS, AND GRAND TOTALS

Many of your reports will use some sort of totalling. For example, in a North American sales report grouped by state, you might want to calculate the total dollar amount sold in each state. You do this by creating a subtotal on the sales field. Summaries are also used at the group level, allowing you to calculate averages, counts, and other group (aggregate) values. For example, in a sales report you may want to calculate an average of sales per

112

Seagate Crystal Reports User’s Guide

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]