Welcome to Seagate Crystal Reports

Welcome! This section introduces you to Seagate Crystal Reports, the world standard for desktop and web reporting, and provides you with an overview of the contents of this online help.

Additional Resources

Seagate Software offers training for Seagate Crystal Reports and other Seagate Software products in major cities throughout North America and the world.

To view schedules and course descriptions or to schedule public or on-site training, visit our web site at:
http://www.seagatesoftware.com/coursedescriptions.

Email us at training@seagatesoftware.com or call us at 1-800-877-2340 or 604-681-3435.

The Seagate Crystal Reports User's Guide is available in PDF format on the install CD in the Documentation folder. The contents of the online help includes everything from the printed manual, plus more.

Seagate Software Community web site

The Seagate Software Community web site, which serves as an extension of all Seagate Software products, is the place to go for product support, samples, educational documents, tutorials, tools, forums and more.
http://community.seagatesoftware.com

Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com


Welcome

Seagate Crystal Reports is designed to work with your database to help you analyze and interpret important information. Seagate Crystal Reports makes it easy to create simple reports, and, it also has the comprehensive tools you need to produce complex or specialized reports.

Create any report you can imagine

Seagate Crystal Reports is designed to produce the report you want from virtually any data source. Built-in report experts guide you step by step through building reports and completing common reporting tasks. Formulas, cross-tabs, subreports, and conditional formatting help make sense of data and uncover important relationships that might otherwise be hidden. Geographic maps and graphs communicate information visually when words and numbers are simply not enough.

Extend reporting to the Web

The flexibility of Seagate Crystal Reports doesn't end with creating reports — your reports can be published in a variety of formats including Microsoft® Word and Excel, email and even over the Web. Advanced Web reporting lets other members of your workgroup view and update shared reports inside their web browser.

Incorporate reports into applications

Application and web developers can save time and meet their users needs by integrating the report processing power of Seagate Crystal Reports into their database applications. Support for most popular development languages makes it easy to add reporting to any application.

Whether it's the web master in IT, the promotion manager in marketing, the database administrator in finance or the CEO, Seagate Crystal Reports is a powerful tool designed to help everyone analyze and interpret the information that's important to them.


About the online help

The online help includes procedures for typical reporting tasks such as placing fields, formatting reports, and sorting records. It also contains information on more specific areas of interest such as advanced formula creation and accessing different types of data. Use the online help as a reference for your basic reporting needs as well as an introduction to new concepts in report creation.


Section Contents

The following is a short description of each section in the online help.

Welcome to Seagate Crystal Reports

This section provides an overview the user's guide and online help. It also lists the command, button, and key conventions used in the user's guide.

What's New

Seagate Crystal Reports includes a set of new features to make reports even more flexible and also incorporates many improvements suggested by users. This section identifies and describes the new features and enhancements made to this version of Seagate Crystal Reports.

Quick Start

This section begins with an overview of the sample reports and data commonly used with Seagate Crystal Reports. It then presents an overview of the Report Experts — both new and advanced users can benefit from looking at the Standard Report Expert as it has many steps in common with the other Report Experts. Finally, the section offers two tutorials: one for new users and another for more advanced users.

Report Design Concepts

This section describes the basic concepts of report design and helps you decide what information you want to include in your report.

Introduction to Reporting

This section shows you the basics of creating a report in Seagate Crystal Reports. First you'll learn about the report design environment, then how to select database tables, place objects on a report, and sort, group, and total your report data.

Record Selection

This section shows you how to filter the records you want to include in a report. Use the record selection tools to show records for a specific group of customers, a specific range of account numbers, or a particular date range.

Sorting, Grouping, and Totaling

Sorting, grouping, and totaling are the steps that turn disorganized data into useful information on a report. This section describes the types of sorting, grouping, and totaling you can do within a report.

Running Totals

Running totals are a flexible and powerful way to create specialized summaries and continually incrementing totals. This section shows you how to add a basic running total and a running total within a group to your report. You also learn how to create conditional running totals and running totals using formulas.

Multiple Section Reports

This section introduces the various types of sophisticated reports you can create using the multiple section reporting capabilities in Seagate Crystal Reports. These capabilities enable you to create reports that treat individual values differently based on sets of criteria you establish. These concepts are then applied to the creation of Form Letters.

Formatting

Formatting refers to changes in the layout and design of a report, as well as the appearance of text, objects, or entire report sections. This section details methods you can use to draw attention to data, change the presentation of dates, numbers, and other values, hide unwanted sections, and perform a variety of other formatting tasks to give a report a professional appearance.

Charting

Seagate Crystal Reports enables you to present summarized data in colorful, easy-to-read charts and graphs. This section demonstrates how to create charts and how to use them in reports to make report data more meaningful and easier to understand. You can choose from a number of chart layouts and types, as well as drill down to see the details behind the graphical summaries and format chart objects.

Mapping

Seagate Crystal Reports enables you to include professional geographic maps with every report. This section explains how to use maps in reports to make report data more meaningful and easier to interpret. You can customize and rearrange the appearance of a map and activate the drill-down mode to view the details behind the graphical summaries.

OLE

This section explains how Object Linking and Embedding (OLE) can be used to edit graphics or other objects from within your report instead of opening an additional application.

Cross-Tab Objects

A Cross-Tab object is a grid that displays values that are grouped and summarized in two directions. This section provides you with information about how you can use Cross-Tab objects in your report.

Creating and Updating OLAP Reports

This section describes how to create OLAP reports with a variety of OLAP and Multi-Dimensional data sources and how to update them when the location of your data changes.

Distributing and Viewing Reports

This section provides you with information you need to distribute finished reports using a variety of methods (printing, faxing, exporting). In addition, it includes instructions for viewing your reports using a web browser and Report Viewers.

Creating Reports from Excel and Access

This section describes the Add-ins for Microsoft Excel and Microsoft Access. It explains how you install the Seagate Crystal Report Wizard and how you create reports from an Access table or query and an Excel spreadsheet.

Using Formulas

This section explains the basics of formulas and introduces you to the Formula Editor so you can begin to create formulas.

Creating Formulas with Basic Syntax

This section provides you with an overview of various parts of a formula. You learn about Basic syntax and the techniques you can use when creating a formula.

Creating Formulas with Crystal Syntax

This section provides you with an overview of various parts of a formula. You learn about Crystal syntax and the techniques you can use when creating a formula.

Functions

This section provides you with a list of functions and demonstrates how they can be used in a formula.

Operators

The section provides you with a list of operators and demonstrates how they can be used in a fornula.

Parameter Fields

This section explains what parameter fields are and how they can be applied to create a single report that can be used to access different types of data depending on the user's needs.

Subreports

A subreport is a report within a report. With subreports, you can combine unrelated reports into a single report, coordinate data that can't be otherwise linked, and present different views of the same data in a single report. This section shows you how to create and use subreports.

Understanding Databases

This section describes the essentials you'll need to know to understand database design and use. After describing relational databases (including those from ODBC data sources), indexing, and table linking, the section introduces the concepts of server-side processing (pushing report processing to the server level) and field mapping (re-establishing report and database field mappings after a database changes). Finally, the section focuses on common database-related tasks such as changing a database driver and creating an ODBC data source.

Accessing Data Sources

Seagate Crystal Reports works with all kinds of data, from simple text files to advanced client-server SQL databases. This section shows how the program connects to various data sources and what files have to be in place in order to make the connection. This is an in-depth section for advanced users who need to know how Seagate Crystal Reports operates beneath the surface.

The Crystal SQL Designer

This section shows how to create queries that can be used for ad-hoc analysis or result sets for creating reports. The Crystal SQL Designer can be used to create, modify, and optimize complex SQL queries.

Dictionaries

Dictionaries are structured and simplified views of data that can be created for some or all of the individuals in an organization. When working with Dictionaries, users see only the information that they need and that you want them to see. This section shows you how to set up and use Dictionaries to improve organizational efficiency and security.

Appendix A: Report Processing Model

Seagate Crystal Reports uses a sophisticated multi-pass reporting model for processing reports. Understanding this model will help you design efficient reports and solve reporting problems.

Appendix B: Product Support

This appendix lists various contacts for obtaining product support.

Appendix C: Seagate Software International Office Directory

This section provides contact numbers for Sales and Product Support for Seagate Software offices, worldwide.

Glossary

The online help comes with a comprehensive glossary explaining basic database and reporting concepts as well as terms specific to the program.


Using the online help

Seagate Crystal Reports online help includes all topics within the user's guide. It also provides additional reference material ranging from specific information on the function of a button to general information on how to create a report formula based on a sample business scenario.

Locate information quickly

Access online help from the Seagate Crystal Reports help menu.

Use the Contents tab to view all major sections in the online help and drill down to specific headings within each section, the Index tab to view topics in alphabetical order, and the Search tab to enter a keyword to view all the sections that relate to the keyword.

Sample Reports

Many topics in the Seagate Crystal Reports online help include a list of related sample reports. Use these reports to illustrate concepts the topic describes. The sample reports can be adapted to your own needs.

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

For a list of sample reports see Sample reports.


Command, button, and key conventions

The online help uses the following conventions:

Commands and buttons

For easy recognition, command names and button names are displayed in bold. For example: New command, Print button, etc.

Key combinations

Keyboard shortcuts appear in the following forms:

  • Delete means the Del key (either the Delete key, or the Del key on your numeric keypad).
  • Enter means the Enter or Return key, depending on which of these keys appears on your keyboard.
  • Ctrl-Key, Shift-Key, and Alt-Key are examples of the notation for two-key combinations. Press the first key in the combination (Control, Shift, or Alt), and, at the same time, press the second key in the combination (designated above as Key). For example: Ctrl-C means to hold the Control key down and then press the letter C on your keyboard (Ctrl-C is the Windows Copy command).

Other conventions

  • Courier font indicates data that you enter using the computer keyboard. It is also used to show example formulas.

    {orders detail.UNIT PRICE}*.85


What's New

Seagate Crystal Reports 8 brings you a number of new features and enhancements, including many recommended by our customers.

This section introduces the new features and enhancements, categorized as:

Web reporting

Performance

Increased developer power

Integration with Microsoft Office

Usability


Web reporting

Available in Seagate Crystal Reports Developer Edition and Seagate Crystal Reports Professional.

Scalable to meet increased user demands

The Web Component Server has been re-designed to better handle the specific needs of a thin-wire environment, so reports are built for the demands of the Web.

Page-on-demand report access lets users download only the specific report pages that they need to see, improving response times and reducing web traffic.

The redesigned web component server supports most Microsoft®, Netscape® and CGI-based web servers to give scalable high performance reporting.

See reports immediately, in real-time

Enjoy live viewing of any Seagate Crystal Report over the Web. View reports in full presentation quality using report viewers for Netscape and Microsoft browsers. Viewers for Active X also support copying and pasting text from the browser into other applications.

Viewer improvements

The architecture of Seagate Crystal Reports 8 has been enhanced for the Web. View most reports more quickly with as much information available while processing continues in the background. You don't have to wait for total page count or processing to finish. You see a report complete with data, but containing place holders for time-consuming objects like graphics and subreports.

Seagate Crystal Reports completes processing in the background; missing information is automatically added to the web page. In the end, whether you are refreshing for up-to-the-minute results in real-time or loading reports with saved data, you see pages faster.

A new Netscape plug-in lets you use the Report Viewer for ActiveX in Netscape Navigator. This provides Netscape users with all the functionality of the ActiveX report viewer, including the ability to print reports close to WYSIWYG quality.

The Report View for Java is compatible with Sun's Java 2 Runtime Environment v.1.2.2, and is compatible with both Microsoft and Netscape browsers.

Improvements to report formats over the Web

You have the ability to export reports to an improved HTML format. These exporting types retain formatting to ensure your report is easy to read.

Use Web folders to maintain reports

If you are running Microsoft Windows 9x, Windows NT with Microsoft Office 2000, or Windows 2000, you can store, update, and save reports directly to a web folder on a web server. You no longer have to download reports, edit them locally, and upload them to the web server.

Add hyperlinks to reports

Create reports for end users that are active documents—just like any web page—with links to other related documents including files, web sites or other reports. Hyperlinks can be associated with most report objects, including text and pictures, and with dynamic objects such as database and formula fields. Hyperlinks are executed by simply clicking on a linked object in either the Preview window or web viewer. Full URL support is provided for hypertext, file, mail and news hyperlinks.


Performance

Fastest performance ever

Seagate Crystal Reports 8 features major improvements to report performance in all areas of processing.

Seagate Crystal Reports has the capacity to handle larger data sets much more quickly. You will see performance improvements during your entire cycle of report creation—from opening and refreshing to formatting and saving your reports.

View reports with saved data immediately

Due to changes in accessing saved data on-demand, you can now open and view the first page of many reports immediately.

Faster processing of refreshed data

Seagate Crystal Reports is able to generate better SQL (Select Distinct, pushdown OR clauses, and more record selection) so less data is returned from the database.

Enhancements to calculations for formulas and summaries also provide faster processing of records returned from the database.

Jump to the last page

Significant improvement in page formatting enables you to see the last page of your report sooner.

Smaller file size

RPT and Temp files are generally much smaller in Seagate Crystal Reports 8 due to a new file format.

You have the flexibility to save a report to version 7 if you require backward compatibility.


Enhanced Formula Editor

These enhancements are available in all editions of Seagate Crystal Reports.

More flexibility

The formula language has been expanded to include case statements, looping and dynamic arrays.

Use the formula syntax you know best: Crystal or Basic

Crystal syntax is the formula language used in previous versions of Seagate Crystal Reports while Basic syntax is new to Seagate Crystal Reports 8. If you have worked with Microsoft Visual Basic, then Basic syntax may be more familiar to you.

You can create formulas using either Crystal or Basic syntax. Almost any formula written with one can be created with the other. As with Crystal syntax, Basic syntax does not require any additional DLLs to run.

New formula functions

The following groups of functions have more functions to choose from:

  • Financial functions
  • Math functions
  • Program shortcut functions
  • Type conversion functions
  • Date and Time functions
  • Array and String functions
  • Percentage functions.

New operators

The following groups of operators have more operators to choose from:

  • DateTime Literals
  • Array Operators
  • Operators for Unbound Ranges.

New control structures

Control structures similar to the Microsoft Visual Basic counterparts have been added to both Crystal and Basic syntax.

  • "For" statements
  • "Do" and "While" statements
  • "Select" statements.


Increased developer power

These enhancements are available in Seagate Crystal Reports Developer Edition.

Report Designer Component enhancements

Report Creation APIs

The RDC object model has been significantly enhanced to include the complete report creation API (runtime license required) to support building or modifying reports in applications at runtime.

Unbound Fields

Unbound fields, which bind to a database at runtime, are also supported and several new reporting processing events have been added. You can now insert an unbound field into a report at design time, and bind the field object to an actual data database field at runtime. This allows you to customize reports more easily at runtime.

Support for Microsoft Transaction Server (MTS)

The Report Designer Component now supports apartment model threading for better performance when used as a server or with MTS.

Web developer enhancements

Integrating Reports into Visual InterDev

The Report Integration Control enables web developers using Microsoft Visual InterDev 6.0 to write web applications that generate Crystal reports hosted on either a Web Component Server or an ASP server. End users of these applications can then view these reports using a Report Viewer running in a web browser.


Integration with Microsoft Office

These enhancements are available in all editions of Seagate Crystal Reports.

Create reports from Microsoft Excel spreadsheet data

Using the Add-in for Excel, create reports using data from a Microsoft Excel spreadsheet. You have the option to choose and limit the Excel data you want available in the report. To maintain consistency with the data, any data changes in Excel are updated automatically in Seagate Crystal Reports. Compatible with Excel 97/2000.

Create reports from Microsoft Access data

Using the Add-in for Access, create reports from Microsoft Access queries or tables. The report remains linked to your Access database table or query so any data changes in Access will be displayed when you refresh your report.


Usability

These enhancements are available in all editions of Seagate Crystal Reports.

Report Creation

Report Designer Enhancements

The report design interface offers much better control over the positioning of report objects with the ability to move, align, resize, copy, and paste multiple objects and new alignment and ruler options. This is especially useful for designing reports for use with printed forms.

Access your data quickly with the Data Explorer

Connecting to data is faster and more intuitive for end users, with the Data Explorer's familiar Explorer-like interface for selecting data sources. Choose from available drivers, sorted by connection types, or access the Favorites folder—which maintains a list of links to the most used data source locations. You are also able to create new connection via ODBC or OLE-DB. View your most recently accessed files through the History folder.

View and modify all fields with the Field Explorer

Now you can insert, edit, or delete fields in the Design and Preview tabs. The Field Explorer provides a list of the database, formula, parameter, group name, running total, and special fields that you can add to your report.

Autosave Reports

Autosaving is now supported. Reports can be saved with a visual preview "snapshot" of the first page.

Use the search function to locate text quickly within reports

In the Preview tab, search for strings in text objects, field objects, subreports, cross-tabs, and OLAP grids.

Create reports faster with new Cross-Tab or OLAP Experts

The OLAP/Cross-Tabs Report Expert has been enhanced to provide 18 predefined grid styles and more control over grid layout, formatting, mapping, and charting. You now have the ability to conditionally format individual rows or columns. Filtering, grouping, and ordering of OLAP dimensions in the Expert has also been enhanced to be easier to use and more flexible.

New support for Adobe Acrobat (PDF) and HTML 4.0 file formats

File export has been enhanced to provide better preservation of formatting and new support for the Adobe Acrobat (PDF) and HTML 4.0 file formats for more accurate rendering of a report's look and feel.

File Storage

The .rpt file format has been improved to create smaller files with faster compression and more efficient storage of complex reports containing saved data. Version 7 users can also open report files created in Seagate Crystal Reports 8, but some features may not be supported.


Subreports

Specify that subreports be created on-demand

When you create a subreport, you can specify that it is to be on-demand and appear only as a hyperlink in the main report.

The actual data is not read from the database until the user drills down on the hyperlink. Only data for the on-demand subreport that is actually viewed will be retrieved from the database.

Re-import subreports

Maintain the most up-to-date subreports by re-importing a subreport automatically when opening the main report.

Re-importing not only updates the data, but updates the formatting, grouping, and structure of the subreport if any changes have been made. If you change the report the subreport was originally based on, you can have these changes reflected in the report containing the subreport.

You can either globally specify that all subreports should be re-imported, or set the automatic re-import for an individual subreport.


Text formatting

Change fonts conditionally

In addition to conditionally formatting text by style and size, you can now conditionally format database fields by font.

Choose from more date, time, and date-time formats

Choose from a list of sample styles for date, time, and date-time formats or further customize these styles to suit your reporting needs.

Similar enhancements have also been made to numbers and currencies.

Rotate text objects

Rotate text objects, memo fields, and string fields 90 or 270 degrees.

Control indentation for lines

Specify the indentation for lines in string fields, memo fields, and text objects.

Specify a fractional point size

Use a fractional point size for a database field or a text object.

Control line and character spacing

Specify the spacing between lines and characters for text objects, string fields, and memo fields.

Use the search function to locate text quickly within reports

In the Preview tab, search for strings in text objects, field objects, subreports, Cross-Tabs, and OLAP grids.

Add new shapes

Insert new shapes such as circles, ovals, and boxes with rounded corners.


Formatting objects, images, and symbols

Use accounting formats

Control how the negative symbol, currency symbol, and zero value are displayed in a report. You can also reverse the sign for debit and credit.

Format multiple objects

Select multiple objects, including text, field, chart, map, bitmap, OLAP grid, Cross-Tab, and OLE objects, to move, align, size, and copy and paste together.

Choose from more image formats

Seagate Crystal Reports now supports more image formats for blob fields including JPEG, DIB, PNG, and TIFF.

Insert pre-formatted HTML or RTF data into reports

Insert pre-formatted data in RTF or HTML into a report. The Seagate Crystal Report Designer will extract any information about the font, size, style, color and paragraph and display the data with the specified attributes.


Enhanced grouping and summarizing

Group data hierarchically

Use hierarchical grouping to arrange data in a report to show the hierarchical relationships in your data.

Rename group headers

To better describe a group, use a database field name or Group Name formula to specify the text that appears in the Group Header.

Insert a summary or subtotal on all groups

Choose whether to insert a summary or subtotal on every group, or specify the field you want summarized or subtotaled. You can specify this choice without first selecting a field.

Calculate percentages on grouped data

View the percentage of one group's involvement in a larger group. For example, use the Percentage Summary field to show the percentage of sales in each city of a country based on the total sales of the country.


Enhanced charting and mapping

Create charts and maps based on running totals and OLAP grids

Create charts and maps using a variety of data, including running totals and OLAP grids.

Define and control the zoom area of charts and maps

You can now define the area of a map, line chart, or bar chart on which you want to zoom. Use the zoom features to examine the specified area in greater or less detail.

Always know where you are with the Map Navigator

When you are zooming in and out of maps, the Map Navigator shows the entire map and highlights the portion of the map you are currently viewing. Use the Map Navigator to pan from one area to another.

Compare multiple totals in one chart

Use a graphic representation to compare totals such as last year's sales versus this year's sales or actuals versus budgeted.

Create maps based on unique groups

Let your specified groups define the borders of a map. If you have a report that groups data based on unique geographic groups, you can see a visual representation of these groupings.

Resolve mismatched data with map locations

View the data that does not match the geographic names in the map. For example, a map of North America may use "Unites States of America" while the data uses "USA." Use the Map Region Resolver dialog box to view and add data that was not in included in the map.


Quick Start

This section begins with an overview of the sample reports and data commonly used with Seagate Crystal Reports. It then presents an overview of the Report Experts—both new and advanced users can benefit from looking at the Standard Report Expert as it has many steps in common with the other Report Experts. Finally, the section offers two tutorials: one for new users and another for more advanced users.


Learning how to use Seagate Crystal Reports

You can teach yourself how to use Seagate Crystal Reports by choosing from the methods available in this section:

  • you can study the sample reports and sample database included with Seagate Crystal Reports
  • you can use the detailed descriptions and instructions in the Quick start for new users
  • you can use the summaries and topic cross-references in the Quick start for advanced users—especially useful if you're already familiar with reporting concepts.

Each method is a helpful way to learn and understand Seagate Crystal Reports and, although any one might be enough to get you up and running, you can always come back to this section and consult the other methods as you need them.


Sample reports

Seagate Crystal Reports comes with two kinds of professionally designed sample reports:

The Feature Examples folder include a selection of reports designed to illustrate basic concepts and common report functions. These samples include:

  • Chart.rpt
  • Cross Tab.rpt
  • Date Range Formula.rpt
  • Formatting.rpt
  • Formulas.rpt
  • Group By First Letter.rpt
  • Group By Intervals.rpt
  • Group.rpt
  • Hierarchical Grouping.rpt
  • Hyperlinks.rpt
  • OLAP Cube Report.rpt
  • Percentages.rpt
  • Record Selection1.rpt
  • Record Selection2.rpt
  • Running Totals Group.rpt
  • Running Totals.rpt
  • Sort Multiple Field.rpt
  • Sort.rpt
  • Subtotal Group.rpt
  • Subtotal Multiple Level.rpt
  • Summary Group.rpt
  • Summary With Formula.rpt

The General Business folder includes samples that cover a wide range of reporting needs for many of the departments in an organization.

The sample reports are valuable learning tools:

  • by studying the content of the reports, you can see the kind of information that is needed and how it is presented
  • by studying the layout and design of the reports, you can see how the information is arranged for clarity.


Sample data - Xtreme.mdb

Seagate Crystal Reports comes with Xtreme.mdb, a sample database you can use when learning the program. Xtreme.mdb is a Microsoft Access database and all of the necessary drivers are included. You should be able to open the database directly and begin designing reports. Virtually all of the examples in this manual are based on Xtreme.mdb data.

Xtreme.mdb is a database that contains data for Xtreme Mountain Bikes, a fictitious manufacturer of mountain bikes and accessories. The database includes the following tables:

  • Credit
    Information from customer credit memos, such as credit authorization IDs and amounts.
  • Customer
    Data for the customers served by the company.
  • Employee
    Company-oriented data for the employees of Xtreme Mountain Bikes.
  • Employee Addresses
    Personal data for Xtreme Mountain Bikes employees.
  • Financial
    Financial data for Xtreme Mountain Bikes.
  • Orders
    Identifying and tracking data for orders.
  • Orders Detail
    Line item data for orders.
  • Product
    Descriptive data for Xtreme Mountain Bike products.
  • Product Type
    Category data for Xtreme Mountain Bike products, including product pictures.
  • Purchases
    Identifying and tracking data for product purchases.
  • Supplier
    Data for suppliers who serve Xtreme Mountain Bikes.
  • Xtreme Info
    Company data for the Xtreme Mountain Bike company, including the company logo.

Xtreme.mdb also includes:

  • a Select query (Top Customers)
  • a Parameter query (Credit_Limits)
  • an Update query (Update Query).

Note: The sample data has been designed to illustrate various reporting concepts in a training environment, not to teach database design. While there are alternative ways of designing a database, this design was selected to keep the tutorials and examples focused on reporting, not on data manipulation.


Report Experts

The tutorials in this section show you how to build a report from scratch. As a complement or an alternative, however, you may want to use the Report Experts available through the Seagate Crystal Report Gallery. There are eight Report Experts:

  • Standard
  • Form Letter
  • Form
  • Cross-Tab
  • Subreport
  • Mail Label
  • Drill Down
  • OLAP.

Each Expert guides you through the creation of a report by providing a series of tabs. Many of the experts have tabs unique to a specific type of report. For example, the Mail Label Expert has a tab that allows you to specify the type of mailing label you want to use.


Standard

The Standard Report Expert is the most generic of the experts. It provides eight tabs, many of which are common to the other Report Experts. The Standard Report Expert guides you through choosing a data source and linking database tables. It also helps you add fields and specify the grouping, summarization (totals), and sorting criterion you want to use. Finally, the Standard Report Expert leads you through chart creation and record selection.

The Style tab contains pre-defined layouts for you to apply to your report to give it more impact.


Form Letter

The Form Letter Report Expert offers an easy solution for creating form letters that use your database as a source of client information. The expert contains much of the functionality of the Standard Report Expert, but has a Form Letter tab that lets you define the text and database fields that will appear in each section of your letter. You can also use the Form Letter tab to import text you have created in another application.

Form

The Form Report Expert lets you create reports that can be printed on pre-defined forms (company invoices, statements, and so on). This expert is much like the Standard Report Expert, but features a Form tab where you choose images of your company logo or forms. Logos and forms can be applied to header or details sections so your report data prints in the appropriate location on your report.


Cross-Tab

The Cross-Tab Report Expert guides you through the creation of a report in which your data is displayed as a cross-tab object. Three special tabs (Cross-Tab, Style, and Customize Style) help you create and format the cross-tab itself.

Subreport

The Subreport Expert lets you create a main report and a subreport at the same time. The expert offers all the Standard Report Expert's flexibility for creating the main report. On the additional Subreport tab, you can choose an existing report to use as the subreport, or you can create a new report. New subreports are created by repeating the steps used in the Standard Report Expert.

Mail Label

The Mailing Labels Report Expert lets you create a report that is formatted to print on any size mailing label. You can use the Label tab to select a commercial label type, or you can define your own layout of rows and columns for any multi-column style report.

Drill Down

The Drill Down Report Expert guides you through the creation of a report that hides sections and makes them available for viewing only though drill down. The expert offers all the functionality of the Standard Report Expert. The Drill tab displays a list of sections that can be hidden. Hidden sections don't appear on your report until you click the appropriate field. Hidden data can be used for summaries and totals.


OLAP

The OLAP Report Expert lets you create a report in which your OLAP data is displayed as a grid object. Although similar to the Cross-Tab Report Expert in several ways, the OLAP Report Expert appears to be different due to the requirements of working with OLAP data sources. You first specify the location of you OLAP data, and then you choose the dimensions you want to include in the grid. Next you filter the report data and choose and customize the style of the grid object. Finally, you can define labels for your grid and insert a chart, if you wish.

This is only a brief overview of the eight Report Experts available in Seagate Crystal Reports.


Quick start for new users

The following tutorial has been designed to give you confidence when creating your first report.

In this tutorial, you will get an introduction to the program as you create a Customer List report. The Customer List is one of the most basic business reports and typically has information such as Customer Name, City, Region, and Contact Name.

You begin by learning the basic concepts: selecting a database, placing some fields on the report, and then selecting specific records to be included. You will then learn how to:

  • insert and move database fields
  • add and format a title
  • display a report in the Preview tab so you can fine-tune your work
  • use the Select Expert to ensure the report includes only the data you need
  • move objects
  • group and sort data
  • insert pictures
  • print a report.

Before you begin

This tutorial assumes you are familiar with Microsoft Windows and uses conventional terms and procedures common to the Windows environment. If you are not familiar with Windows, please refer to the documentation that came with Microsoft Windows for further explanation.

The default font for all report sections in the program is set to Times New Roman, 10 point. If you have changed the default font, or if your printer does not support this font, the field size, field spacing, and screen shots will look different than those included in this tutorial.

This tutorial has been designed using Microsoft Windows 95, Windows 98 and Windows NT. Screen shots may vary slightly if you are using a different platform.

If you are not familiar with the Seagate Crystal Reports environment, review Formatting, which describes working with the grid, free-form placement, using guidelines, and formatting activities.


Creating the report

  1. Click New on the Standard toolbar.

    The Seagate Crystal Report Gallery appears.

    The gallery contains a number of experts to guide you through the creation of specific types of reports. Since you will be learning reporting concepts here, you can skip the experts and build your report from scratch. After you have completed this tutorial, you may want to build some reports using the experts to decide which method of report construction you are most comfortable with.

  2. Select As a Blank Report on the Seagate Crystal Report Gallery dialog box and click OK.

    The Data Explorer dialog box appears.

    Note: You can also create reports based on SQL/ODBC data sources, dictionary files, or query files. See The Crystal SQL Designer, and Dictionaries, for more information.


Selecting a database to use

The next step in creating a report is to select a database. Select the Xtreme.mdb sample database for this tutorial.

To select a database
  1. In the Data Explorer dialog box, select Xtreme.mdb from Database Files. By default, this file was installed in the \Program Files\Seagate Software\Crystal Reports\Samples\Databases directory.

    Note: You may have to use the Find Database File option to find the Xtreme database.

  2. Expand the Xtreme.mdb folder to see a list of fields.

  3. Because you are dealing only with customers in this tutorial, you will select the Customer table. Select Customer and click Add and then Close. The Field Explorer dialog box appears with Database Fields selected.

    Note: If more than one table is selected in the Data Explorer dialog box, the Visual Linking Expert appears. For more information on linking, see Linking multiple tables.


Report sections

The Design tab is divided into five sections: Report Header (RH), Page Header (PH), Details (D), Report Footer (RF), and Page Footer (PF). If at any time you are unsure of the report section in which you are working, simply look at the shaded area to the left of the report which always displays either the section names or the initials that designate the names. See Design tab.

If the Show Short Section Names in Design check box is selected in the Options dialog box, then the Report Header, Page Header, Details, Report Footer and Page Footer section names will appear as RH, PH, D, RF and PF respectively. If this check box is not selected, follow these steps:

  1. On the File menu, click Options.

    The Options dialog box appears with the Layout tab active.

  2. Select the Show Short Section Names in Design check box.
  3. Click OK to return to the report.


Inserting a field

The Field Explorer dialog box appears with Database Fields selected since you will want to insert database fields when you create a new report.

This dialog box is set to remain on-screen until you click Close. All the tables available for use are listed in this box.

You can move the dialog box to another location on the screen by clicking on its title bar and dragging it to a new location. You can also resize the dialog box by dragging any of its edges with the Resizing cursor.

You will now start placing objects on the report by inserting the Customer Name field.

To insert a field
  1. Highlight a field name in the Field Explorer dialog box by clicking the name once. When you highlight a field name, you can review the values for that field as well as the field type and size by right-clicking and selecting Browse Data from the shortcut menu. The Browse dialog box appears listing the field name, type, length, and a subset of field values.

  2. Click the Customer Name field and drag it into the Details section of the report.

    An object frame appears with the Arrow cursor as you drag the field onto the report:

      • the object frame represents the object you have just selected for placement
      • the size of the object frame approximates the size of the data in the field selected.
  3. Move the object frame as far to the left as you can in the Details section. If you move the field too far to the left, the Arrow cursor turns into a Stop cursor, indicating that you cannot drag the field that far. Keep in mind that you cannot place any objects outside the page margin.

    The Design tab should look similar to this:


Understanding fields

Before going any further, take a look at the field you just placed in the Details section:

  • First of all, the object frame indicates that when the report is printed, a field value will appear where the box is positioned.
  • The X's in the object frame indicate that the database field contains a text string. Other data types have different character representations. For example, a currency data type is represented by $55,555.56.

    Note: The X's appear only if you haven't selected the Show Field Names check box on the Layout tab of the Options dialog box.

  • The number of X's in the object frame is the data width, the maximum number of characters in the field as defined by the database. The width of the object frame is the field width (the amount of space allocated to the field for printing). Initially it is set to the width needed to display the maximum number of characters in the field (using the font selected for the field). You can change this width by resizing the field.
  • The size of the X's indicates the point size selected for the characters in the field.
  • The font and style (Bold, Underline, etc.) used in displaying the X's indicate the font and style selected for the characters in the field. Later in this tutorial you will learn how to make changes to these properties.
  • The line spacing is adjusted to the point size selected for the characters in the field.

Adding additional fields

Next, you will insert two additional fields in the report. This time, however, you will use the Ctrl-click combination to add them at the same time.

To add additional fields
  1. Highlight the City field in the Field Explorer dialog box, press the Ctrl key on your keyboard, and then highlight the Country field. Release the Ctrl key. If you scroll through the field list, you will notice that both fields remain selected.

    Note: Using the Ctrl-click combination allows you to select a non-continuous range of fields. The Shift-click combination can be used to select several fields from the list that are continuous.

  2. Drag the fields to place them.
  3. As the cursor is moved over the report, an object frame appears along with the Arrow cursor.
  4. Place the fields to the right of the Customer Name field. Click once to insert the fields. Both fields appear in the Details section of the report in the same order in which they are listed in the Field Explorer dialog box.


Selecting fields

When a field is selected, the object frame appears with a handle (box) on its right, left, top, and bottom edge. These handles indicate that the field is selected, and therefore active. To do anything with a field (change the font, move it, etc.), you first have to select it:

  • Position the cursor inside the object frame and click once. The handles appear, indicating the object is selected.
  • Move the cursor away from the object frame and click in an empty part of the window. The handles disappear.

That's all it takes to select and deselect objects.

Resizing fields

To resize the field, follow these steps:

  1. Click the Customer Name field in the Details section to select it.
  2. Press the Ctrl key and click the field heading to select both objects.
  3. Move the cursor over the resizing handle on the right edge of the fields until the cursor turns into a Resizing cursor.
  4. Resize the fields to the left until they are approximately two inches in length.


Reviewing your work

Now let's see how the report looks with three fields placed and positioned.

  1. Click Print Preview on the Standard toolbar to activate the Preview tab.

    The screen should look similar to this:

    Note: The first time you preview a report, you must click Preview on the Standard toolbar to activate the Preview tab. The Preview tab appears to the right of the Design tab. You can then switch between designing and previewing the report by clicking the corresponding tab.

    You have the beginnings of a customer list report, but you still have several fields to add.

  2. When you are finished reviewing the report, return to the Design tab by clicking it.


Displaying field names

Field pictures (object frames containing character representations) have been discussed, but there may be times when you want to see the field names in the Design tab.

To display field names
  1. On the File menu, click Options.

    The Options dialog box appears with the Layout tab active.

  2. Select the Show Field Names check box and click OK.

    Now in the Design tab you will see the actual field names instead of character representations (X, $, #, etc.).


Combining database fields in a text object

Instead of adding the Contact First Name and Contact Last Name fields as separate objects, you can insert both fields in a text object. This allows you to control the formatting of both fields by making changes to only one object. When you insert fields in a text object, the fields are automatically trimmed (they do not have any extra white space on either side). This is important because a field is a fixed size but the data in the fields can vary in size, leaving various amount of unwanted white space.

To combine fields in a text object
  1. Click Insert Text Object on the Standard toolbar. As you move the cursor over the report, an object frame appears next to it.
  2. Insert the field to the right of the fields in the Details section.

    As you drag the field, the Design tab automatically scrolls to the right, if necessary. When you click to place the object, a text object appears and the horizontal ruler of the Design tab changes to a ruler/tab selector that is used for editing the text object. If you click an empty area of the report or a field object, the standard Design tab ruler appears.

  3. Click once on the border of the text object to select it for resizing. Handles appear on all sides of the object.
  4. Move the cursor over the right sizing handle of the text object and increase the width by about 1 inch. You may need to scroll to the right and continue resizing.
  5. Double-click inside the text object to select it for editing. Notice the insertion point is now flashing within the text object.
  6. Highlight the Contact Last Name field in the Field Explorer dialog box. Remember, you can move the Field Explorer dialog box by dragging and dropping it by its title bar.
  7. Drag the field to the text object.
  8. Move the cursor over the text object until the cursor becomes a Drag and Drop cursor.
  9. Click once to place the field in the text object. The cursor now appears after the Contact Last Name field, within the text object.
  10. Type a comma and a space after the Contact Last Name.
  11. In the Field Explorer dialog box, highlight the Contact First Name field.
  12. Drag the field to the text object.
  13. Move the cursor over the text object until the cursor becomes a Drag and Drop cursor. Move the cursor to the right of the comma and space you just typed, and click once. The field will be inserted to the right of the comma and space.
  14. You are finished inserting fields, so Close the Field Explorer dialog box.
  15. Click the Preview tab to look at the fields you just placed.

The report should now look similar to this:


Adding summary information

The next step is to add summary information to your report. Adding summary information allows you to specify the author, title, and subject of the report, as well as any keywords or comments related to the report. If a template is used when creating the report, you can specify that as well. When you add summary information, users can find information related to the report quickly.

To add summary information
  1. On the File menu, click Summary Info.

    The Document Properties dialog box appears with the Summary tab active.

  2. Enter information about your report in the text boxes provided. Be sure to enter the title "Customer List" in the Title text box. This information will be used in the next section of the tutorial.
  3. Click OK when finished.


Adding a title

As you can see, the report looks incomplete without a title. Although you can add a title using a text object, you can also tell the program to take the title information directly from the Title text box in the Document Properties dialog box.

To add a title
  1. Click the Design tab.
  2. On the Insert menu, click Special Field.
  3. Choose Report Title from the Field Explorer dialog box.
  4. Move the cursor over the report. An object frame appears.
  5. Position the object frame in the upper left-hand corner of the Page Header (PH) section of the report and click once to place the object.
  6. Click the Preview tab to review your changes.

The report title object now displays the title that you entered in the Title text box of the Document Properties dialog box.


Formatting objects

Now you can format the report title. This time, however, you will remain in the Preview tab to do the work. This will make it easier to see your work while you are formatting the title.

To format an object
  1. To center the title, you will first need to expand the Title field box so that it's about the same width as the data in your report. To do this, select the object by clicking it.
  2. Position the cursor on the right edge of the object until the cursor turns into a Resizing cursor. Drag the right edge of the field box until it is even with the right edge of the data in the Contact Name field object.

    You have created a large field that extends from the left edge to the right edge of the report.

  3. With the report title object still selected, click Align Center on the Formatting toolbar. The title is centered within the object.
  4. Right-click the object and choose Change Font from the shortcut menu. The Format Editor appears with the Font tab active.
  5. Set the report title to a larger, bolder version of the active font by selecting Bold from the Style list and 16 (or a point size suitable to the font you are using) from the Size list.
  6. Change the color of the text by selecting Maroon from the Color list. Notice that the Sample box shows an example of how the text will look.
  7. Click OK when finished.
  8. Resize the report title object vertically to accommodate the increased size of the title.

The title is now formatted to stand out on the report.


Adding a field heading

As you can see, the Contact Name field is the only field without a heading. In this section you will create a heading using a text field.

To add a field heading
  1. Click the Design tab to return to it.
  2. Click Insert Text Object on the Standard toolbar. As you move the cursor over the report, an object frame appears next to it.
  3. Place the object in the Page Header (PH) section, above the contact name object.
  4. Type "Contact Name" (without the quotation marks) in the text object edit box.
  5. While the text object is still in edit mode, highlight the field heading.
  6. Click Underline on the Formatting toolbar.

The Contact Name field now has a heading that looks just like the other field titles.


Saving the report

  1. Click Save on the Standard toolbar to save your work. Since this is the first time you are saving the report, the Save As dialog box appears displaying the default directory where the file will be saved.
  2. Type Custlist.rpt in the File name box and click Save. Your report is saved to the default directory or another directory you chose.
  3. Click the Preview tab to view the report.

The report should now look similar to the following:

Congratulations! You have just created a basic listing report. You will continue to refine this report throughout the rest of this tutorial.


Record Selection

Seagate Crystal Reports allows you to limit or restrict the records that are to be included in a report. In this section you will learn how to:

  • select the records you want included in the report
  • save a report, including the selection criteria.

For example, it may be useful to have a customer list that only lists customers from the USA. The sample data contains records from the United States and International customers. It is easy to restrict lists like this using the Select Expert. See Record Selection.

Entering the selection criteria

When you scroll through the report, you will see that it contains information for customers from many different countries. In this step, you will limit the number of countries displayed to the USA.

To enter selection criteria
  1. To begin, click the Design tab to return to design mode.
  2. Click an empty area of the report to make sure all fields are deselected.
  3. Click Select Expert on the Standard toolbar.

    The Choose Field dialog box appears.

    This dialog box lists all the fields currently in the report in the Report Fields section and then lists all fields that are available from each table in the database fields section.

  4. Since you are going to base record selection on the country field, highlight {Customer.Country} in the Fields list and click OK.

    The Select Expert appears.

    Imagine that you are completing the following sentence:

Select all records where a customer's country is

You complete the sentence with the condition you want the program to use when selecting records for your report. Right now the condition is any value, which implies there is no restriction on the record selection.

  5. Click the arrow on the operators box to see what other options you have. Since you want only those records where the Country is USA, select the is equal to condition.

    A new box appears on the right. The dialog box sentence now reads:

Select all records where a customer's country is equal to

All that you need to complete the sentence is the value USA.

  6. Click the arrow on the empty list. A list of all the country values appears. Select USA from the list.

    The sentence now reads:

Select all records where a customer's country is equal to USA

  7. Click OK to return to the Design tab.
  8. Click the Preview tab to review the results of your work.

    The Change in Record Selection Formula Detected dialog box appears.

  9. Click Refresh Data.
  10. Save this version of the report without overwriting the original report by choosing Save As from the File menu and giving the new report the name USA.rpt.

Congratulations! You have started formatting your report and have added selection criteria to it. More than that, you have learned how to manipulate your data. By now, you have a good idea of the powerful kinds of reports you can prepare.

Deleting a field

Now that the report contains only records from the USA, displaying the Country field in the body of the report is not necessary. You can delete this field before continuing.

To delete a field
  1. Select the Country field and the Country column heading using the Ctrl-click combination.
  2. Press Delete on your keyboard.

That is all it takes to delete fields from the report.

The report should now look similar to this:


Balancing field spacing

Now that the Country field has been deleted, there is a large amount of white space between the City and Contact Name fields. You might be satisfied with the spacing as it stands, but it might be more readable if the columns were better balanced across the page.

To balance field spacing
  1. Return to the Design tab. Select the Contact Name field and its field heading by using the Ctrl-click combination.
  2. Place the cursor over one of the two highlighted text objects and drag them to the left, closer to the City field.
  3. Click the Preview tab and review your work again.

    The report should look similar to this:

The spacing between the fields is much better, but it looks as if the report title is off-center.

  4. Click the report title object to select it.
  5. Position the cursor on the right handle of the object until the cursor turns into a Resizing cursor. Drag the right edge of the object frame until it is even with the right edge of the data in the Contact Name field object.

    The report title automatically recenters itself based on the size of the object.


Grouping and sorting

Reports can be grouped and sorted in a variety of ways. Sorting and grouping tools provide a great deal of flexibility for customizing reports.

Grouping the report

In many reports you need to break the data into groups in order to make it easier to read and to understand. Seagate Crystal Reports lets you do this easily. For this customer list, you will group the customers by region and then sort the customers alphabetically within each group.

To group a report
  1. While on the Design tab, click Insert Group on the Supplementary toolbar.

    The Insert Group dialog box appears.

  2. Select Region from the Customer table in the first drop-down list. The program takes all records with the same value in the region field and place them together in a group on the report.
  3. Select in ascending order from the second drop-down list. The region grouping will be displayed on the report in alphabetic ascending order.
  4. Click OK.

    Notice that two new sections now appear in the Design tab: GH1 (Group Header) and GF1 (Group Footer). This is how the program shows that the report has been grouped.

  5. Click the Preview tab to see what the report looks like.

  6. If the group tree is not visible, select Toggle Group Tree on the Formatting toolbar to see the groups included in the report.

You can view the group of interest by clicking on the group name in the Group Tree. For example, to see the Texas customer group, click TX in the Group Tree. The program jumps to the Texas group, displaying that group in the Preview tab. The Group Tree allows you to quickly jump to a specific group of interest instead of scrolling through the report looking for the group. For more information on the group tree, see Group Tree view.

Note: For many reports, you will want to insert summaries, subtotals and grand totals. For example, when creating a sales report rather than a customer list, you would want to calculate the total sales amount for each region. See Sorting, Grouping, and Totaling.


Understanding "live" group headers

When a group is inserted, a group name field is automatically inserted in the Group Header section of the report. The group name field displays the current group's name. For example, if you group by region, and preview the report, the group header for the CA (California) group shows "CA."

The group field name is automatically formatted to stand out from the records in the group.


Sorting records

In a typical customer list report, customer names are listed alphabetically. In this example, you will sort the customer names alphabetically within each region.

To sort records
  1. While on the Preview tab, click Sort Order on the Standard toolbar.

    The Record Sort Order dialog box appears.

    The Report Fields list box displays all fields currently on your report. You can choose to sort based on any of these fields.

    The Sort Fields list box displays the fields that are already sorted in the report. Since the region field has already been sorted, the sorting you are about to do will be within each region, and not for the entire report.

  2. Highlight the Customer Name field and click Add. Notice that the Customer Name field now appears in the Sort Fields list box.
  3. Select Ascending for the Sort Direction and click OK.

    The report should now look similar to the following:

Notice that the records within each group are in alphabetic order.


Completing the report

You have just one step left to complete the report. A company logo needs to be added to the first page of the report.

Inserting a company logo

In this section, you will place a company logo at the top of the first page of the report.

To insert a company logo
  1. While on the Design tab, click Insert Picture on the Supplementary toolbar.

    The Open dialog box appears.

  2. Choose the Xtreme.gif and click Open. An object frame appears as you move the cursor over the report. The object frame represents the logo you will place.
  3. Position the object frame in the upper left-hand corner of the Report Header (RH) section of the report and click once to place it.

    Placing the logo in the Report Header (RH) section ensures that the logo is printed only on the first page of the report.

    Note: Although there does not appear to be enough room in the Report Header (RH) section when you place the graphic, the section will automatically expand to accommodate the picture.

  4. Click the Preview tab to view the report.

    The final report should look like this:

  5. Save the report by clicking Save on the Standard toolbar.

You have just completed your first report. It is an impressive report, and Seagate Crystal Reports made it easy to do.

Related topics

For information about distributing reports (printing, exporting, etc.) see the printing topics in Formatting and Distributing and Viewing Reports.


Quick start for advanced users

If you are an experienced Windows user who wants to get right into the program, follow these steps to set up a report for the first time.

If you're not an experienced user, check the Quick start for new users.


Choosing a report type and data source

  1. In Windows, click Start, point to Programs, then select Seagate Crystal Reports.
  2. Click As a Blank Report and OK to open the Data Explorer dialog box.

    As an alternative to creating a blank report, you can choose one of eight report experts. View style samples for each by selecting from the list of experts.

    After choosing an expert, the Report Expert appears. You can build your report on a database, a query or a dictionary.

    Choosing Crystal SQL Query or Crystal Dictionary allows you to search for the appropriate file. Choosing Database opens the Data Explorer dialog box.

  3. Browse through the contents of the Data Explorer to find the database tables you want to use for your report.
  4. Select a table you want to use in your report and click Add.
  5. After you have added all the tables you want to work with, click Close on the Data Explorer.

    The Design tab appears with Report Header, Page Header, Details, Page Footer, and Report Footer areas. A report is created by inserting and formatting items in each of these areas.

Note: To use additional database tables for a report and match them up on a record-by-record basis, click Link Expert on the Supplementary toolbar, select the table(s), and then set up the links in the Visual Linking Expert when it appears.


Working with report elements on the Design tab

  1. Each of the default report areas contains a single section. To add additional sections, click Section Expert on the Standard toolbar and use the Section Expert to add the desired sections.

    Once you have added sections to an area, you can move, merge, and delete them in the Section Expert. See Using guidelines.

  2. To turn the grid on and off, choose the Options command from the File menu and select or clear the Show Grid in Design check box in the Options dialog box when it appears. See Using the grid.
  3. If you are working with the grid off and you want to use snap-to guidelines for positioning objects, click the top or left ruler wherever you want guidelines to appear.

    Some further ways you can use guidelines:

      • drag a field to a guideline until it snaps to the guideline
      • drag the guideline arrow to move the guideline (and any objects that are snapped to it)
      • drag the guideline arrow away from the ruler to remove the guideline. See Using guidelines.
  4. If the Field Explorer dialog box is not visible, click Insert Fields on the Standard toolbar.

    The Field Explorer dialog box appears with Database Fields selected. Expand the active database table(s) to display a list of fields. To speed the entry of multiple fields, this box will remain on-screen until you click Close. This dialog box can be moved to a new location or resized, if you wish. See Placing data on the report.

  5. Select the field(s) you want to appear on the report.

    You can select and place them one at a time, or use the Shift-click combination to select a number of contiguous fields, or the Ctrl-click combination to select fields from the list at random. Drag and drop is also active. Place the fields in the Details section where you want them to appear.

    When you place multiple fields, they appear in the same order that they appear in the Field Explorer dialog box. The program marks the position of each field with a rectangular frame. The characters in the frame indicate whether the field is text (xxx...), number (555...), currency ($555...), date (12/31/99), time (00:00:00), datetime (12/31/99 00:00:00), or Boolean
    (T/F).

    Note:

      • The field names and field types can be viewed by selecting the Show Field Names check box on in the Options dialog box (Layout tab).
      • The program automatically places field titles in the Page Header section unless the Insert Detail Field Titles check box is not selected in the Options dialog box (Layout tab).
      • If additional Details sections are added to the report, field titles will only be placed in the Page Header section for fields in the Details A (the original) section of your report.
  6. Once the objects are in place, you may want to adjust the report sections. To do this, right-click the shaded area to the left of the section ruler and use the shortcut menu that appears:
      • to expand a section to accommodate an additional line, choose the Insert Line command
      • to have the program automatically align the objects in the section horizontally, choose the Arrange Lines command
      • to reduce the size of a section to eliminate unnecessary white space above and below objects, choose the Fit Section command. See Using white space between rows.
  7. To create a report title, you must first enter the title in the Document Properties dialog box. On the File menu, click Summary Info. Enter a title in the Title text box of the Document Properties dialog box. Click OK.
  8. Choose Report Title from the Special Fields list in the Field Explorer. A rectangular placement frame appears when you move the cursor over your report. Click once in the Report Header (RH) section to place the report title. The report title field contains the text that you typed in the Title text box of the Document Properties dialog box. See Adding a title page to the report.
  9. To see how the results will print, click Print Preview on the Standard toolbar.

    To speed processing time while building a report, you can preview the report using only a small subset of the available data. To do this, go to the File menu, point to Print and then click Preview Sample. See Preview tab.

    In either case, the program takes you to the Preview tab. You can fine-tune a report in the Preview tab while viewing the results as actual report data. You can also close the Preview tab and continue working on the report in the Design tab.


Using other reporting features

  1. If you want to format a field, change the placement or width of a field, or insert a subtotal or grand total, click the field to select it. Handles appear on the top, bottom, and sides of each selected field:
      • To change the placement of the field(s), use the mouse to drag the field placement frame to its new position.
      • To change the width of the field, use the mouse to drag the right or left handle.
      • Right-click the field to format font, alignment within field, number, currency, date display, border, color, indentation, or to summarize the field. A shortcut menu appears listing various commands for formatting and summarizing the field.

        Note: To apply formatting only under certain conditions, click Conditional Formula next to the formatting property in the Format Editor, and create a formula that defines those conditions. See Working with conditional formatting.

  2. To create a formula that makes data calculations or comparisons, click Insert Fields on the Standard toolbar. When the Field Explorer dialog box appears, select Formula Fields.
  3. Click New. The Formula Name dialog box appears. Enter a name for the formula and click OK. The Formula Editor appears.
  4. Enter the formula in the Formula Editor. Enter fields, operators, and functions by selecting them from their respective lists or by typing them in. You can check the formula syntax by clicking Check.
  5. When you are finished editing, click Close to return to the Field Explorer dialog box. Click Insert to place the formula just like you would a database field. See Using Formulas.
  6. To insert a subreport (a report within a report), click Insert Subreport on the Supplementary toolbar and choose an existing report to import as a subreport or use the Create Report Expert to create a new subreport. See Inserting subreports.

    If you want the records in a subreport to match up with the records in a primary report, click the Link tab of the Insert Subreport dialog box and specify the link in the Subreport Links dialog box when it appears. See Linking a subreport to the data in the primary report.

  7. To insert a cross-tab object in a report, click Insert Cross-Tab on the Supplementary toolbar and set up the cross-tab in the Format Cross-Tab dialog box when it appears. See Cross-Tab Objects.
  8. To create a parameter field (a field that prompts you for a value whenever you retrieve data for a report), click Insert Fields on the Standard toolbar, then select Parameter Fields in the Field Explorer dialog box when it appears. Click New to set up a parameter field. Once created, you can insert the parameter field in a report like a database field or select it from the Fields list in the Formula Editor.

    Parameter fields can be used in reports (as title or label prompts), in selection formulas (as selection criteria prompts), and in formulas (for a variety of purposes including specifying sort fields). See Parameter Fields.

  9. To add a chart, click Insert Chart on the Standard toolbar. See Charting.
  10. To add a map, click Insert Map on the Standard toolbar. See Mapping.
  11. To insert a spreadsheet, picture, or other OLE object that you can edit from within the Report Designer using the tools from the object's native application, choose OLE Object from the Insert menu. See OLE, and Working with static OLE objects.
  12. To change the record sort order, click Sort Order on the Standard toolbar. The Record Sort Order dialog box appears. Highlight the field(s) you want to use for sorting the report data and the sort direction. See Sorting single and multiple fields.
  13. To limit the report to specific records (for example, the records of California customers who have year-to-date sales greater than $10,000), click the first field on which you want your selection to be based and then click Select Expert on the Standard toolbar. When the Select Expert appears, set up the record selection criteria.
  14. To print the report, click Print on the Standard toolbar.

That's it! It is that easy to build a report.


Report Design Concepts

This section describes the basic concepts of report design and helps you decide what information you want to include in your report.


Basic report design

The purpose of this section is to suggest a structured approach to preparing a Seagate Crystal report. This approach includes the following elements:

  • deciding on the content of the report
  • developing a prototype on paper.

This section has been designed to provide a conceptual understanding of the reporting process.

Additional Resources

The Getting Started Guide is available in HTML format and contains easy to follow steps to get you up and running with Seagate Crystal Reports 8.

Seagate Software's Community Site has an education section where you can view a multimedia tutorial that walks you through basic report creation and design.

http://www.seagatesoftware.com/ipl/default.asp?product=SCRHelp&version=8&language=EN&destination=education


Deciding on the content of the report

Before you do anything else, you should outline the information you want the report to provide. The following questions can act as a guide in making that outline.

Stating the purpose

What is the overall purpose of the report?

Reports are management tools. Their purpose is to help you quickly grasp the essential elements and relationships found in raw data, to help you make effective decisions. For a report to be effective, it has to present the correct data in a logical way. If it presents the wrong data, or if it presents the right data in a haphazard manner, the report may slow the decision-making process or may even encourage incorrect decisions.

A good starting place in the development of a report is to write out the purpose of the report in a sentence or two. The purpose statement helps you focus on your primary needs, and it gives the report both a starting point and a goal. Here are some examples of purpose statements.

  • The purpose of this report is to show monthly and year-to-date sales by sales representatives, compare this year's numbers to last year's, and flag representatives whose sales figures do not meet company standards.
  • The purpose of this report is to show sales activity for each item in inventory, and to suggest reorder quantities based on that activity.
  • The purpose of this report is to calculate bowling averages and handicaps for each member of the bowling league.

Defining the purpose of the report before you start is a critical step in the overall process.

Who is going to read the report?

A single report is often used by many individuals. A detailed, company-wide sales report, for example, may be used by sales representatives, the regional sales manager, the national sales manager, and the Chief Operating Officer (COO).

These individuals will be interested in different aspects of the report:

  • A sales representative will use the report to evaluate individual sales performance and compare this performance to that of other representatives in the region.
  • The regional sales manager will use the report to evaluate regional representatives and compare the region's performance to that of other regions.
  • The national sales manager will use the report to evaluate the performance of regional managers and compare overall sales to the current sales forecasts.
  • The COO will use the report to evaluate the performance of the Vice-President of Marketing and the sales department as a whole, and to project such things as manufacturing needs and warehouse locations.

Since each user of the report has different interests, it is important to plan the report so it includes the information each user is looking for.


Determining the layout of the report

What is the report title going to be?

Write out a working title for the report. You may decide to change it later, but at least you will have a title to use when creating the prototype report.

What identifying information is needed in the header and footer?

You may wish to include the current date, information on who prepared the report, a block of text to describe the purpose of the report, the range of data covered, or something similar. If you are going to include such information, write it down so you can use it in preparing your prototype.

The information can come from a variety of sources, depending on the kind of information you plan to use.

  • Information on who prepared the report might be drawn from individual data fields in the database table(s) used. If it is to be drawn from a database table, what table? Or, what combination of tables?
  • A block of text can be created as a text object and placed anywhere on the report.
  • Seagate Crystal Reports can generate information such as the current date or page numbers.


Finding the data

What data do you want to use in the report?

Do you know the type of database you are reporting from? Will you be reporting off a data file, SQL/ODBC, or a Dictionary?

If you do not know, ask the database administrator in your organization for help in setting up the database type and location of the data. See Accessing Data Sources.

Are you familiar enough with the data to find the necessary information? When looking for a Customer Contact name, can the field be found in a database table?

If not, your MIS professional, database administrator, or co-workers will have to help you become familiar with the data.

What specific data should appear in the body of the report?

The body should contain all the data needed to fulfill the statement of purpose you wrote for the report. It should also contain all of the data needed by the various users that you have identified.

This step requires you to look at the available database table(s). Seagate Crystal Reports allows you to combine data from different databases when you create reports, so you have a great deal of flexibility in your work.

  • Much of the data in a typical report is taken directly from data fields. Which data fields will be used, and where are they located?
  • Other data will be calculated based on data fields. Which data fields will be used in the calculations?
  • Still other data will be placed directly into the report using text objects (headings, notes, labels, and so on).

Does the data exist or does it need to be calculated?

Some report information can be drawn directly from data fields (sales information, for example); other information will have to be calculated based on data field values (for example, sales commission, based on the relationship of sales to quota). In your planning, it can be helpful to segregate or flag data that needs to be calculated from that which can be used directly. See Specifying Formulas.

What types of fields contain data?

You should take the time to get to know the data type for data fields that will be used in your calculations. Since formula functions and operators work with specific kinds of data, it is important to recognize the data type you are working with, before you start any calculations. For example, some functions require numeric data, while others work with only date or time fields. For more information on specific functions and operators, search for Functions Index and Operators Index, or for the function or operator by name in Seagate Crystal Reports online help.


Manipulating the data

Do you want the data organized into groups?

How? By customer? By date? By hierarchy? Or by other criteria? Seagate Crystal Reports provides several options for grouping data in a report. See Grouping data.

Do you want the data sorted based on record or group values?

Seagate Crystal Reports gives you both alternatives. See Understanding sort options.

Do you want the report to contain only specific records or groups?

Seagate Crystal Reports gives you the opportunity to base a report on all records in a given database, or on a limited set of records from the database. Seagate Crystal Reports can be used to select records based on simple date ranges or comparisons, or to create complex formulas to identify the records to be included. Take a few minutes to determine the records needed for the report and list the criteria to be used for selecting those records. See Selecting records.

Do you want to summarize the data?

Do you want to total, average, count, or determine the maximum or minimum value included in all the values in any column on the report?

Seagate Crystal Reports allows you to do this, and it also allows the grand total (or the grand total average, grand total count, and so on) to be placed at the bottom of the selected column. See Calculating a percentage and Selecting top or bottom N groups.

What information should be flagged on the report?

You may want to call attention to some data by flagging it on the report. For example, non-moving inventory items are often flagged on inventory reports so they can be given special attention. You might want to flag each item that has shown no activity during the last month, during the last three months, or during some other defined period. To flag information, identify it and any conditions that will trigger the flagging.

How do you want information flagged?

You may want to flag items with an asterisk or some other symbol, or you may want a word to appear as a flag. In any case, you should write out flagging instructions so they are handy.

Seagate Crystal Reports gives you the opportunity to underline report elements, and change the font type, size, or color used for specific report items. It allows you to put borders around items and to draw lines and boxes (to break the report into sections), set off headings, and so on. All of these formatting tools can be used to highlight key data on a report. See Formatting.


Determining printing area characteristics

Each report area has its own printing characteristics. It is important to understand these characteristics because they affect when and how often different report objects get printed.

In what order will the areas print on the report?

Areas print in the order they appear on the Design tab (top to bottom). If there is more than one section in an area, the sections print in the order they appear. For example, if you have three Report Header sections, all three of those sections will print, in order, before the section(s) in the Page Header area begin to print.

How often do report objects print?

The way objects print will determine how you design your report. This will help you decide where to place charts, Cross-Tabs, and formulas to get specific results.

Report Header

Objects placed in the Report Header area print once, at the beginning of the report.

  • Charts and Cross-Tabs placed in this area contain data for the entire report.
  • Formulas placed in this area are evaluated once, at the beginning of the report.
Page Header

Objects placed in the Page Header area print at the beginning of each new page.

  • Charts or Cross-Tabs cannot be placed in this section.
  • Formulas placed in this area are evaluated once per page, at the beginning of each new page.
Group Header

Objects placed in the Group Header area print at the beginning of each new group.

  • Charts and Cross-Tabs placed in this area contain data just for the group.
  • Formulas placed in this area are evaluated once for each group, at the beginning of the group.
Details area

Objects placed in the Details area print with each new record.

  • Charts or Cross-Tabs cannot be placed in this area.
  • Formulas placed in this area are evaluated once for each record.
Group Footer

Objects placed in the Group Footer area print at the end of each group.

  • Charts and Cross-Tabs placed in this area contain data just for the group.
  • Formulas placed in this area are evaluated once for each group, at the end of the group.
Report Footer

Objects placed in the Report Footer area print once at the end of the report.

  • Charts and Cross-Tabs placed in this area contain data for the entire report.
  • Formulas placed in this area are evaluated once, at the end of the report.
Page Footer

Objects placed in the Page Footer area print at the bottom of each page.

  • Charts and Cross-Tabs cannot be placed in this area.
  • Formulas placed in this area are evaluated once per page, at the end of each new page.


Developing a prototype on paper

While a paper prototype is useful regardless of your level of 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, rather than into trying to design and learn at the same time.

To design a paper prototype
  1. Get the same size paper you will be using for the finished report.
  2. Position the title and other descriptive header information, using boxes or lines to represent report elements.
  3. Position the footer information.
  4. Review the page layout for balance.
  5. Look at the information you intend to include in the body of the report.
      • Count the number of fields being used and estimate the appropriate spacing between fields.
      • Use rectangles to pencil in the fields within the 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.
  6. Use small boxes to indicate group values and totals.
  7. Place random flags in the column where you want flags to appear.
  8. Darken any elements you want highlighted to make them stand out from the rest of the prototype.
  9. Review the finished product for layout and balance, and make changes as needed.


Introduction to Reporting

This section shows you the basics of creating a report in Seagate Crystal Reports. First you'll learn about the report design environment, then about how to select database tables, place objects on a report, and how to sort, group, and total your report data.


Report creation options

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

  • use a Report Expert
  • use another report as a template
  • create a report from scratch.

You will probably use each option at some time.

Report Experts

The Report Experts help 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 reports step-by-step.

You can quickly create the report and see how it looks against the actual data. And best of all, if you then decide to make changes, you can get back to the Report Expert to further modify the report.

Another report

To build a new report based on one that already exists, another report can be used as a template. Open the report you want to use as a template by using the Open an Existing Report option and save it to a new file using Save As (found on the File menu). Use this option whenever you think templates can save time. Templates are useful to:

  • Create a new report with a different grouping or different record selection than that of an existing report.
  • Reconstruct a report based on an earlier time period using the same report structure used today.
  • 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.

New report

The As a Blank Report option is used to create a report from scratch. This is useful when you want the full flexibility and control of building a report from the ground up, or when a report type is different from the many report types available in the Experts.

The As a Blank Report option was chosen for the Quick start for new users, because the process of creating a report from scratch most fully illustrates the basics of reporting.


Report data sources

Seagate Crystal Reports provides three different data types:

  • Database (which includes ODBC and SQL data sources)
  • Query
  • Dictionary.

Database

In the Report Experts, choose the Database option to report on any of the standard (not client-server) PC databases, or any SQL or ODBC data sources.

Typically, the standard PC databases are those 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 Microsoft Access, dBASE, FoxPro, Clipper, Btrieve, and Paradox, among others. Once the program is installed on your system, you can immediately begin creating reports based on these databases by selecting the appropriate file.

See Accessing Data Sources.

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

  • an SQL server to create, store, and manipulate database files, tables, fields, and records
  • an SQL client interface, allowing workstation users to retrieve data.

See Using SQL and SQL databases.

Open Database Connectivity (ODBC) 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 ODBC files to instantly be able to work with any source of data that can be accessed by ODBC.

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

The Database option was chosen for the Quick start for new users, because the sample data, Xtreme.mdb, is a Microsoft Access database.


Queries

A query is 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), the 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 SQL Designer eliminates the need to understand SQL, it can get you building effective queries right away.

The SQL 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 SQL Designer helps create queries, even if you have no knowledge of SQL whatsoever. By answering a few questions on a set of sequential tabs, you provide the program with all the information needed to generate a query that fits your needs.
  • If you are an SQL professional, you will appreciate the facility that enables you to fine-tune the queries that the SQL 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 SQL Designer can be a powerful tool for many of your information gathering needs.

Note: The SQL Designer can only access data stored in an ODBC data source.


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)
  • 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 a dictionary is used to create a report the only data used in the report is data accessed through the dictionary. You cannot 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.
  • A subreport based on a different data source can be included in a primary report based on a dictionary.
  • Dictionaries are an optional metalayer. Seagate Crystal Reports can be used without ever using dictionaries.

See Dictionaries.


Choosing data sources and database fields

Seagate Crystal Reports makes it simple to select data sources and database fields by providing easy-to-use functionality in the Data Explorer dialog box and the Field Explorer dialog box. Each of these dialog boxes uses the familiar Windows tree structure to allow you to navigate through the possible choices.

The Data Explorer

The Data Explorer provides an integrated tree view of all data sources you can use with Seagate Crystal Reports. With the Data Explorer, you can:

  • create a report using one of the currently connected data sources
  • create a report based on a customized "Favorites" list of data sources (which you also maintain within the Data Explorer)
  • create a report based on a list of recently accessed data sources (that the Data Explorer automatically maintains for you)
  • create a report by connecting to an existing data source (for example, a data file residing locally, or an ODBC data source that has already been set up)
  • create a report by first creating a new connection (for example, a new ODBC data source, or an OLE DB File Data Link).

Tree View

The main window of the Data Explorer shows a tree view of possible data sources you can select when creating a report. The tree is made up of folders for:

  • Current Connections
  • Favorites
  • History
  • ODBC data sources
  • Database Files
  • More Data Sources
  • Dictionary / Query.

For a brief description of each of these folders, see Selecting the data source.


Shortcut Menu

You can right-click any item in the Data Explorer to see a shortcut menu with the following options:

  • Add Table
    Use this option to add a table or stored procedure to your new report. This option is also available by clicking the Add button on the Data Explorer.
  • Remove
    Use this option to remove a table or stored procedure from your report. This option is also available by clicking the Remove button on the Data Explorer.
  • Properties
    Use this option to obtain detailed information on the selected item.
  • Add to Favorites
    Use this option to add a selected data source to the Favorites folder. This option is also available by clicking the Add Favorite button on the Data Explorer.
  • Rename
    Use this option to rename a data source in the Favorites folder.
  • Delete
    Use this option to remove a data source from the Favorites folder.

Options

The Options button on the Data Explorer provides access to the options you can set globally on the Database tab of the Options dialog box.


The Field Explorer

Use the Field Explorer dialog box to insert, modify or delete fields on the Design and Preview tabs of Seagate Crystal Reports. You'll see the Field Explorer after you've selected a data source for a new report, or when you select Database Field, Formula Field, Parameter Field, Special Field, Running total field, or SQL Expression Field from the Insert menu.

Tree View

The Field Explorer shows a tree view of database fields and special fields that you can add to your report. It also shows formula fields, SQL expression fields, parameter fields, group name fields, and running total fields that you have defined for use in your report.

Fields that have already been added to the report, or fields that have been used by other fields (such as formula fields, groups, running total fields, summaries, and so on) have a green check mark next to them.


Toolbar and Shortcut Menu

The toolbar provides buttons with tool tips and hot-key combinations. You can right-click any item in the tree view to bring up a shortcut menu.

The toolbar and the shortcut menu offer these functions:

  • Insert to Report
    Use this option to add a field to the report. You can insert more than one field at a time by selecting multiple fields, right-clicking, and choosing Insert to Report.

    Alternatively, to insert a field, you can drag and drop it in the Design or Preview tabs.

  • Browse Data
    Use this option to browse data for a database field or formula field.

    When you right-click a database field, the shortcut menu has Insert to Report and Browse Data enabled.

  • New
    Use this option to create a formula field, SQL expression field, parameter field or running total field.
  • Edit
    Use this option to modify an existing formula field, SQL expression field, parameter field or running total field.
  • Rename
    Use this option to modify the name of an existing formula field, SQL expression field, parameter field or running total field.
  • Delete
    Use this option to remove a formula field, SQL expression field, parameter field or running total field. You can also select multiple fields, right-click, and choose Delete to remove them all at once.
  • Move Parameter Up (or Down)
    Use this option to change the order of parameter fields.

    When you right-click a parameter field, all the functions except Browse Data are enabled.

Group Name Fields

You can insert an existing Group Name field shown in the Field Explorer by right-clicking it and selecting Insert. Unlike a formula field, parameter field or running total field, however, you cannot create a Group Name field through the Field Explorer. (A Group Name field is created when you insert a group.)


About the report design environment

Design tab

When working with Seagate Crystal Reports, you will probably use the Design tab more than any other part of the program.

The Design tab is the place you do most of the initial work when creating a report. It designates and labels the various sections of the report. You can do the initial formatting, place objects in the sections where you want them to appear, specify sorting, grouping, and totaling needs, and so forth.

The Design tab provides a very efficient environment for designing a report because you work in the tab with data representations, not with data itself. When a field is placed on the report, the program uses a frame to identify the field on the tab; it does not retrieve the data. Thus, you can add and delete fields and other objects, move them around, set up complex formulas, and more, without tying up the computer or network resources needed to gather the data.

The report created in the Design tab is a kind of virtual report; it has the structure and instructions for creating the final report, but it is not the report itself. To turn the Design tab report into a final report or into a report that you can fine-tune, you "just add data." You do this whenever you preview the report, print it, or output it in any other way. The actual data will now appear in the report.


Design tab areas

When you first begin creating a report, Seagate Crystal Reports automatically creates five areas in the Design tab.

  • Report Header
    This section is generally used for the report title and other information you want to appear at the beginning of the report. It can also be used for charts and cross-tabs that include data for the entire report.
  • Page Header
    This section is generally used for information that you want to appear at the top of each page. This can include such things as chapter names, the name of the document, and other similar information. This section can also be used to display field titles above the fields on a report.
  • Details
    This section is used for the body of the report, and is printed once per record. The bulk of the report data generally appears in this section.
  • Report Footer
    This section is used for information you want to appear only once at the end of the report (such as grand totals) and for charts and cross-tabs that include data for the entire report.
  • Page Footer
    This section usually contains the page number and any other information you want to appear on the bottom of each page.

If a group, summary, or subtotal is added to the report, the program creates two additional sections:

  • Group Header
    This section typically holds the group name field, and can be used to display charts or cross-tabs that include data specific to the group. It is printed once at the beginning of a group.
  • Group Footer
    This section generally holds the summary value, if any, and can be used to display charts or cross-tabs. It is printed once at the end of a group.

When a group, summary, or subtotal is added, the Group Header area appears directly above the Details area and the Group Footer area appears directly below the Details area.

If you set up additional groups, the program creates new group areas between the Details area and the existing Group Header and Group Footer area(s).

Like the original areas, each of these newly added areas can contain one or more sections. By default, they each contain a single section.


Identifying and working with areas and sections

By default, each area contains only a single section. The name for that section appears directly to the left of the section. If you have multiple sections in an area, the sections are designated as a, b, c, and so forth.

Note:

  • Initials, such as RH, PH, D, PF, RF, and so on, are used to identify each section if you have selected the Show Short Section Names in Design check box on in the Options dialog box.
  • If you right-click the shaded area containing a section name, a shortcut menu appears with section-specific options. If you right-click the shaded area to the left of the section names, a shortcut menu appears with area-specific options.

The program displays a section ruler immediately to the left of each section. The section ruler is used to add, remove, and move guidelines, and to provide a visual reference when you are placing objects. See Using guidelines.

Whenever a new section is added, the program creates a ruler for that section. See Using multiple sections in reports.

Other Design tab capabilities

There are several other capabilities built into the Design tab. With the Design tab, you can:

  • Resize a section by dragging its boundary. See Resizing a section.
  • Split a section (create two sections from one) by clicking its left boundary. See Splitting a section.
  • Add horizontal and vertical guidelines by clicking the rulers. See Using guidelines.
  • Zoom in and out on a report at any magnification from 25% to 400% of the original size. See Undo/Redo activities.


Preview tab

To preview a report before printing it, click Print Preview on the Standard toolbar.

The program gathers the data, makes the necessary calculations, and displays the report in the Preview tab. With the data in place, you can review the spacing and formatting of your report and see the actual results of all your summaries, formula calculations, and record and group selections.

In true WYSIWYG (What You See Is What You Get) fashion, you can work directly on this live data, fine-tuning it until the report has the exact look you want.

The program works with data in the following manner:

  • the first time the Preview tab is used, it retrieves data from your underlying data source(s) and saves it with the report (unless you have set up the program not to save data)
  • from that point on, the program uses the saved data whenever you preview the report unless you specifically refresh it or add a field that requires the program to retrieve new data.

Seagate Crystal Reports provides two views for previewing a report:

  • Standard view
  • Group Tree view.


Standard view

In standard view, the report is displayed a page at a time. Using the navigation buttons in the Preview tab, you can move to the beginning or end of the report, or you can move backward and forward through the report one page at a time. For shorter reports or reports in which you're primarily interested in seeing the "bottom line" totals, the standard view provides all of the functionality you need.

The Data Age indicator

The Data Age indicator indicates the date the data was last refreshed or initially retrieved, whichever is the most recent. If the data was initially retrieved or refreshed today, it indicates the time it happened.


Group Tree view

The Group Tree view can be shown or hidden using Toggle Group Tree on the Formatting toolbar.

The Group Tree view presents a split screen:

  • the right pane displays the report
  • the left pane displays a high level outline of the report, showing the hierarchy of groups and subgroups in a familiar tree format.

The Group Tree normally displays the names of the groups and subgroups you created in your report. You can, however, customize these names using the Group Options section of the Insert Group or Change Group Options dialog box. For more information on customizing Group Names in the Group Tree view, see Grouping data.

When you click the tree node for the group that interests you, the program jumps immediately to the part of the report that contains the information for that group. For longer reports or reports in which you wish to jump back and forth between different groups, the Smart Navigation features of the Group Tree view make your work extremely efficient.


Comparisons with the Design tab

You have the same formatting capabilities in the Preview tab as you do in the Design tab. Menus (both menu bar and shortcut menus), the Standard and Supplementary toolbars, and the Formatting toolbar remain active, providing essentially the same functionality you have when working with a report in the Design tab. However, when you are making numerous changes, it is quicker to make the changes in the Design tab. Some additional things to consider are:

  • The Design tab and Preview tab are tied together internally. Any changes made in one are reflected in the other.
  • The Preview tab has a single vertical ruler at the left of the tab rather than the individual section rulers seen in the Design tab. The functionality of the ruler is the same.
  • The Preview tab identifies report sections in the shaded area to the left of the data. With a quick look you can tell which report section the data is printing from. While section names appear only once in the Design tab, they print each time a section prints in the Preview tab.
  • The Record counter, the Data Age indicator (see The Data Age indicator), and the Page Forward/Page Back controls (see Preview tab), are all active in the Preview tab.
  • The Preview tab highlights every value when you select a field; whereas, only the field frame is highlighted in the Design tab.

Working in the Preview tab has a different feel from working in the
Design tab.

Each field in a database contains dozens, hundreds, or even thousands of values, depending on the number of records in the database. When you place a field in the Design tab, a single field frame represents all those values. When you highlight the field, sizing handles appear on the frame and the frame changes color.

In the Preview tab, however, you are working with the actual data. Instead of a field frame representing many field values, the values themselves appear. Some additional things to consider are:

  • When you highlight a field or formula field value, you are actually selecting every value in the field
      • the program places a sizing frame around the specific value you select
      • it highlights every other value in the field.
  • Likewise, when you select a summary value, you are actually selecting all the related summary values
      • the program places a sizing frame around the specific value you select
      • it highlights all the related summary values.

Aside from the differences in appearance, the process of building and modifying a report is the same in both the Design tab and the Preview tab. You should find it easy to work with your reports in both places.


Creating a new report

Selecting the data source

After deciding which option you want to use for creating your report (see Report creation options), the next step is to select a data source to use.

Most data sources can be chosen through the Data Explorer dialog box. The Data Explorer appears when you choose Database in a Report Expert, or when you create a report from scratch using As a Blank Report.

Note: This procedure uses the Report Experts to show you how to select a data source. The Data Explorer dialog box is used the same way for reports created from scratch.

To select the data and start a new report
  1. On the Standard toolbar, click New Report.

    The Seagate Crystal Report Gallery appears.

  2. Double-click the Expert for the type of report you want to create.

    The first tab in each Expert (except the OLAP Expert) is a Data tab. Use the options on this tab to select your data source through the Data Explorer dialog box (Database), or the File Open dialog box (Query and Dictionary).

  3. On the Data tab, click Database.
  4. Use the tree view of the Data Explorer to select your data source:
      • Current Connections shows a list of data sources you are currently connected to.
      • Favorites shows a list of data sources you commonly use and have maintained in your Favorites list.
      • History shows a list of data sources you have used recently. The last five data sources used are displayed.
      • ODBC shows a list of ODBC data sources you have already configured for use. You can use Create New Data Source to configure a new ODBC data source.
      • File Data Sources shows a list of standard PC databases that reside locally. You can use Find Database File to browse for a PC database using the Open dialog box.
      • More Data Sources shows a list of other data sources that can be accessed through OLE DB and native drivers.
Related topics

Accessing Data Sources.

Selecting a query for a report.

Using a dictionary.


Linking multiple tables

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

The majority of 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 Linking tables.

Note: It isn't necessary to link tables in reports created from a query because any links required by the data have already been processed.

To add and link multiple tables
  1. Choose Add Database to Report from the Database menu.

    The Data Explorer dialog box appears.

  2. Select the new database you want to use in the report. See Selecting the data source.
  3. Click Close when finished with the Data Explorer.

    The Visual Linking Expert appears and displays the databases currently available for linking.

    Note: If Auto-Smart Linking is selected on in the Database tab of the Options dialog box, you will not need to manually create links between the tables. See Linking tables.

  4. To create links manually, drag a field from one table to a field in another table. If successful, a link line is created. If unsuccessful, a message is issued.

Note: You can link tables by table name or by foreign key information.

  5. To link databases automatically, click Link.
  6. To specify the tables, click Add/Remove Tables.
  7. Click OK when finished.

    Note: When manually creating links, the field you are linking "to" must be an indexed field. For more information on indexed fields and tables, see Indexed tables.

    The Visual Linking Expert closes, and you are returned to your report. The linked databases are now available for use in your report. If you are not satisfied with the link, you can modify it using the Visual Linking Expert.

Related topics

Understanding Databases.

SQL join types (ODBC data sources).


Placing data on the report

Placing data on a report is a very important task. You need to know what type of data should be placed on the report and where on the report it should be placed.

Database fields

Much of the data placed on a report are database fields, displaying data as it is stored in the database. For example, in the Quick start for new users, the Customer Name, City and Country fields are placed on the report. Normally, database fields will be placed in the Detail section, but under certain circumstances, they will be placed in other sections of the report.

To insert a database field
  1. On the Standard toolbar, click Insert Fields.

    The Field Explorer dialog box appears with Database Fields selected. All the fields in the chosen database(s) are listed. To speed the report building process, this dialog box remains on-screen until you click Close. You can move this dialog box wherever you wish.

  2. Select the field you want to appear in the report.
  3. Click Insert to Report to place it in the report.
  4. Click Browse to review the values in the selected field.


Text objects

Text objects are used in reports for a multitude of purposes. They are a powerful way of inserting titles; labeling summaries and other data on your report; and of easily combining database fields. For example, in the Quick start for new users, 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.

To insert a text object
  1. On the Standard toolbar, click Insert Text Object. An empty object frame appears.

  2. Position the text object where you want it to appear in the report.

    Click once on the border of the text object to select it for resizing and moving.

    Double-click inside the text object to select it for editing. The Design tab ruler changes to a text object ruler sized to the length of the selected object. To the left, a tab indicator appears.

The ruler allows you to add indents and align text within the text object. By clicking the tab indicator, you can cycle through the four tab options available.

Note: When you first insert the text object into the report, the object is automatically selected for editing.

To insert a database field in a text object

The primary function of a text object is to hold text. However, text objects can hold database fields as well, making them ideal for creating custom form letters.

  1. Insert a text object in the report.

  2. Type in the text and spaces that you want to appear before the first database field (if any).
  3. On the Standard toolbar, click Insert Fields.

    The Field Explorer dialog box appears with Database Fields selected.

  4. Highlight the database field to be inserted and drag it into the text object. As you move the Drag and Drop cursor over the text object, the program displays a movable insertion point.

  5. Drag the object so the insertion point is where you want the database field to appear and drop the field.


Special fields

To display information such as Page Numbers, Print Date, and Report Comments use the commands in the Special Fields tree view of the Field Explorer dialog box.

To insert a special field

Seagate Crystal Reports allows you to easily insert Page Number, Record Number, Group Number, Print Date, and Total Page Count fields, among others, into your report.

  1. On the Standard toolbar, click Insert Fields.

    The Field Explorer dialog box appears with Database Fields selected.

  2. Scroll down to Special Fields and expand it by clicking.

  3. Choose a command from the Special Field list to insert in the report.

    Each special field is inserted into the report as an object. An object frame appears. You can now place it on the report.

Note: To change the formatting of an inserted object, click the object to select it and click Object Properties on the Supplementary toolbar. The Format Editor appears where you can make the desired changes. See Formatting.


Formula fields

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

Running total fields

To display a total that evaluates each record and provides a running sum of all the values in a field (or all the values in a certain set of values), a running total field needs to be created and placed in the report. If the first three values in a field were 2, 4, and 6, a running total would print 2, and then 6 (the sum of 2 + 4), and then 12 (the sum of 2 + 4 + 6). See Running Totals, for an introduction to running totals.

Picture fields

When designing reports, there will be times when you want to include a picture. For example, you may wish to put a company logo in the report header.

To insert a picture
  1. On the Supplementary toolbar, click Insert Picture.

    The Open dialog box appears.

  2. Select the desired picture file from the file list and click Open to return to the report.

    An object frame appears with the picture inside, ready to be positioned.

  3. Position the picture object where you want it to appear in the report and right-click once.

SQL Expression fields

SQL expressions are like formulas, but they are written in Structured Query Language (SQL), not in the Seagate Crystal Reports formula language. An SQL expression can be used to query the database for specific sets of data. You can sort, group, and select based on SQL expression fields. See The Crystal SQL Designer, for an introduction to SQL expressions.

When an SQL/ODBC data source is used to design a report, the program adds SQL Expressions Fields to the Field Explorer dialog box. This new option allows SQL expressions to be entered in the Field Explorer and then inserted into a report quickly and efficiently.

To create an SQL Expression field
  1. On the Standard toolbar, click Insert Fields.

    The Field Explorer dialog box appears with Database Fields selected.

  2. Scroll down to SQL Expression Fields and double-click it.

    The SQL Expression Name dialog box appears.

  3. Enter a name in the Name box, and then click OK.

    The SQL Expression Editor appears.

    Note: The SQL Expression Editor functions in the same way as the Formula Editor. For a discussion of these tools seeFormula components and syntax.

  4. Type the expression in the SQL Expression Editor.
  5. Click OK.


Hyperlink fields

You can select an object on the Design or Preview tab and create a hyperlink to a web site, a local HTML file, a field value, an e-mail address, or another Seagate Crystal Report file.

The hyperlink is saved with your report and is available to other users as a way of viewing additional information.

To create a hyperlink field
  1. Select a report object on the Design or Preview tab.

    Note: If you want to create a hyperlink to another Seagate Crystal Report file, do not select a report object.

  2. On the Insert menu, click Hyperlink.

    The Hyperlink tab of the Format Editor dialog box appears.

  3. Click the type of hyperlink you want to create. The available types are:
      • A website on the Internet
      • A file
      • Current field value
      • An e-mail address
      • Another Crystal Report file
      • No hyperlink.

        Note: Not all hyperlink types are available at all times. The object you select and its location on the report determine which types are available.

  4. After you have chosen a hyperlink type, enter the appropriate hyperlink information (the URL of a web site, for example).
  5. Click OK when you are finished.

The hyperlink is inserted as appropriate. Click it on the report to go to the appropriate site, e-mail address or other report.

Note: If you create a hyperlink to another Seagate Crystal Report file, you are creating an on-demand subreport (see Subreports). Just as one subreport cannot contain another subreport, you cannot create a hyperlink between two subreports.


Formatting data

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 Quick start for new users, you format the title, add a text object to identify the Contact Name information, and insert the company logo. See Formatting.


Record selection

Record selection, the task of paring down the data 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 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 Quick start for new users, has information from both United States and international customers. Record selection is used to create a report listing only customers in the United States. See Record Selection and Grouping data.


Grouping, sorting, and summarizing data

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

Grouping records

To organize the data, you may want to group related data together. For example, in the Quick start for new users, after grouping the Customer List by region, you will divide the list into regional groups. That way, a sales manager for the California region could quickly locate the California group and focus exclusively on the customers within that region. See Grouping data.

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 Quick start for new users, 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 Sorting single and multiple fields, and Sorting records within groups.

Summaries, subtotals, and grand totals

Many reports use some sort of totaling. 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 state (average summary on the sales field) and calculate the number of products sold in the state (distinct count of the product name field).


Using the drill-down option on summarized data

You can drill down on your data, to show the data behind individual groups, using the Drill-down cursor. See Sorting, Grouping, and Totaling.

Drill-down cursor

Seagate Crystal Reports allows you to drill down on group or summary information in the Preview tab in both the Standard and the Group Tree view (See Standard view and Group Tree view). When you position the cursor over any summary value that you can drill down on, the program displays a Drill-down cursor.

If you then double-click, the program reveals the details behind that specific summary value. For example, if the Drill-down cursor becomes active over the city summary, you can double-click to see the details behind that summary.

  • If you have only a single summary, you can look at the summary or at the data from the individual records that are summarized.
  • If you have multiple summaries, you can look at the summaries behind summaries (the city summaries that make up the region summaries, for example), or at the data from the individual records that are summarized.


Using the zoom feature

You can easily zoom in on a report. You can choose any magnification from 25% to 400%. This feature is active in both the Design and Preview tabs.

To zoom the report in or out, set the zoom level in the Magnification Factor box found on the Standard toolbar.

It is helpful to view reports at low magnifications in order to get an overall picture of the layout of your report. Views at higher magnifications focus attention on the details of the report.


Inserting page headers and footers

You can use page headers and footers by placing the information in the Page Header or Page Footer sections of the Design tab.

  • Information to appear only on the first page of the report goes in the Report Header (RH).
  • Information to appear only on the last page of the report goes in the Report Footer (RF).
  • Information to appear at the top of every page goes in the Page Header (PH).
  • Information to appear at the bottom of every page goes in the Page Footer (PF).

Text, fields, or formulas can be used in these sections just as in the Details section.

Related topics

Creating footers after the first page.


Adding a title page to the report

Seagate Crystal Reports provides a quick, easy way to add a title page to a report by selecting Report Title from the Special Fields in the Field Explorer dialog box. In order to use this field, you must have a title entered in the Summary tab of the Document Properties dialog box. See Adding summary information to the report.

To add a report title
  1. On the Standard toolbar, click Insert Fields.

    The Field Explorer dialog box appears with Database Fields selected.

  2. Scroll down to Special Fields and expand it by clicking.
  3. Select Report Title, and click Insert to Report. An object frame appears when the cursor is moved over the report.

  4. Move the object frame to the Report Header section and click once to place the frame.
  5. With the report title selected, click Section Expert on the Standard toolbar.

    The Section Expert appears.

  6. With the Report Header section highlighted, select the New Page After check box.

Now the title will appear on the first page and the report will begin on the second page.


Adding summary information to the report

There may be times when you want to include non-printing comments with a report (a personal note to the report recipient, a note to explain more thoroughly the data on which the report is based, a report title, a comment about some particular data on the report, etc.).

Summary Info on the File menu provides a facility for including anything from a short note to hundreds of lines of text with your report. The comments do not print with the report; they remain in the Summary tab of the Document Properties dialog box where they can be reviewed on demand.

When you choose Summary Info, the Document Properties dialog box appears with the Summary tab active.

Enter the desired information and click OK when finished to return to your report.


Beyond basic reports

Once you are comfortable with the basics of reporting, you will be ready to investigate the more powerful reporting features of Seagate Crystal Reports, including:

  • charts (see Charting)
  • OLE objects (see OLE)
  • form letters (see Form letters)
  • subreports (see Subreports)
  • cross-tabs (see Cross-Tab Objects)
  • multi-section reports (see Multiple Section Reports)
  • and much, much more.


Record Selection

This section shows you how to filter the records you want included in a report. For example, using the record selection tools, you can limit the records in your report to include only records for a specific group of customers, a specific range of account numbers, or a particular date range.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

There are two sample reports installed with Seagate Crystal Reports which demonstrate record selection:

  • Record Selection1.rpt
  • Record Selection2.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from the Seagate Software Community web site:
http://community.seagatesoftware.com/samples/default.asp


Selecting records

When a field is selected to appear on a report, field values from every record in the active table(s) are printed by default. In many cases, you may not want to include all the values, but only a subset of those values. For example, you may want to include:

  • records only for a specific group of customers
  • records for a specific range of account numbers out of the total number of records in the database
  • values from only those records that fall within a particular date range.

Options for selecting records

Seagate Crystal Reports includes a very sophisticated formula language that you can use to specify virtually any type of record selection. However, you may not always need the flexibility in record selection that the formula language provides. The Select Expert is designed for such instances.

You can select records in one of two ways:

  • Using the Select Expert
  • Using formulas.

Determining which field(s) to use

When you select records, you are basing your report only on those records that meet some conditions that you have set. You base those conditions on the kind of information you want in the finished report.

Assume, for example, that you want a report that only shows data from California. The challenge is to find the best way to identify those records that come from California.

  • If the table used in a report has a State or Region field, you can specify in your request that the program use only those records in which the value in the state field is equal to California (Region is equal to CA).
  • If the table does not have a State field and you still want to report only on California data, there may be another way to identify that data.
      • If the table has a Postal Code field, you could base your record selection on the range of ZIP codes that apply to California (Postal Code is between n and N).
      • If the table has an Area Code field, you could base your record selection on California Area Codes (Area Code is one of x, y,....z).

Note:

  • If the Area Code is stored in the telephone number field, you will not be able to do this same record selection using the Select Expert based on the Area Code. You will have to create a record selection formula using the formula language to extract the Area Code part of the phone number and then do record selection based on that.
  • As a general rule, if you can base your record selection on a number of fields (as in this example), you should select an indexed field instead of a field that is not indexed.


Using the Select Expert

The Select Expert makes it easy to specify the records you want included in your report. When you work with the Select Expert, you select the field to which you want to apply selection conditions and then you specify those conditions.

The Select Expert can be used to set up simple record selection requests. For example:

  • customers from Arizona
  • orders in the first quarter
  • sales over $10,000.

The Select Expert can also be used to set up some sophisticated requests:

  • customers whose names start with "A", "M", or "S"
  • customers from California or Florida who ordered in July.

These are all range limit requests. One or more constants define the range. The program compares the field value in each record to the constant(s) and rejects records with values outside the range. The report is limited to values within the range. You can set up all of these types of record selection requests without any previous knowledge of the formula language.

Note: The Select Expert can be used to set up both record selection and group selection requests. When a group name or summary field is selected, the program knows that the selection criteria set up is intended for group selection. In all other cases, the program knows that you are setting up record selection.

To set up record selection using the Select Expert
  1. On the Report menu, click Select Expert.

    The Select Expert dialog box appears.

    Note: If you click the Select Expert button without first highlighting a field in your report, the Choose Field dialog box appears. Highlight the field on which you want to base record selection and click OK. The Select Expert appears.

  2. Use the drop-down lists to enter your selection criteria for the indicated field.
  3. Click OK when finished.

    A selection formula is generated based on your specifications, limiting the report to the records you indicated.

    Note: To view the selection formula, click the Show Formula button. The Select Expert expands to show the formula. Click the Formula Editor button to modify the formula.


Using formulas

To set up record selection using a formula
  1. On the Report menu, point to Edit Selection Formula and click Record.
  2. Enter the formula by typing in the components or selecting them from the component trees.

    Note: The resulting formula must be Boolean; that is, it must return either a True or False value.

  3. Click Check to identify any errors in the formula.
  4. Fix any syntax errors the Formula Checker identifies.
  5. When the formula has the correct syntax, click Save then Close.
Related topics

For sample record and group selection templates, see Using formula templates.

For complete instructions on creating formulas, see Using Formulas.


Interaction of the Select Expert and the Selection Formula Editor

The Select Expert and the Selection Formula Editor are interactive. That is, record selection criteria you enter via the Select Expert automatically generates a record selection formula which can be reviewed and modified. Likewise, record selection formulas and modifications to existing record selection formulas automatically update the selection criteria in the Select Expert.

Because of this interactivity, you can use the two tools together as a tutorial for learning the formula language.

To view the Select Expert formula
  1. Right-click the field on which you want to view record selection.
  2. Click Select Expert.
  3. Click the Show Formula button.

    The Select Expert expands so you can review the formula the program generated based on your selection criteria.

  4. Click the Hide Formula button when you are done with your review.
  5. Use the Select Expert to change your selection formula.
  6. Review the updated formula by clicking the Show Formula button again.
  7. To make changes to the formula, click the Formula Editor button in the expanded Select Expert and use the tools in the Record Selection Formula Editor to make your formula changes.

Note: Selection formula components that do not fit any of the fixed criteria in the Select Expert will not be translated. For example, if part of your record selection formula extracts the last four characters in a customer number, the section of the formula code that performs that extraction will not be converted to Select Expert selection criteria.


Using formula templates

Record selection formula templates

The following sample formulas can be used as templates to help you create your own selection formulas using the Record Selection Formula Editor. These examples illustrate different selections that you could do, not necessarily the best selections.


Selecting records using character strings

{file.FIELD} startswith "C"

Selects those records in which the value in the {file.FIELD} field begins with the character "C" (includes values like CyclePath, Corp. and Cyclist's Trail Co.; excludes values like Bob's Bikes Ltd. and Feel Great Bikes, Inc.).

not ({file.FIELD} startswith "C")

Selects those records in which the value in the {file.FIELD} field does not begin with the character "C" (includes values like Bob's Bikes Ltd. and Feel Great Bikes, Inc.; excludes values like CyclePath, Corp. and Cyclist's Trail Co.).

"999" in {file.FIELD}[3 to 5]

Selects those records in which the 3rd through 5th digits of the {file.FIELD} field is equal to "999" (includes values like 10999, 70999, and 00999; excludes values like 99901 and 19990).

"Cycle" in {file.FIELD}

Selects those records in which the value in the {file.FIELD} field contains the string "Cycle" (includes values such as CyclePath Corp. and CycleSporin, Inc.; excludes values like Cyclist's Trail Co. and Feel Great Bikes, Inc.).


Selecting records using numbers

Single values

{file.FIELD} > 99999

Selects those records in which the value in the {file.FIELD} field is greater than 99999.

{file.FIELD} < 99999

Selects those records in which the value in the {file.FIELD} field is less than 99999.

Range of values

{file.FIELD} > 11111 and {file.FIELD} < 99999

Selects those records in which the value in the {file.FIELD} field is greater than 11111 but less than 99999 (neither 11111 or 99999 is included in the range of values).

{file.FIELD} >= 11111 and
{file.FIELD} <= 99999

Selects those records in which the value in the {file.FIELD} field is greater than 11111 but less than 99999 (both 11111 and 99999 are included in the range of values).


Selecting records using dates

The Month, Day, and Year functions can all be used in examples like the following:

Year ({file.DATE}) < 1999

Selects those records in which the year found in the {file.DATE} field is earlier than 1999.

Year ({file.DATE}) > 1992 and
Year ({file.DATE}) < 1996

Selects those records in which the year found in the {file.DATE} field falls between 1992 and 1996 (1992 and 1996 not included).
Year({file.DATE}) >= 1992 and
Year({file.DATE}) <= 1996

Selects those records in which the year found in the {file.DATE} field falls between 1992 and 1996 (1992 and 1996 are included).

Month({file.DATE}) in 1 to 4

Selects those records in which the month found in the {file.DATE} field is one of the first four months of the year (includes January, February, March, and April).

Month({file.DATE}) in [1,4]

Selects those records in which the month found in the {file.DATE} field is the first or fourth month of the year (includes January and April, excludes February and March).


Selecting records using preset data ranges

The preset date ranges can be used to create selection formulas similar to these:

{file.DATE} in LastFullMonth

Selects those records in which the date found in the {file.DATE} field falls within the last full month. (If the month is May, this selects all records with an April date.)

not({file.DATE} in LastFullMonth)

Selects all records except those in which the date found in the {file.DATE} field falls within the last full month (if the month is May, this selects all records except those with an April date).

{file.DATE} < CurrentDate

Selects all records in which the date found in the {file.DATE} field falls before today's date.


Selecting records using date/number/character combinations

These formulas simply "mix and match" formulas from the categories above.

"C" in {file.FIELD}[1] and Month({file.DATE}) in [1,4]

Selects those records in which the value in the {file.FIELD} field begins with "C" and the month is either January or April. For example, if this kind of formula was used with an order database, you could be asking for a report showing all customers whose names begin with "C" and who placed orders in January or in April.

"AOK" in {file.HISTORY}[3 to 5] and
{file.OPENCRED} >= 5000

Selects those records in which the {file.HISTORY} field shows the characters "AOK" as the 3, 4, and 5 characters and the {file.OPENCRED} field (the amount of available credit) is at least 5000.

These templates can be used as they are (with your own data), or they can be combined to create complex formulas.


Choosing a formula template

To choose a formula template
  1. Select the template you want to use.

    You can do this in one of two ways:

      • review the list in Record selection formula templates, and write down the formula of interest
      • find the Record Selection Formula Templates in the online help file and copy the formula of interest to the Clipboard.
  2. Choose Edit Selection Formula from the Report menu.
  3. Choose Record to create a record selection formula.

    The Record Selection Formula Editor appears.

    - or -

    Choose Group to create a group selection formula.

    The Group Selection Formula Editor appears.

  4. In the Formula text box, type in the formula you wrote down in Step 1 or paste it from the Clipboard.
  5. Replace the values (fields, text, etc.) in the formula with the values you want. For example, if the example formula is:

{file.FIELD} > 99999

and you want to limit your report to records for which the value in the {orders detail.QUANTITY} field is greater than 25, replace the existing values with the values you want, so that your selection formula reads:

{orders detail.QUANTITY} > 25

  6. Click the Save and Close button when finished to exit the Selection Formula Editor.

    - or -

    Click Refresh on the Standard toolbar to preview the results.


Selection performance tips

Consider the following performance-related items when setting up record selection requests:

General

  • To push down record selection, "Use Indexes or Server for Speed" must be on.
  • Avoid date type conversion in record selection formulas.

    For example, using ToText ( ) to convert a numeric field to a string.

  • Able to push down some record selection formulas that use constant expressions.

PC Databases

  • Can only push down selection on indexed fields.
  • Able to push down AND clauses only (not OR).

SQL Databases

  • Able to push down selection on indexed or non-indexed fields.

    Note: Server will respond faster if you use indexed fields.

  • Able to push down AND and OR clauses.
  • Record selection which contains some types of embedded formulas can be pushed down.
  • Use SQL Expression fields to push down formula calculations necessary for the record selection.

    For example, a record selection of {@ExtendedPrice > 1000} where @ExtendedPrice = (Orders x Quantity) can't be pushed down. However, if @ExtendedPrice is replaced with a SQL Expression field it will be pushed down.

  • Use Show SQL Query to view SQL that will be sent to server.


Advanced record selection formulas

This section is of interest if you are creating reports from large databases and want to reduce the time it takes to process and display the results.

Note: This section assumes that you are familiar with the Select Expert and that you are reporting off of a SQL database.

Limiting amount of data fetched from the database

The most important thing you can do to speed up report processing is to limit the amount of data that is fetched from the database.

A primary tool for doing this is the record selection formula. Seagate Crystal Reports analyzes your record selection formula and generates a SQL query from it. This SQL query is then processed by the database and the resulting records are sent to Seagate Crystal Reports. Seagate Crystal Reports then evaluates the record selection formula locally for each of the records retrieved from the database, to get the set of records that is used to generate the report.

Unnecessary records are eliminated at two stages: at the database with the SQL query and within Seagate Crystal Reports by the record selection formula. For speed, you want as many records as possible to be eliminated in the first stage. This is commonly called pushing record selection down to the database server.

Record selection formula examples

In the Xtreme sample database, there are 2,001 records in the Orders table of which 169 have order dates prior to 1997. Suppose you want to report on only those records. A possible record selection formula is:

Year ({Orders.Order Date}) < 1997

The SQL query generated will send all 2,001 records to Seagate Crystal Reports and then the record selection formula will reduce this to 169. To see this, invoke the Show SQL Query dialog on the Database menu and notice that the SQL query has no Where clause. This is because Seagate Crystal Reports is not able to push down the Year ( ) function in the WHERE clause.

On the other hand, a record selection formula that generates the same
report is:

{Orders.Order Date} < #Jan 1, 1997#

This record selection can be performed on the database server, so it is pushed down. The SQL query generated will send only 169 records to Seagate Crystal Reports and then when the record selection formula is evaluated by Seagate Crystal Reports, no further records need to be eliminated. Notice that the resulting SQL query has a Where clause.

For speed, it is better to write record selection formulas like the second than like the first if possible; they both generate the same report, but the second takes advantages of the power and optimizations available on the database server itself for handling its own data.


Strategies for writing efficient record selection formulas

Consider the following points when creating a record selection formula:

Consideration #1

Any record selection formula that you can generate completely with the Select Expert, without writing pieces of the formula yourself, can be pushed down.

This case actually follows from the points below. However, you can write more types of record selection formulas using the tips below than is possible with the Select Expert. To do this, you need to edit the record selection formula directly with the Formula Editor or from within the large text window in the Select Expert.

Consideration #2

Any selection formula that is of the form: DataBaseField SupportedOperator ConstantOrParameterExpression can be pushed down.

Of course DataBaseField is just a database field. SupportedOperator is any of =, <>, <, <=, >, >=, StartsWith, Like or In.

ConstantOrParameterExpression is any expression that involves constant values, operators, functions and parameter fields. It cannot involve variables, control structures and fields other than parameter fields. By their very definition, constant and parameter expressions can be evaluated without accessing the database.

Note: A constant or parameter expression can evaluate to a simple value, range value, array value or an array of range values. Here are some examples of such expressions:

{?number parameter} - 3
Year ({?run date})
CurrentDate + 5
DateDiff ("q", CurrentDate, CDate("Jan 1, 1996"))
Month (Maximum ({?date range parameter}) + 15)
["Canada", "Mexico", "USA", {?enter a country}]
1000 To 5000
[5000 To 10000, 20000 To 30000, 50000 To 60000]

A complete example:

{Orders.Order Date} >= CurrentDate - 3

The program can also push down an expression that just contains a Boolean field (without the operator and constant parts).

{Orders.Shipped}
Not {Orders.Shipped}

Consideration #3

IsNull (DataBaseField) can be pushed down.

Consideration #4

SqlExpression SupportedOperator ConstantOrParameterExpression can be
pushed down.

For example, the selection formula {@ExtendedPrice} > 1000 cannot be pushed down if {@ExtendedPrice} is Quantity * Price. However, if the formula @ExtendedPrice is replaced with the equivalent SQL Expression, then this will be pushed down.

Consideration #5

Expressions following the above considerations, separated by "And"s and "Or"s. You can have several of each, and use parentheses to give priority. You can also use "Not". For example:

{Orders.Order ID} < Minimum({?number range}) Or
{Orders.Order Amount} >= 1000

(IsNull({Customer.Region}) Or
 {Customer.Region} = "BC") And
{Customer.Last Year's Sales} > 2000


Troubleshooting record selection formulas

To troubleshoot your selection formula, you should first begin by making sure that all of the fields referenced in the selection formula are placed on your report. Then delete the selection formula and test it as you rebuild it,
step by step.

To troubleshoot record selection formulas
  1. Write down the record selection formula on paper. You will use this written copy to help you reconstruct the selection formula one step at a time.
  2. Remove the record selection formula from your report by deleting the formula from the formula text box in the Record Selection Formula Editor.
  3. Click Save and Close when finished.
  4. Make certain that all fields referenced in the record selection formula (the selectors) are on the report physically and are not hidden.

    For example, if one of the selectors is:

{customer.POSTAL CODE} > "80000"

but the {customer.POSTAL CODE} field is not used on your report (as in the case of a sales report that uses the postal code to define territories but does not include the postal code in the report data), then insert the {customer.POSTAL CODE} field into the report.
Or, if one of the fields referenced in the selection formula is on the report but is hidden, unhide it by deselecting the Suppress option in the Format Editor for that field.
  5. Print the report and verify that the data in those fields which are referenced in the selection formula print satisfactorily. Make certain that all the data prints. For example, if there are x total records in the database you should have x records printing for each of the referenced fields. This establishes a baseline against which you can compare the results of printing with the selection formula.
  6. When you are sure that you are getting satisfactory results without using the selection formula, you can enter the selection formula using only one of the selectors.

    For example, to use this as the final selection formula:

{customer.POSTAL CODE} > "80000" and {customer.CONTACT LAST NAME}[1] = "C" and {customer.LAST YEAR'S SALES} >= 5000

this formula will select all of those records that show a Postal code greater than 80000, a value in the {customer.CONTACT LAST NAME} field beginning with "C", and a value in the {customer.LAST YEAR'S SALES} field greater than or equal to 5000.

You might start with this as the first test selection formula:

{customer.POSTAL CODE} > "80000"

Print the report and evaluate the data that prints when you have only one selector activated. Does the {customer.POSTAL CODE} field show only ZIP codes greater than 80000?

    • If it does, then you know that this part of the selection formula is working.
    • If it does not, then troubleshoot this part of the selection formula.
  7. Once the selection formula with one selector activated is working properly, add a second selector. For example, the new selection formula might look like this:

{customer.POSTAL CODE} > "80000" and {customer.CONTACT LAST NAME}[1] = "C"

  8. Print the report and evaluate the data that prints when you have two selectors activated. Evaluate the data in the {customer.CONTACT LAST NAME} field (since you already evaluated {customer.POSTAL CODE} in the last step).

    Does the {customer.CONTACT LAST NAME} field show only text strings beginning with the letter "C"?

      • If it does, then this part of the selection formula is working.
      • If it does not, then troubleshoot this part of the selection formula.
  9. Once the selection formula with two selectors activated is working properly, add a third selector, then a fourth, etc., until you have tested each selector in the selection formula.


Correcting selections that do not generate data

You may encounter a situation in which you create a record selection formula and, while header and footer information prints on your report, no detail information appears. The problem is the selection formula is rejecting all records. This usually occurs because of an error in the creation of the selection formula.

There are a couple of potential causes of your problem in the selection formula:

  • See Correcting uppercase/lowercase inconsistency.
  • See Unwanted spaces appear in selection formula.


Correcting uppercase/lowercase inconsistency

Record selection formulas are case sensitive. That is, "Bob" matches only with "Bob". It does not match with "bob", "BOB", "BoB", "bOB", "boB", or "BOb". Thus, if your selection formula is set to include only those records with "BOB" in the {customer.CONTACT FIRST NAME} field, but all the entries in the {customer.CONTACT FIRST NAME} field are mixed case ("Bob", for example), the selection formula will find no matches and thus will not print any details for the report.

You can solve this problem by using the UpperCase (str) or LowerCase (str) functions in your selection formula to convert field data to a consistent case before the program begins its selection. For example, if you were using this formula:

{customer.CONTACT FIRST NAME} = "BOB"

you can change the formula to this:

UpperCase({customer.CONTACT FIRST NAME}) = "BOB"

This second formula first converts the value of the {customer.CONTACT FIRST NAME} field to upper case characters and then checks to see if the value in that field is equal to "BOB". Using this formula, any instance of the three letters "b," "o," and "b" will be a match, regardless of case, because the case will be converted to uppercase.

You could use the LowerCase function in a similar manner to match
with "bob."

Check your selection formula closely and make sure you have the correct case for any text you are trying to match. If in doubt, use the UpperCase (or LowerCase) function to assure consistency and proper matching.

Another formula which performs much the same functions is the following:

"BOB" in UpperCase({customer.CONTACT FIRST NAME})


Unwanted spaces appear in selection formula

Spaces are characters, and when you include spaces in the search key of a record selection formula, the formula looks for records with the exact match in the selected field, spaces and all. For example, the following formula:

"Mr . " in {customer.TITLE}

will not find any matches with the form of address "Mr." because there is an extra space in the search key between the letter "r" and the period. Likewise, "Ph. D" will not match "Ph.D".

Check your selection formula closely, and make sure that the spaces in the selection formula match the spaces in the fields you are trying to match.


Sorting, Grouping, and Totaling

Sorting, grouping, and totaling are the steps that turn disorganized data into useful information on a report. This section describes the types of sorting, grouping, and totaling you can do within a report.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample reports installed with Seagate Crystal Reports which demonstrate sorting, grouping and totaling are:

  • Sort.rpt
  • Sort Multiple Field.rpt
  • Group By First Letter.rpt
  • Group By Intervals.rpt
  • Group.rpt
  • Summary Group.rpt
  • Summary With Formula.rpt
  • Subtotal Group.rpt
  • Subtotal Multiple Level.rpt
  • new path markerInventory.rpt
  • Product Catalog.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


Sorting data

Sorting means placing data in some kind of order to help you find and evaluate it.

When you first insert a database field into your report, the data within the fields appears in the order in which it was originally entered into the database. Locating information in this kind of report is difficult. It is much easier to review or find information when you can see it sorted in a logical format. For example, you may want to have a customer list sorted alphabetically by name or by country.

Understanding sort options

When you sort, the program asks you to define two things:

  • the field you want the sort to be based on (sort field)
  • the sort direction.

Sort field

A sort field is the field that determines the order in which data appears on your report. Almost any field can be used as a sort field, including formula fields. A field's data type determines the method in which the data from that field is sorted.

Note: You cannot sort on memo or BLOB fields.

Field Type Sort Order

Single-character string fields

blanks

punctuation

numbers

uppercase letter

lowercase letters

Multiple character string field

two letters

three letters

four letters, etc.

For example:

  • "BOB" comes before "bob"
  • "123" comes before "124"
  • " " (blank) comes before "a"
  • "aa" comes before "aaa"

Currency fields

numeric order

Number fields

numeric order

Date fields

chronological order

DateTime fields

chronological order

same-date values sorted by time

Time fields

chronological order

Boolean comparison fields

False values (0)

True values (1)

Null values

null values

non-null values

Sort Direction

Direction refers to the order in which the values are displayed, once sorted.

  • Ascending
    Ascending order means smallest to largest (1 to 9, A to Z, False to True). The program sorts the records in ascending order based on the values in the sort field you select.
  • Descending
    Descending order means largest to smallest (9 to 1, Z to A, True to False). The program sorts the records in descending order based on the values in the sort field you select.


Sorting single and multiple fields

In single field sorting, all the records used in the report are sorted based on the values in a single field. Sorting an inventory report by stock number or sorting a customer list by customer number are examples of single field sorts.

In multiple field sorts, the Report Designer first sorts the records based on the values in the first field selected, putting them in ascending or descending order as specified. When two or more records have the same field value in the first sort field, the program then sorts those records based on the value in the second sort field.

For example, if you choose to sort first by the {customer.COUNTRY} field and then by the {customer.REGION} field, both in ascending order, the report would appear with countries listed in alphabetic order, and regions within each country listed in alphabetic order. Any other fields, such as the postal codes within each region, would remain unsorted.

You create single or multiple field sorts using the same procedure.

To sort your data
  1. On the Report menu, click Sort Records.

    The Record Sort Order dialog box appears.

  2. Highlight the field to be sorted from the Report Fields list.
  3. Click the Add button.

    The selected field is added to the Sort Fields list.

  4. Specify the sort direction.
  5. If sorting by more than one field, highlight the second field you want the data to be sorted by and add it to the Sort Fields list.
  6. As you add each field to the Sort Fields list, specify the sort direction.
  7. Click OK when finished.

    Records are sorted based on the values in the Sort Fields list.


Grouping data

Grouped data is data that is sorted and broken up into meaningful groups. In a customer list, for example, a group might consist of all those customers living in the same Zip Code, or in the same Region. In a sales report, a group might consist of all the orders placed by the same customer, or all of the orders generated by a particular sales representative.

Group and sort direction

When data is grouped, four sort and group direction options are available. Direction refers to the order in which the values are displayed.

  • Ascending
    Ascending order means smallest to largest (1 to 9, A to Z, False to True). The program sorts the records in ascending order and then begins a new group whenever the value changes.
  • Descending
    Descending order means largest to smallest (9 to 1, Z to A, True to False). The program sorts the records in descending order and then begins a new group whenever the value changes.
  • Original
    Original order is the order the data was originally saved in the database. The program leaves the records in the order in which they appear in their originating database table, and begins a new group whenever the value changes in the group field you select.
  • Specified order
    Specified order is a user-defined order. The program places each record into the custom group you specify, leaving the records in each group in original order or it sorts them in ascending or descending order, depending on your instructions. See Creating custom groups.
To group data
  1. On the Insert menu, click Group.

    The Insert Group dialog box appears.

  2. Select the field you want the data grouped by from the top drop-down list.
  3. Select the sort direction from the second drop-down list.
  4. Select the Customize Group Name Field check box if you want to show a different value in the group header.

    Note: By default, the group header of the report will display the value of the field you are grouping on.

    For example, if you grouped by {Customer.CustomerID}, at each change of a group you will see the corresponding customer ID. If you want to display a different value (customer ID as well as customer name), customize the group name field by choosing an alternate data field, or creating a formula.

  5. Click OK.

    If your records within each group are unsorted, you need to sort the records within each group. See Sorting records within groups.

Related topics

Grouping data in intervals

Creating group headers


Creating custom groups

Usually data is sorted based on the values from a field in the report. Sometimes, however, you may not want to group data based on the values found in one of the fields on your report. For example:

  • The field you want to group on does not exist.

    For example, your report may contain a City field and a State field, but no Country field, although you need to group by country.

  • The field exists, but you do not want to group on the values in that field.

    For example, you may have a Color field on your report that includes specific color names (Logan Green, Sky Blue, Emerald Green, Navy Blue, etc.) but you want all shades of each color to appear as a single group (Greens, Blues, Reds, etc.). In this case you can build custom groups and manually assign the records you want to be in each group.

  • The field exists, but you want to select specific values or ranges of values for each group.

    For example, you might want one group to contain records where gross sales are less than a certain value, a second group where gross sales are greater than a certain value, and a final group where gross sales fall between two values. In this case, you can build your groups using the same range of selection facilities that are available to you for building record selection queries.

Specified order grouping provides a solution to these custom sorting and grouping challenges. It enables you to create both the customized groups that will appear on a report and the records that each group will contain. The only limitation is that a record can be assigned to only one group.

To follow a tutorial where you create custom groups to rank customers by the amount of business they did in the previous year, see Grouping data in intervals.

To create a custom group
  1. On the Insert menu, click Group.

    The Insert Group dialog box appears.

  2. Select the field you want the data grouped by from the top drop-down list.

  3. Select in specified order as your sort option from the second drop-down list.
  4. In the Change Group Options dialog box, enter the name of the group in the Named Group field.
  5. Click New.
  6. In the Defined Named Group dialog box, use the drop-down lists to select the data to be part of the group.
  7. Click the <New> tab to add more selection criteria to your specified group, if necessary.
  8. Click OK.
  9. Click New to create more custom groups as necessary.
  10. Click the Others tab to specify how you want to organize the data that is not part of the group(s) you defined.
  11. Click OK.


Sorting records within groups

Once you have grouped your data, you can easily sort the records within the groups to further organize the information.

To sort records within groups
  1. Once the data is grouped, on the Report menu, click Sort Records.

    The Record Sort Order dialog box appears.

    Note: Sort fields that begin with "Group" specify that the sort was done automatically when the data was grouped.

  2. Highlight the field you want the records within the groups sorted by and click the Add button to add it to the Sort Fields list.
  3. Specify the sort direction.
  4. Click OK when finished.


Group selection

When you group or summarize data, all the groups in the report are included by default. There may be times, however, when you do not want to include all the groups. For example:

  • you might want to see only those groups that have certain group names, or whose summarized values meet a certain condition
  • you might want to see only the groups with the highest summary values, or the lowest.

You can select the groups that appear in the report in two different ways:

  • See Using the Select Expert.
  • See Using selection formulas.

Note: For faster results, limit records through record selection before creating groups. See Selecting records.


Using the Select Expert

The Select Expert can be used to select groups of records in the same way that you select individual records.

When you are setting up group selection criteria, instead of basing the selection criteria on standard fields, as you do for record selection, you base the criteria on group name fields or summary fields.

  • If you have grouped your data but have not summarized it, you can only set up group selection based on the group name field. For example, you may want to select only those groups whose Region is Massachusetts:

GroupName ({Customer.REGION}) = "MA"

  • If you have summarized your data, you can set up group selection based on either the group name field or the summary field. For example:

Sum({Customer.LAST YEAR'S SALES},
{Customer.REGION}) > 10000

Note: The Select Expert can be used to set up record selection and group selection requests. When a group name or summary field is selected, the program knows that the selection criteria you set up is intended for group selection. In all other cases, the program knows that you are setting up record selection.

To set up group selection using the Select Expert
  1. Right-click the summary field on which you want to base group selection and choose Select Expert from the shortcut menu.

    The Select Expert dialog box appears.

    Note: If you click the Select Expert button without first highlighting a summary field in your report, the Choose Field dialog box appears. Highlight the summary field on which you want to base group selection and click OK. The Select Expert appears.

  2. Use the drop-down list to enter your selection criteria for the indicated field.
  3. To base the group selection on more than one field, click the New tab and choose the next field from the Choose Field dialog box.

Note: If you have not already previewed the report or refreshed the data, there will not be any data saved with the report. Without the data, the program cannot calculate group values; thus, no values appear when you click the arrow in the right drop-down list. In this situation, you will have to type in the values you want. If you want real values to work with, you will need to preview your report first. This will calculate the actual summary values available for you to work with.

  4. When you are finished, click OK in the Select Expert to return to the report.


Using selection formulas

With the Formula Editor you can build your group selection request using group fields, group name fields, and other formulas. As with record selection formulas, your only restriction is that the formula you create must be Boolean; that is, it must return either a True or False value.

To create a record or group selection formula
  1. On the Report menu, point to Edit Selection Formula.
  2. Click Record to create a record selection formula.

    The Record Selection Formula Editor appears.

    - or -

    Click Group to create a group selection formula.

    The Group Selection Formula Editor appears.

  3. Enter your selection formula in the Formula text box.

    Note: The resulting formula must be Boolean; that is, it must return either a True or False value.

  4. Click Check to identify any errors in the formula.
  5. Fix any syntax errors the Formula Checker identifies.
  6. When the formula has the correct syntax, click Save then Close.

    When the program runs the report, it will include only those records or groups of records that you specified.


Troubleshooting group selection formulas

In some cases, no values will print when using a group selection formula, even though there are values that match the selection criteria. Typically, in these cases:

  • the group selection formula references another formula
  • the referenced formula is one that calculates the value of each group as a percentage of the total value of all groups (in other words a subtotal as a percentage of a grand total).
To correct a group selection formula
  1. Use Xtreme.mdb to create a report that includes the following fields:

{customer.CUSTOMER NAME}
{customer.REGION}
{orders.ORDER ID}
{orders.ORDER AMOUNT}

For each order, the report shows the customer that placed the order, the region in which that customer is located, the order ID number, and the amount of the order.

  2. Subtotal the {orders.ORDER AMOUNT} field using {customer.REGION} as the sort-and-group-by field.

    The program sorts the data by state and calculates a subtotal in the {orders.ORDER AMOUNT} field every time the state changes. See Subtotaling data.

  3. Insert a grand total on the {orders.ORDER AMOUNT} field to see the total value of all orders placed.
  4. Create a formula named Percent that calculates each subtotal as a percentage of the grand total to see the value of the orders for each region group as a percentage of all orders placed.

Sum({orders.ORDER AMOUNT}, {customer.REGION}) % Sum({orders.ORDER AMOUNT})

  5. Place the formula in the Group Footer section of the report.
  6. Reference the formula (@Percent) in a group selection formula that selects only those groups for which the percentage (of subtotal to grand total) is less than 5% in order to find out which regions individually contributed less than 5% of total sales:

{@Percent} < 5

When you click Save then Close, you will receive the following error message:

This formula can not be used because it must be evaluated
later.
  7. Instead of using the formula name (in this case @Percent) in the group selection formula, enter the formula itself (the formula named @Percent). Thus, instead of using the group selection formula:

{@Percent} < 5

use the group selection formula:

Sum({orders.ORDER AMOUNT}, {customer.REGION}) % Sum({orders.ORDER AMOUNT}) < 5

Now when you print, only the regions that contributed less than 5% will print.


Grouping data in intervals

You may want to group your data into intervals. Age groups, time periods, and sales categories are some of the interval groupings that can be created. In this example, you will rank customers by the amount of business they did in the previous year.

This example uses specified order grouping. This kind of grouping lets you specify the records that will be included in each group. You define the intervals you want and the program will do the rest.

To group data in intervals
  1. Create a report using the sample data, Xtreme.mdb, and place the following fields from left to right in the Details section:
{customer.CUSTOMER NAME}
{customer.REGION}
{customer.POSTAL CODE}
{customer.COUNTRY}
{customer.LAST YEAR'S SALES}
  2. Right-click the Last Year's Sales data field and choose Insert Subtotal.

    The Insert Subtotal dialog box appears.

  3. You want to set up intervals based on the previous year's sales so select Last Year's Sales as the sort-and-group-by field from this drop-down list.
  4. Select in specified order from the second drop-down list.

    The Specified Order tab appears in the Insert Subtotal dialog box.

  5. Click the New button.

    The Define Named Group dialog box appears.

  6. Type "Less than $10,000" in the Group Name field.

    This is the name that will appear as the Group Name field value for the group.

  7. Since the first group is to contain only those records that have a Last Year's Sales figure of less than $10,000, set the fields so your condition reads:

is less than 10000

  8. Click OK to return to the Specified Order Tab.
  9. Click New.

    The Define Named Group dialog box reappears.

  10. Set up a second group that contains values between $10,000 and $25,000.
      • Type "$10,000 to $25,000" in the Group Name field.
      • Set the first field so the condition reads: is between
      • Specify a range of values:
            • type "10000" in the top field
            • type "25000" in the bottom field

              You have now set up the group to contain all values between $10,000 and $25,000.

  11. Click OK to return to the Specified Order tab.
  12. Click New.

    The Define Named Group dialog box reappears.

  13. Set up the final group that contains all values over $25,000.
      • Type "Over $25,000" in the Group Name field.
      • Set the first field so the condition reads: is greater than
      • Type "25000"
  14. Click OK to return to the Specified Order Tab.
  15. Click OK. The report is grouped by interval in a specified order. Your report should look similar to the following report:


Grouping by the first letter of a company name

You might want to break your data into groups based on the first letter of the company name. For example, in a customer list you might want all the "A" customers in a group, then all the "B" customers, and so forth. To do this requires the use of a formula.

Do not worry if you are unfamiliar with formulas. This text will show you what formula you need here and how to enter it.

You can learn more about creating and editing formulas in Formulas overview.

You are going to create a formula that will extract the first letter of each customer's name. Then you will group the data using that formula field as the sort-and-group-by field. The program will sort the data based on the first letter of each customer name and start a new group whenever that letter changes.

To group data by the first letter of a company name
  1. Create a report using the sample data, Xtreme.mdb, and place the following fields from left to right in the Details section:
{customer.CUSTOMER NAME}
{customer.REGION}
{customer.POSTAL CODE}
{customer.COUNTRY}
  1. On the Insert menu, click Formula Field.

    The Field Explorer dialog box appears.

  2. Double click Formula Fields.
  3. In the Formula Name dialog box, enter the name you want to identify the formula, for example "First Letter."
  4. Click OK.

    The Formula Editor appears.

  5. Choose Crystal syntax from the drop down list in the top right corner.
  6. Type the following formula into the Formula text box:

{Customer.Customer Name}[1]

  7. Click the Save and Close button.

    You return to the Field Explorer dialog box. The name of the formula is listed in the Formula Fields directory.

  8. On the Insert menu, click Group.

    The Insert Group dialog box appears.

  9. Select the formula field as the field you want your data grouped by from the first drop-down list.
  10. Select the sort direction from the second drop-down list.
  11. Click OK.

    You return to your report with the data grouped by the formula field as specified. The data is broken into groups based on the first letter in the customer's name. The formula provides a live header for every group.

    For more information on live headers, see Live headers.

    Your report should look similar to the following:

Related topics

Formulas overview.

Grouping data.

Grouping data in intervals.

Creating group headers.


Grouping data hierarchically

You have the option to group data in a report to show hierarchical relationships. When you group data hierarchically, you sort information based on the relationship between two fields.

For example, if you want to show the hierarchical structure of a department, you could group data by employee ID and specify the hierarchy using the data field listing whom the employee reports to.

To group data hierarchically
  1. On the Insert menu, click Group.
  2. In the Insert Group dialog box, select the field to be the basis of your hierarchy.

    For example, if you want to view the hierarchical structure of a company's employee's, select the employee ID data field. If you want to view the hierarchical structure of region sales offices, select office names.

  3. Select in ascending order.
  4. By default, the group header of the report will display the value of the field you are grouping on. Select the Customize Group Name field check box if you want to show a different value in the group header.

    For example, if you grouped by {Employee.EmployeeID}, at each change of a group you will see the corresponding employee ID. If you want to display a different value (employee name instead of employee ID), customize the group name field by choosing an alternate data field, or creating a formula.

  5. Click OK.

    The group you created is added to the report.

  6. On the Report menu, click Hierarchical Grouping Options.

    The Hierarchical Options dialog box appears.

  7. Select the Sort Data Hierarchically check box.
  8. In the Instance ID field list, select the group you want to organize hierarchically.

    Note: It will normally be the same field that you grouped by.

  9. In the Parent ID field list, select the field by which you want the Instance ID field organized.

    For example, for a company hierarchal report, select the data field listing whom the employee reports to.

    Note: The type of the Instance ID and the Parent ID must be the same. For example, they both must be strings (text) or numbers.

  10. In the Group Indent field, enter the amount you want to indent for each subgroup.
  11. Click OK.

The report data is grouped hierarchically.

Note:

  • The top level of the hierarchy is determined by group instances that match the Instance ID and Parent ID.
  • If a group instance is not connected to any Parent ID, it appears at the top of the hierarchy.


Editing groups

To edit a group
  1. On the Report menu, click Change Group Expert.
  2. In the Change Group dialog box, select the group you want to edit.
  3. Click Options.
  4. In the Change Group Options dialog box, edit the group as necessary.
  5. Click OK.

    The report reflects the changes you have made to the group.


Summarizing grouped data

One of the primary purposes for breaking data into groups is to run calculations on each group of records instead of on all the records in the report.

When the program summarizes data, it sorts the data, breaks it into groups, and then summarizes the values in each group. It does this all automatically.

The program includes a number of summarizing options. Depending on the data type of the field you plan to summarize, you can:

  • sum the values in each group
  • count all the values or only those values that are distinct from one another
  • determine the maximum, minimum, average, or Nth largest value
  • calculate up to two kinds of standard deviations and variances.

For example:

  • Customer list reports: Determine the number of customers in each state. The summary would count the distinct customers in each state group.
  • Order reports: Determine the average order placed each month. The summary would calculate the size of the average order for each month group.
  • Sales reports: Determine the total sales per sales representative. The summary would sum or subtotal the order amounts for each sales representative group.
To summarize grouped data
  1. On the Insert menu, click Summary.

    The Insert Summary dialog box appears.

  2. Select the desired summary operation from the top drop-down list.
  3. Select the field you want the data to be grouped by from the second drop-down list.
  4. Select the sort direction from the third drop-down list.
  5. Click OK when finished.

    For example, if you wanted to count the number of customers you had per country, you would create a count field based on customer, and group by country.

Related topics

Subtotaling data


Ordering groups by summarized values

Groups can be organized in either ascending or descending order by summary value. For example, in an orders report, if you subtotal the order amount by state, you could order the groups:

  • from lowest to highest order amount (ascending)
  • from highest to lowest order amount (descending).

You order the groups in a report by summary values using the TopN/Sort Group Expert command on the Report Menu.

To order groups by summary value
  1. Click Top N Expert on the Supplementary toolbar.

    The Top N/Sort Group Expert dialog box appears with a tab for each of the groups in the report that has a summary.

  2. Click the tab for the group you want to sort.
  3. Select the Sort All option from the drop-down list on the left.
  4. Choose the summary that you want to base your selection on from the summary drop-down list on the right.

    The summary drop-down list on the right is for those cases in which you have multiple summaries within a single group section. For example, in an orders report, you might sum and average the orders for each customer and then display both the sum and the average in the same group section. In such a case, you would select the sum or the average from this drop-down list.

  5. Specify the sort direction.
  6. To select a second group sort, repeat Steps 2-5.

When you run the report, the program will order the groups based on the summary value(s) specified.


Selecting top or bottom N groups

At times, you might want to show only the "top" or "bottom" groups in a report: the fastest selling product lines, the least productive sales regions, the states that generate the most orders, etc. Because this kind of group selection is so popular, the program includes the Top N/ Sort Group Expert for setting it up easily.

There is one other element to consider when setting up Top N: what to do with all the records from other groups that do not fit the Top N or Bottom N criteria you have set. You need to decide whether to eliminate those records from your report entirely or to lump them all together into a single group. The program enables you to do choose either option.

Note: A report must contain a summary value in order to be able to perform a top N or bottom N selection. See Summarizing grouped data.

To select the top or bottom N groups
  1. Create a report and summarize the data as desired. When you summarize the data, the program breaks the data into groups and summarizes each group.
      • with top N grouping, you are instructing the program to display those groups that have the highest summary values (Top N)
      • with bottom N grouping, you are instructing the program to display those groups that have the lowest summary values (Bottom N).
  2. Click the Top N Expert button on the Supplementary toolbar.

    The Top N/Sort Group Expert appears with a tab for your group.

    Note: If you have multiple groups, the program will display a tab for each of the groups.

  3. Choose Top N, Bottom N, or Sort All from the first drop-down list.
  4. Choose the summary that you want to base your selection on from the summary drop-down list on the right.

    The summary drop-down list on the right is for those cases in which you have multiple summaries within a single group section. For example, in an orders report, you might sum and average the orders for each customer and then display both the sum and the average in the same group section. In such a case, you would select the sum or the average from this drop-down list.

  5. In the where N is text box, enter the number of groups you want to display. For example:
      • to report on the three fastest selling product lines, select the top N option in the Top N Sort Group Expert and set N to be equal to three
      • to report on the five least productive sales regions, select the bottom N option in the Top N Sort Group Expert and set N to be equal to five.
  6. Click the include Others, with the name check box and enter a name if you want to group all the other records into a single group.
  7. Click OK when finished.

    When the program runs the report, it will include only those groups that you specified.


Subtotaling

A subtotal is a summary that totals or sums numeric values in a group. Seagate Crystal Reports groups and subtotals in a single step.

Note: If you are creating a subtotal using database tables that are grouped in a one-to-many linking relationship, you may need to use a running total instead of a subtotal. See Creating running totals in a one-to-many linking relationship.

Subtotaling data

In this example you will subtotal Last Year's Sales by Country.

To subtotal data
  1. Create a report using the sample data, Xtreme.mdb, and place the following fields from left to right in the Details section:
{customer.CUSTOMER NAME}
{customer.REGION}
{customer.POSTAL CODE}
{customer.COUNTRY}
{customer.LAST YEAR'S SALES}
  2. Right-click the Last Year's Sales field and choose Insert Subtotal from the shortcut menu.

    The Insert Subtotal dialog box appears with the chosen field listed at the top of the dialog box.

  3. Choose the field you want the data grouped by, specify a sort direction and then click OK when finished. The values in each group are now subtotaled.


Extending prices and subtotaling the extensions

In an orders report or invoice, you may need to extend the prices for individual line items and then subtotal the extensions. You do this by using a simple formula to extend the prices, and then you subtotal the formula field.

To extend the price and subtotal the extensions
  1. Create a report using the sample data, Xtreme.mdb, and place the following fields from left to right in the Details section:
{orders.CUSTOMER ID}
{orders detail.PRODUCT ID}
{orders detail.QUANTITY}
{orders detail.UNIT PRICE}
  2. To create the formula for extending the prices, choose Insert from the main menu and select Formula Field.

    The Field Explorer dialog box appears.

  3. Double click Formula Fields.

    The Formula Name dialog box appears.

  4. Enter the name you want to identify the formula.
  5. Click OK.

    The Formula Editor appears.

  6. Enter the following formula into the Formula text box:
{Orders_Detail.Quantity} *
{orders detail.Unit Price}
  7. Click the Save and Close button when finished.

    You return to the Field Explorer dialog box with the name of your formula listed in the Formula Fields directory.

  8. Double-click your formula and place the formula field to the right of the Unit Price field in the Details section of the report.
  9. Click Close to close the Field Explorer dialog box.
  10. To subtotal extensions, right-click the formula field and choose Insert Subtotal from the shortcut menu.

    The Insert Subtotal dialog box appears.

  11. To create a subtotal for weekly sales, select {orders.ORDER DATE} as the sort-and-group-by field, and choose for each week as the group interval.

    Note: The section will be printed drop-down box will not be activated until you choose the Order Date field.

  12. Click OK to insert the subtotal in the report.

Your data will be sorted by date and grouped in one week intervals. Your final report should look similar to the following:


Percentages

Calculating a percentage

You can calculate the percentage of one group within a broader grouping. For example, you can show the percentage of sales in each city based on the total sales for each country. Or, you can see what percentage of the grand total of sales each country contributes.

To calculate a percentage
  1. On the Insert menu, click Summary.

    The Insert Summary dialog box appears.

  2. Enter sum in the first drop-down list.
  3. Select the field for which you want to calculate the sum.

    For example, you may want to insert a field which calculates the sum of last year's sales.

  4. Select how you want the data grouped.
  5. Click the Show as a percentage of check box.
  6. Select the group you want the percentage based on.

    You can choose to show a percentage of a group within another group, or show a percentage of the grand total.

  7. Click OK. The summary percentage field is added to your report.


Group headers

Creating group headers

Whenever you create a group, a subtotal, or a summary, the program creates both a Group Footer (GF) section (where it places any subtotal or summary value), and a Group Header (GH) section (where it automatically places the group name/header). Group Headers are useful, even necessary, if you want your report data to be clear and easily understood. Though the program creates a group header automatically, you may find that you would like to change or modify the header to suit your needs. You will learn how to create the four most common kinds of group headers:

  • Standard headers
  • Live headers
  • Live headers for groups based on a formula
  • Headers for custom groups.


Standard headers

A standard header is a block of text that is used to identify each group in a rather generic kind of way. "Customer," "State," and "Monthly Orders" are all examples of this kind of header.

While the header is somewhat descriptive ("Region Sales Figures" means it is a regional group), you never know what region is in the group without first looking at the details in the group.

To create a standard header
  1. Click the Insert Text Object button on the Standard toolbar.
  2. When the object pointer appears, move the object frame into the Group Header section.
  3. Enter the text you want to use for the header.
  4. Click outside the frame when finished to complete the process. Now when you run the report, the same header will appear at the beginning of each group.


Live headers

A live header is a header that changes based on the content of the group. If the data is subtotaled by region, for example, a live header would typically identify the region detailed in each group. Thus, the Arizona group would have a header identifying the group as Arizona data, the California group would have a header identifying the group as California data, and so on.

Note: When creating a group, the program automatically inserts a group name field in the Group Header section unless you have toggled the option off using the Options command on the File Menu. The information that follows details how to manually insert such a section (if you do not have the program insert one automatically) and how to create different kinds of live headers for different needs.

Group name only

The easiest live header to create is one based on identifying the value of the group field.

To create a live header by group name only
  1. On the Insert menu, click Database Field.
  2. In the Field Explorer dialog box, click the plus sign to expand the Group Name Fields directory.
  3. Double-click the Group Name field that matches the group you are working with and drag it into the Group Header section for that group.

    When you run the report, the group field value identifier will appear as the group header for each region group.

Group name with text

A more complex type of live header combines a field value and text. A typical group header of this kind for data broken down by region would be, "Sales for California" or "Customers in Postal Code 60606". Creating these headers involves three steps:

  • Insert a text object in the Group Header section.
  • Type in the text you want to appear.
  • Enter the Group Name field in the text field where you want it to appear in the Group Header.

For example, if you want your header to read "Sales for" and then the name of the region in the current group (Sales for AZ, Sales for CA, and so forth), follow these steps:

To create a live header with group name using text
  1. Click the Insert Text Object button on the Standard toolbar.
  2. Place the object frame into the Group Header section for the group.
  3. Type in the desired text with a space after it.
  4. Click the Insert Fields button on the Standard toolbar.
  5. In the Field Explorer dialog box, click the plus sign to expand the Group Name Field s directory.
  6. Double-click the Group Name field that matches the group you are working with and drag it into the text object, immediately after the text and the space you entered.
  7. Format the text object as you want it to appear.

When you run the report, the program will create a live header (with text) for each of your groups.

Live headers for groups based on a formula

When you create a group and use a formula field as a sort-and-group-by field, the program automatically creates a group name field based on the value returned by the formula.

For example, if you create this formula:

{customer.CUSTOMER NAME}[1]

and then group on the formula, the program will group your data based on the first letter in the Customer Name field.

To create a live group header for a group based on a formula, simply insert the group name field in the Group Header section.

When you run the report, the "A" group will have the letter "A" as a header, the "B" group will have the letter "B", and so on. For more information, see Grouping by the first letter of a company name and Grouping data in intervals.

To create a more descriptive header such as "Customers beginning with the letter B", see Group name with text.


Headers for custom groups

The final type of header is a header for the types of custom groups created when data is grouped in a specified order. When using specified order grouping, both the name for each group and the records that belong in it are specified. As in the other grouping situations, the program creates a group name field for each group based on the group names specified.

To create a header for custom groups
  1. On the Insert menu, click Database Field.
  2. In the Field Explorer dialog box, click the plus sign to expand the Group Name Fields directory.
  3. Double-click the Group Name field for the custom group and drag it into the Group Header section for that group.

The program automatically applies each of the group names you assigned to the appropriate groups.

Note: Make certain that when you assign the names to the groups using the Define Named Group dialog box, the names you assign are the names you want to appear as group headers.


Suppressing group headers

You have the option to hide group headers in your report.

To suppress group headers
  1. Right-click the group header and select Format Field.
  2. In the Format Editor, click the Suppress check box.
  3. Click OK.


Drilling-down on group headers

To make report viewing easier, you can hide the details of your report and only have the group headers visible. When necessary, you can click on the group header to view the report details.

To drill-down on group headers
  1. Right-click the grey Details section to the left of the report.
  2. Select Hide (Drill-Down OK).
  3. Click Refresh.

    When you place the cursor over a group header, the cursor becomes a magnifying glass.

  4. Click the group header to drill-down to the detail information.
Related topics

Using the drill-down option on summarized data.


Running Totals

Running totals are a flexible and powerful way to create specialized summaries and continually incrementing totals.

This section shows you how to add a basic running total and a running total within a group to your report. You will also learn how to create conditional running totals and running totals using formulas.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

There are two sample reports installed with Seagate Crystal Reports which demonstrate running totals:

  • Running Totals.rpt
  • Running Totals Group.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from the Seagate Software Community web site:
http://community.seagatesoftware.com/samples/default.asp


Understanding running totals

Running total fields are similar to summary fields but allow more control over how the total is calculated and when it is reset. Running total fields are specifically suited to perform the following totaling functions:

  • show values of a total accumulate as it is calculated record by record
  • total a value independent of the report's grouping
  • total a value conditionally
  • total a value after a group selection formula has been applied
  • total a value from the driving table in a one-to-many linking relationship.


How running totals work

A running total field is created with the Running Total Expert. The Running Total Expert creates a running total field by asking you to select a field to summarize, the summary operation to use, a condition upon which to base the evaluation, and a condition upon which to reset the evaluation.

Note: A running total field can be used on database fields and first-pass formulas, but cannot be used on second-pass formulas or formulas that reference other second-pass formulas. For more information See Multi-pass reporting flow chart.


Placement of running total fields

The calculation of a Running Total field is determined by the settings selected in the Running Total Expert. However, where you place the running total affects the value that appears on the report. For example, if a Running Total field that evaluates every record and never resets (a grand total) in the Report Header, only the value of the first record will appear. Placing the same Running Total field in the Report Footer returns the desired value. The Running Total field is properly calculated in both cases, but it is displayed too soon in the first case.

The following is a list of the report sections and the records that the running total will use.
Report Header | Returns first record of the report
Page Header | Creates running total up to and including the first record of current page.
Group Header | Creates running total up to and including first record of current group.
Details | Creates running total for every record.
Group Footer | Creates a grand total for each group.
Page Footer | Creates Running total up to and including the first record of the next page.
Report Footer | Creates a grand total that includes all records.


Creating running totals

Creating running totals in a list

Running totals are totals that are displayed generally on a record by record basis. They total all records (in the report, in the group, and so on) up to and including the current record.

The most basic form of a running total is a single running total maintained throughout a list. In this tutorial, you will create this kind of report by setting up a running total for a list of order amounts.

Note: Running total fields are prefixed by the # sign.


To create a running total in a list

  1. To get started, create a report using the sample database Xtreme.mdb located in the File Data Sources folder of the Data Explorer dialog box. Link the Customers and Orders tables, and then place the following fields from left to right in the Details section:
{customer.CUSTOMER NAME}
{orders.ORDER ID}
{orders.ORDER AMOUNT}
  2. On the Insert menu, click Running Total Field.

    The Field Explorer dialog box appears.

  3. Double-click Running Total Fields.

    The Create Running Total Field dialog box appears.

  4. Enter the name "TotalOrders" in the Running Total Name box.
  5. Highlight {orders.ORDER AMOUNT} in the Available Tables and Fields box, and use the first arrow button to move it over to the Field to summarize box.
  6. Select sum from the Type of summary list.
  7. In the Evaluate section of the dialog box, click On change of field, and select {orders.ORDER ID} as the On change of field.

    The running total will execute each time this field changes.

  8. In the Reset section of the dialog box, click Never (this gives you a running total that never resets; that is, the running total continues throughout the report).
  9. Click OK to save the running total field.

    The program returns you to the Field Explorer dialog box.

  10. Insert the running total field in the Details section of the report, just to the right of {orders.ORDER AMOUNT}.


Creating running totals for a group

Another common use for running totals is tallying items in a group. The running total starts with the first item in the group and ends with the last. Then it starts all over again for the next group, then the next, and so on.

In this tutorial, you will create a report that:

  • maintains a running total of customer orders
  • groups customer orders and resets the running total for each group
  • displays the subtotal for each order (the last running total for that order).


To create a running total for a group

  1. To get started, create a report using the sample data, Xtreme.mdb located in the File Data Sources folder of the Data Explorer dialog box.

    Link the Customers and Orders tables and place the following fields from left to right in the Details section:

{customer.CUSTOMER NAME}
{orders.ORDER ID}
{orders.ORDER AMOUNT}
  2. On the Insert menu, click Group and group on the {customer.CUSTOMER NAME} field.
  3. On the Insert menu, click Running Total Field.

    The Field Explorer dialog box appears.

  4. Double-click Running Total Fields.

    The Create Running Total Field dialog box appears.

  5. Enter the name "GroupRunningTotal" in the Running Total Name box.
  6. Highlight {orders.ORDER AMOUNT} in the Available Tables and Fields box, and use the first arrow button to move it over to the Field to summarize box.
  7. Select sum from the Type of summary list.
  8. In the Evaluate section of the dialog box, click For each record.
  9. In the Reset section of the dialog box, click On change of group and accept the default group name.
  10. Click OK to save the running total field.

    You return to the Field Explorer dialog box.

  11. Place the running total field in the Details section of your report, just to the right of the {orders.ORDER AMOUNT} field.

    Note: If you want to view a grand total of each group, place the running total field in the Group Footer section of your report.


Creating conditional running totals

There may be times when you have a list of ungrouped values, and you only want to subtotal some of the values in the list. For example:

  • you have a list that contains both Canadian and U.S. customers
  • you want to keep customer records sorted alphabetically based on customer name
  • you do not want to break the data into groups based on the country
  • you want a total of the values from just the Canadian records
  • you also want a total of the values from just the U.S. records.

To accomplish this, create two running totals, one to keep a running total of the U.S. records, and one to keep a running total of the Canadian records.

  • USTotal
    Maintains a running total of the U.S. records.
  • CanadaTotal
    Maintains a running total of the Canadian records.


To create a conditional running total

  1. To get started, create a report using the sample data, Xtreme.mdb located in the File Data Sources folder of the Data Explorer dialog box. Place the following fields from left to right in the Details section:
{customer.CUSTOMER NAME}
{customer.COUNTRY}
{customer.LAST YEAR'S SALES}
  2. On the Report menu, click Sort Records [image] .
  3. Sort the records based on the {customer.CUSTOMER NAME} field.
  4. On the Insert menu, click Running Total Field.

    The Field Explorer dialog box appears.

  5. Double-click Running Total Fields.

    The Create Running Total Field dialog box appears.

  6. Enter the name "USTotal" in the Running Total Name box.
  7. Highlight {Customer.LAST YEAR'S SALES} in the Available Tables and Fields box, and use the first arrow button to move it over to the Field to summarize box.
  8. Select sum from the Type of summary list.
  9. In the Evaluate section of the dialog box, click Use a formula and then click the Formula button.

    The Running Total Condition Formula Editor appears.

  10. Enter the following formula in the formula box:
    {Customer.Country} = "USA"

    This tells the program to evaluate the running total each time it comes to a record where {Customer.COUNTRY} is equal to "USA." The running total will ignore all other records (such as records for Canada).

  11. When the formula has the correct syntax, click Save then Close.

    You return to the Create Running Total Field dialog box.

  12. In the Reset section of the dialog box, click Never.
  13. Click OK to save the running total field.

    The program returns you to the Field Explorer dialog box.

  14. Place the running total field in the Details section of your report.
  15. Now create the CanadaTotal running total field using the process outlined in steps 3-13. The only difference is that this time you will set the Evaluate formula to:

{Customer.Country} = "Canada"

  16. When you are finished, place the #CanadaTotal field in the Details section of your report, just to the right of the {Customer.LAST YEAR'S SALES} field.
  17. If you only want to see a grand total of the Canadian and American sales, place the two running total fields you created in the Report Footer section of your report.


Creating running totals in a one-to-many linking relationship

The term A to B, A to C report is used to refer to any report in which a primary table is linked to two lookup tables (see Methods of looking up tables (direct access databases)). However, in a true A to B, A to C link, a single field in the primary table is used to link to both of the lookup tables.

In a true A to B, A to C relationship, one of the two lookup tables usually has more records than the other. If you group these records based on a field in the primary table, values in the smaller lookup table are repeated for each value in the larger lookup table. The following table shows data for an A to B, A to C relationship. The Customer table is linked to the Credit table and again to the Orders table. Notice that Jones has only one Credit ID, but the credit and its amount are repeated, once for each of Jones' two orders.

Name | Credit ID | Credit Amount | Order ID | Order Amount
Jones | 1 | -10.00 | 1 | 10.00
Jones | 1 | -10.00 | 2 | 12.00
Smith | 2 | -23.00 | 3 | 20.00
Smith | 3 | -45.00 | 4 | 30.00

In this example, a standard subtotal is used for both the Order Amount field and the Credit Amount field. Thus, Jones' single credit is counted twice, and the subtotal displays an inaccurate value of -20.00.

Name | Credit ID | Credit Amount | Order ID | Order Amount
Jones | 1 | -10.00 | 1 | 10.00
Jones | 1 | -10.00 | 2 | 12.00
 |  | -20.00 |  | 22.00
Smith | 2 | -23.00 | 3 | 20.00
Smith | 3 | -45.00 | 4 | 30.00
 |  | -68.00 |  | 50.00

Note: Notice that the total Credit Amount for Jones is incorrect.

This problem also occurs in the Order Amount field if Jones had two different Credit Amounts and only one Order Amount. Avoid this problem by creating a running total for each field you want subtotaled.

To create a report that uses running totals in a on-to-many linking relationship, see the following:

  • Creating a one-to-many linking relationship
  • Creating a running total in a one-to-many linking relationship


Creating a one-to-many linking relationship

  1. To get started, create a report using the sample data, Xtreme.mdb located in the File Data Sources folder of the Data Explorer dialog box.
  2. Highlight the Credit table and click Add.
  3. Repeat the previous step for both the Customer and Orders tables.
  4. When all three tables have been added, click Close on the Data Explorer dialog box.

    The Visual Linking Expert appears.

  5. Link the Customer Credit ID field in the Credit table to the Customer ID field in each of the other two tables.

    Note: A different linking configuration occurs if you click Smart Link and this tutorial will not work properly.

  6. Select one of the links in the Visual Linking Expert and click Options.
  7. Click Look up all of one, then all of others in the When linking to two files from this file section of the Link Options dialog box.

    This option establishes an A to B, A to C link.

  8. Click OK to return to the Visual Linking Expert.

    The option you selected affects all links.

  9. Click OK to close the Visual Linking Expert.

You have now established an A to B, A to C relationship among the three tables. Now you'll use the tables to create a report with a running total.

See Creating a running total in a one-to-many linking relationship.


Creating a running total in a one-to-many linking relationship

  1. From the Field Explorer dialog box, place the following fields from left to right in the Details section of your report:
{customer.CUSTOMER NAME}
{credit.CUSTOMER CREDIT ID}
{credit.AMOUNT}
{orders.ORDER ID}
{orders.ORDER AMOUNT}
  2. On the Design tab, highlight the {orders.ORDER AMOUNT} field and insert a subtotal, grouping on the {customer.CUSTOMER NAME} field.

    If you look carefully at the subtotals for each group, you will notice they aren't accurate. This is caused by the one-to-many link you created for the report. Follow the rest of this procedure to see how running totals produce accurate results in one-to-many linking relationships.

  3. On the Insert menu, click Running Total Field.

    The Field Explorer dialog box appears.

  4. Double-click Running Total Fields.

    The Create Running Total Field dialog box appears.

  5. Enter the name "CreditsSubtotal" in the Running Total Name box.
  6. Highlight {Credit.AMOUNT} in the Available Tables and Fields box, and use the first arrow button to move it over to the Field to summarize box.
  7. Select sum from the Type of Summary list.
  8. In the Evaluate section of the dialog box, click On change of field and choose the field {Credit.CUSTOMER CREDIT ID}.

    Note: When selecting a field to be an On change of field field, choose one that is unique to the database table you are using.

  9. In the Reset section of the dialog box, click On change of field and choose the field {Customer.CUSTOMER NAME}.
  10. Click OK to save the Running Total field.

    The program returns you to the Field Explorer dialog box.

  11. Place the running total in the Group Footer section of the report.

Compare the running total amount with the subtotal amount for each group. You will see the running total is accurate while the subtotal isn't. This is why you should use a running total when your report has a one-to-many linking relationship.


Creating running totals using a formula

If you have suppressed data, or your data is based on a formula that occurs WhilePrintingRecords, you should create a running total formula rather than using the Running Total Select Expert.

When you create a running total manually, you need to create three formulas:

  • a summary formula
  • a reset formula to set a variable to zero
  • a display formula to display the variable.

In the following procedure, you will create a report that performs the following functions:

  • maintains a running total of customer orders
  • groups customer orders and resets the running total for each group
  • displays the subtotal for each order (the last running total for that order).


To create running totals using a formula

  1. Create a report using the sample data, Xtreme.mdb located in the File Data Sources folder of the Data Explorer dialog box. Link the Customers and Orders tables and place the following fields from left to right in the Details section:
{customer.CUSTOMER NAME}
{orders.ORDER ID}
{orders.ORDER AMOUNT}
  2. On the Insert menu, click Formula Field then double-click Formula Fields in the Field Explorer dialog box.
  3. Name the formula @RunningTotal and click OK.
  4. Enter the following into the Formula Editor:
WhilePrintingRecords;
CurrencyVar Amount;
Amount := Amount + {orders.ORDER AMOUNT};
  5. Click Save and Close.
  6. Place this formula in the Details section of your report, just to the right of the {orders.ORDER AMOUNT} field.

    This formula prints the running total of the values in the Order Amount field.

  7. On the Insert menu, click Group and group the report on the {customer.CUSTOMER NAME} field.
  8. In the Formula Editor, create @AmountReset:
WhilePrintingRecords;
CurrencyVar Amount := 0;

This formula says:
Set the value in the Amount variable to 0.
  9. Place this formula in the Group Header #1 section of your report.

    Because the Group Header #1 section appears once for every group, @AmountReset will execute each time the group changes. Thus, the Amount variable is reset to 0 each time a new group begins.

  10. Select the @AmountReset formula on the report and use the Format Editor to suppress it so that it will not appear in the final print-out.
  11. In the Formula Editor, create @AmountDisplay:
WhilePrintingRecords;
CurrencyVar Amount;

This formula simply displays the current value of the Amount variable at any time.
  12. Place this formula in the Group Footer #1 section of your report.

    Because the Group Footer #1 section appears once for every group, @AmountDisplay will execute each time a group ends. Thus, the value stored in the Amount variable will be printed each time the group changes.

Note: This formula prints the same value that @RunningTotal prints as the running total for the last record in each group. But since it is printing it in the Group Footer section, it acts as a group subtotal, not as a running total.


Multiple Section Reports

This section introduces the various types of sophisticated reports you can create using the multiple section reporting capabilities in Seagate Crystal Reports. These capabilities enable you to create reports that treat individual values differently based on sets of criteria you establish. These concepts are then applied to the creation of Form Letters.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample reports installed with Seagate Crystal Reports that demonstrate working with multiple sections are:

  • Employee Profile.rpt
  • Employee Sales.rpt
  • Financial Statement.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from the Seagate Software Community web site:
http://community.seagatesoftware.com/samples/default.asp


About sections

Seagate Crystal Reports provides five design areas to use when building your report:

  • Report Header
  • Page Header
  • Details
  • Report Footer
  • Page Footer.

Each area contains a single section when you first create a new report. You cannot delete any of these original sections but you can add to them. Once you have added sections, you can delete them, move them in relation to other similar sections, or merge related sections together.


Working with sections

Inserting a section

  1. Click Section Expert on the Standard toolbar.

    The Section Expert appears with a list of all the sections in the report. When there are more than one of any kind of section, the sections are lettered A, B, C, and so on.

    Note: The program enables only those options (free form, new page before, etc.) that apply to the highlighted section.

  2. Highlight the section you want to insert a section after.
  3. Click Insert.

    A new section is inserted immediately below the highlighted section.

Note: Sections can also be inserted by right-clicking the shaded area to the left of any section in the Design or Preview tabs and choosing Insert Section Below from the shortcut menu.


Deleting a section

  1. Click Section Expert on the Standard toolbar.

    The Section Expert appears with a list of all the sections in the report. When there are more than one of any kind of section, the sections are lettered A, B, C, and so on.

    Note: The program enables only those options (free form, new page before, etc.) that apply to the highlighted section.

  2. Highlight the section you want to delete.
  3. Click Delete.

    The program removes the highlighted section from the report.


Moving a section

  1. Click Section Expert on the Standard toolbar.

    The Section Expert appears with a list of all the sections in the report. When there are more than one of any kind of section, the sections are lettered A, B, C, and so on.

    Note: The program enables only those options (free form, new page before, etc.) that apply to the highlighted section.

  2. Highlight the section you want to move.
  3. Click the Up or Down arrow to move the section.

  4. With Section (C) highlighted, click the up arrow twice.

    The data originally in Section (C) is moved to Section (A). The data in the other sections is moved down.

Note:

  • You can only move a section up or down within an area.
  • The letters that identify the sections describe their relative (as opposed to original) position. Thus, if you move a "C" section up, it becomes a "B" section. It loses its original "C" designation.


Merging two related sections

There may be times when you have placed objects in two sections (where they print sequentially) and you want to put them all in a single section (where they print simultaneously). You can merge the two sections and then rearrange the objects as needed in the new section.

To merge related sections
  1. Click Section Expert on the Standard toolbar.

    The Section Expert appears with a list of all the sections in the report. When there are more than one of any kind of section, the sections are lettered A, B, C, and so on.

    Note: The program enables only those options (free form, new page before, etc.) that apply to the highlighted section.

  2. Move the sections so the two sections you want to merge follow each other in the list.
  3. Highlight the top section.

  4. .With Section (B) highlighted, click Merge and Section (C) will be merged with Section (B) to form one section.

  5. Rearrange the objects as needed.


Splitting and resizing sections

A section can be split into two or more sections and/or resized easily in the Design tab.


Splitting a section

  1. Move the pointer over the left boundary of the section you want to split.
  2. When the pointer becomes a Section Splitting cursor, click the boundary.
  3. When a horizontal line appears, drag it up or down to split the section the way you want it.


Resizing a section

  1. Move the pointer over the bottom boundary of the section you want to resize.
  2. When the pointer becomes a Resizing cursor, drag the boundary to make the section bigger or smaller as you wish.

Resizing a section to remove white space

If you have one or more objects in a section and you want to resize the section to remove unnecessary white space, right-click in the shaded area to the left of the section in the Design and Preview tabs and choose Fit Section from the shortcut menu. The program automatically resizes the section, moving the bottom boundary of the section to the baseline of the bottom object in the section.

A section automatically expands vertically in two instances:

  • when you place an object and the object is bigger (vertically) than the section you place it in
  • when you expand an object (vertically) so it becomes bigger than the section it resides in.

Note: You cannot resize a section smaller than an object in the section.


Using multiple sections in reports

Certain reporting tasks are performed most efficiently by creating multiple sections within an area, such as:

  • keeping variable length objects from overwriting each other (see Keeping variable length objects from overwriting each other)
  • formatting objects conditionally (see Formatting objects conditionally)
  • alternating background colors for rows (see Alternating background colors for rows)
  • eliminating blank lines when fields are empty (see Eliminating blank lines when fields are empty)
  • adding blank lines under specific conditions (see Adding blank lines conditionally).

Once you understand the power of multiple sections, you will discover even more ways to produce the effects you want.

Related topics

Working with sections.


Keeping variable length objects from overwriting each other

When subreports or other variable length objects are placed above other objects in one section of the report while the Can Grow option for the variable length object is toggled on in the Format Editor, that object may overprint objects positioned directly below it unless you have:

  • expanded the section to fit the maximum size of the object, and
  • spaced the objects, allowing enough space for the first object to complete printing before the second one begins.

You can eliminate this overprinting problem by creating multiple sections in an area and placing objects below the variable length object in their own section(s).

Now, when the report runs, the section with the variable length object will finish printing before the section below it prints and you will get the results you want. See Combining two unrelated reports.

Note: Memo and BLOB fields, as well as subreports, can cause overprinting.


Formatting objects conditionally

You may want to create a report that uses different formats depending on the field value. For example, you may want to create an international report that prints currency values for each country in the format that is common in that country. You can do that using multiple sections.

To format objects conditionally
  1. Create a report. See Creating the report. Ensure you report contains the Last Year's Sales field found in the Customer table.
  2. Create one Details section for each country that requires a unique format. See Using guidelines.
  3. Make certain that each of the Details sections contains the same data; every field that you place in the Details A section, you must also place in the Details B section, and in the Details C section, etc.
  4. In the Details A section, select the Last Year's Sales field and then click Object Properties on the Supplementary toolbar.

    The Format Editor appears showing the Number tab.

  5. Set the currency style you want to use for the first country.
  6. Click OK to return to the report.
  7. Click Section Expert on the Standard toolbar.

    The Section Expert appears.

  8. Select the Details A section in the Sections box. Select the Suppress (No Drill-Down) check box.
  9. Click the Conditional Formula button to the right of the Suppress (No Drill-Down) check box and use the Format Formula Editor to create a formula that specifies the conditions under which the section should be suppressed.

    For example, if the Details A section contains currency values for the UK, you would create a formula that specifies that the country value is not equal to UK. In other words, you create a formula that suppresses the section when the country value is not UK. This will make the section print only when the record contained a UK value.

  10. Repeat Steps 4 through 9 for each additional section.

Now, when the report is printed, the date and currency data for each country appears in the format that is expected for that country. See Working with conditional formatting.


Alternating background colors for rows

Another typical use of multiple sections is to vary the background color in alternating lines for the Details section of a report in order to improve readability (a greenbar-paper effect).

To alternate background colors for rows
  1. Use the Section Expert to insert a second Details section. You should now have Details A and Details B sections. See Working with sections.
  2. While in the Section Expert, highlight Details A in the Sections list, click the Color tab, and set the background color to White.
  3. Click the Common tab, click the Conditional Formula button to the right of Suppress (No Drill-Down), and type the following formula in the Format Formula Editor when it appears:

Remainder (RecordNumber,2)<>0

«This formula divides the record number by 2 and if the remainder is something other than zero (which will happen for every odd numbered record), it tells the program to suppress the section.»

  4. Click Save and Close.
  5. Now select Details B and set the background color to Green.
  6. Use the technique from Step 3 to set Suppress conditionally for this section using the following formula:

Remainder(RecordNumber,2) = 0

«This formula divides the record number by 2 and if the remainder is equal to zero, it tells the program to suppress the section.»

  7. Create the report and make certain that the information and layout of each of the Details sections is identical. In other words, whatever objects you place in Details A should be placed into Details B as well.

Now when you run the report, the program will print every even numbered line with a white background and every odd numbered line with a green background.


Eliminating blank lines when fields are empty

It is very common to have two address lines in a customer table, one for street address (Address 1), and one that can be used for a suite number or mail stop (Address 2). Address 1 usually contains a value, but Address 2 is often blank. If you create a customer list using this data and stack the fields on top of one another in mailing label format, those customer records with an empty Address 2 field will print with a blank line. You can eliminate this blank line using multiple sections.

To eliminate blank lines when fields are empty
  1. Use the Section Expert to create two new Details sections so that you have a total of three. See Working with sections.
  2. Place the Address 2 field in the middle section and the other data in the sections above and below it as you want it to appear in the report.
  3. In the Section expert, highlight the middle section.
  4. On the Common tab, select the Suppress Blank Section check box.

Now, when the report prints, if the Address 2 section is blank, the program will not print it and you will not get unwanted blank lines in the report.


Adding blank lines conditionally

Use multiple sections to print a blank line on your report under specific conditions. For example, you may want to insert a blank line after every fifth record in the report.

To add blank lines conditionally
  1. Use the Section Expert to create two Details sections. See Working with sections.
  2. Place the report detail data in the top section.
  3. Leave the second section empty.
  4. In the Section expert, highlight the second section.
  5. On the Common tab, select the Suppress (No Drill-Down) check box then click the conditional formatting button to its right.
  6. Enter the following formula in the Format Formula Editor:

Remainder (RecordNumber,5) <> 0

«This formula divides each record number by 5. If the division produces a remainder, it suppresses the blank section. But if the division produces no remainder, a zero (which it will for every fifth record printed), the program prints the second section, thus inserting a blank line.»

Note: To insert a blank line under different conditions, you can modify your formula appropriately. See Working with conditional formatting.


Form letters

While form letters themselves are not necessarily multi-section reports, they are often used in multi-section reports to generate custom mailings. The topic Printing conditional messages in form letters, explains how to use multiple form letters or multiple versions of the same form letter for custom mailings.

Form letters often use text objects to hold the content of the report. The following sections provide an introduction to text objects.


Working with text objects

You will use many of the capabilities of text objects when creating form letters. A brief discussion of text objects should make it easier for you to create the form letter in the next section. Some things to consider are:

  • a text object can contain both text and fields; you will use both in this example
  • you can resize text objects; you will be resizing the text object so that it prints as a letter.

Text objects operate in two modes:

  • the move/resize mode
  • the edit mode.


Move/Resize mode

When the object is in the move/resize mode, it appears as a broken line frame with resizing handles.

In this mode, you can resize the object by dragging any of the resizing handles, or you can move it by placing the cursor inside the object and dragging it to a new location. You can also insert fields in this mode, but you cannot insert text. You put a text object into the move/resize mode in one of two ways:

  • by clicking the text object when it is inactive
  • by clicking the frame when the object is in edit mode.


Edit mode

When the object is in the edit mode, it appears as a broken line frame without sizing handles, and an in-place ruler appears at the top of the tab.

When you first place a text object, the program sets it in the edit mode. You can also put a text object into the edit mode by double-clicking it when it's inactive or in the move/resize mode.

Each text object contains word processor capabilities, including the ability to change the fonts for individual characters and fields, and automatic word wrap. In the edit mode you can insert text and such non-text objects as database fields and formulas. Whenever the object is in edit mode, it contains an insertion point, a flashing vertical line that indicates the position at which typed text or inserted fields will begin.

The insertion point moves as you type, automatically staying to the right of the last character. It also moves when you insert a field, automatically staying to the right of the field. It moves one character position at a time when you press the space bar. It moves down one line, to the inside left edge of the text object, when you press Enter. It moves to the cursor position when you click anywhere within the existing text.

As you work through the tutorials for multiple sections, it is always expected that you will type or place fields at the existing insertion point, unless otherwise indicated.

  • To select text within a text object (to delete it, to change a font, etc.), position the cursor over the text and, when the I-beam cursor appears, drag the cursor to highlight the text you want to select.
  • To select a field which is inside a text object, position the cursor over the field and, when the I-beam cursor appears, right-click.
  • To insert text, type in the desired text and it will appear at the insertion point.

    Note: It is critical that you see the Drag and drop cursor before placing the field. If it does not appear, you might place the field so that it overlays the text object instead of being inserted into it. It may appear to be inside the text object, but if you move the object the field will not move with it.

  • The insertion point is tied into the Drag and drop cursor. If you have existing text or fields in the text object, the insertion point moves as you move the Drag and drop cursor, enabling you to pick the exact position where you want to place the field. The program always places the field at the insertion point.

Related topics

Working with text objects.


Creating a form letter using a text object

The following section shows you how to create a form letter.

You are going to use a text object to create a form letter. The form letter you create will be tied to a database table so that each letter will be customized with company information from a different record.

If you have difficulty performing any of the steps, please see Working with text objects.

To create a form letter

The letter will consist of a date, an inside address, a salutation, a one paragraph letter body, and a closing section.

  1. Create a blank report. Use the Customer table of Xtreme.mdb.

    The Design tab appears with Database Fields highlighted in the Field Explorer dialog box.

  2. Since you do not want field titles to appear above the fields that you insert into the letter, clear the Insert Detail Field Titles check box on the Layout tab of the Options dialog box.
  3. Insert a text object into the Details section of the report.

  4. Click the text object frame to put the object in move/resize mode.
  5. Drag the resizing handle on the right side of the object to the right edge of the Design tab. This will make the object about eight inches wide, the approximate width of a page. You may have to stop resizing, scroll the window, and resize some more to accomplish this.

  6. Double-click inside the text object to place it in edit mode. It is now ready for you to begin your work. The insertion point appears at the extreme left, inside the object.


Inserting a date

  1. To insert a date into the letter, double-click Special Fields in the Field Explorer dialog box and scroll until you find Print Time.
  2. Click Print Date and drag the placement frame into the text object and place it at the insertion point.

    Note: To change the way the date is formatted in the letter, double-click the border of the text object to select it. Then right-click the Print Date field and choose Format [Print Date] from the shortcut menu. Make your modifications on the Date/Time tab of the Format Editor when it appears.

  3. Press Enter twice to insert some white space between the date and the inside address and to move the insertion point down within the text object.


Creating an inside address

  1. To create the inside address, drag database fields into the text object from the Customer table in the Field Explorer dialog box.
  2. Drag in the Address 1 field and place it at the insertion point, and press Enter. The insertion point moves down to the line below.
  3. Drag in the City field and place it at the insertion point.
  4. Type a comma, followed by a space.
  5. Drag in the Region field and place it at the insertion point.
  6. Type in two spaces.
  7. Finally, drag in the Postal Code field, place it at the insertion point, and press Enter. The insertion point moves down to the line below.
  8. Press Enter one more time to move the insertion point down one more line to the position where the salutation should start. This completes the inside address.

Note: When a field is placed within a text object, it is automatically trimmed on both the left and right sides, so that it contains no extra white space.


Creating a salutation

  1. Press Enter four times to move the insertion point down.
  2. Type in the word "Dear" and a space (do not include the quotation marks).
  3. In the Field Explorer dialog box, highlight the Contact Title field from the Customer table and drag it into the text object, placing it immediately after the space.
  4. Insert a space. The program positions the insertion point immediately after the space.
  5. In the Field Explorer dialog box, drag the Contact Last Name field into the text object and place it at the insertion point. The insertion point moves to the right of the field.
  6. Type a colon ":" at the insertion point (without the quotation marks) and press Enter twice to move the insertion point down two lines.


Creating the letter body

  1. Now type "Your company" (do not include the quotation marks) and type a comma followed by a space.
  2. Drag the Customer Name field into the text object and place it at the insertion point, just after the space.
  3. Type a comma, followed by a space.
  4. Type the following text (do not include the quotation marks): "helped make this year an outstanding year for Xtreme Mountain Bikes, Inc. I want to thank you and your staff for your support. I hope 2000 will be a banner year for you."
  5. Press Enter twice.
  6. Type "Sincerely yours" (without the quotation marks), followed by a comma, and then press Enter four times.
  7. Finally, to complete the form letter, type your name.

    The Design tab should look similar to this:

  8. Click Print Preview on the Standard toolbar to preview the form letter.

    It should look similar to this:


Printing conditional messages in form letters

It is likely that you will want to print conditional messages in form letters. For example, you may want to encourage customers with available credit to buy more and those who are over their credit limit to bring their accounts down below the limit once again. You can create both of these letters within a single report.

To create a conditional message
  1. Use the Section Expert to insert a second Details section in the report. See Working with sections.
  2. Create two form letters. Place a letter that encourages customers to buy more in the Details A section of the report; place a letter that encourages customers to bring their balance down in the Details B section of the report. See Creating a form letter using a text object.
  3. Use the Section Expert to format the Details sections so that each is suppressed under certain conditions.

Now, when a record indicates available credit, the buy more letter will print. When the account is over the credit limit, the over limit letter will print. And when the customer is right at the credit limit, nothing will print at all.

Related topics

Formatting objects conditionally.

Working with conditional formatting.


Formatting

Formatting refers to changes in the layout and design of a report, as well as the appearance of text, objects, or entire report sections. This section details methods you can use to draw attention to data, change the presentation of dates, numbers, and other values, hide unwanted sections, and perform a variety of other formatting tasks to give a report a professional appearance.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample reports installed with Seagate Crystal Reports which demonstrate various formatting features are:

  • Formatting.rpt
  • Hyperlinks.rpt
  • Inventory CrossTab.rpt
  • Mailing Label.rpt
  • Order Packing List.rpt
  • Product Catalog.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


Formatting concepts

This section explains how to format a report. Formatting refers to changes you can make to the layout and design of a report, as well as the appearance of text, objects, or entire report sections.

You can use formatting to do many things, including:

  • dividing sections of a report
  • calling attention to certain data
  • changing the presentation of dates, numbers, Boolean values, currency values, and text strings
  • hiding unwanted sections
  • giving the report a professional appearance.

The following topics describe the types of formatting you can do with Seagate Crystal Reports, giving step-by-step instructions for performing a variety of formatting tasks.

Note: There are many date formats you can choose to use on an English report, but if you send the report to a Japanese system, there may be some formatting irregularities. Not all English date formats are viewable on a Japanese system, and the same is true going from Japanese to English. For instance, abbreviated English months do not appear on a Japanese system and Japanese eras in short format do not appear on an English system.


Using the Report Design Environment

Design solutions

There are several things to keep in mind when designing reports that are distributed to different environments. For the best results, consider:

  • section characteristics
  • making an object underlay a following section
  • pre-printed forms
  • hiding report sections
  • hiding report objects
  • placing text-based objects
  • placing multi-line, text-based objects
  • importing text-based objects from a file
  • spacing within text-based objects
  • overflow field representation
  • selecting multiple objects
  • free-form placement
  • vertical placement
  • TrueType fonts
  • page margins
  • default printer
  • printer drivers.


Section characteristics

A report consists of several sections, including the Report Header, Page Header, Group Header, Details, Group Footer, Page Footer, and Report Footer.

Each report section is made up of a series of lines. When a text-based object is placed in a section, it is placed on a line in such a way that the text is aligned to the baseline. The line's height is then adjusted by the printer driver so that it is high enough to accommodate the object.

  • If you place another text-based object on the same line with a font size larger than that of the first object, the line's height extends to accommodate the second object.
  • If you place another text-based object on the same line with a font size even larger than the previous two objects, the line's height extends to accommodate the third object.

A line's height is determined by the text-based object with the largest font size on the line.

As you add text-based objects to a report, either in the same section or other sections, the line height adjusts to accommodate the various fonts. Since this vertical spacing is set up by the printer driver, it is difficult to create reports designed for pre-printed forms when they are printed in various environments.

When designing reports, you should do the following:

  • always print a test page
  • keep all font sizes the same
  • be sure to print pre-printed forms on the same machine.


Making an object underlay a following section

Using this example, you can make the Xtreme logo (Xtreme.bmp) underlay multiple sections. This procedure is similar to the one for inserting a company watermark to serve as a report background.

To make an object underlay a following section, first place the object in the section above the section you want it to underlay. Then select the Underlay Following Sections check box in the Section Expert for the section in which the object is placed.

To create a basic report
  1. Create a report using the Customer table in Xtreme.mdb.

    The Xtreme.mdb file is located in the \Program Files\Seagate Software\Crystal Reports\Samples\Databases directory, or the directory in which the program resides.

  2. Place {customer.CUSTOMER NAME} and {customer.LAST YEAR'S SALES} side-by-side in the Details section of the report.
  3. To remove unnecessary objects from this example, delete the field titles that the program places in the Page Header section of each field.
  4. On the Insert menu, click Group to break the data into regional groups.
  5. On the Common tab of the Insert Group dialog box, select {customer.REGION} as the sort and group by field.
  6. Click OK.
To insert a picture onto the report
  1. On the Insert menu, click Picture.
  2. Select the Xtreme.bmp file, then place it in the Page Header section, to the right of the report body.

    The Xtreme.bmp file is located in the \Program Files\Seagate Software\ Crystal Reports\Samples\Databases directory, or the directory in which the program resides.

    Note: In this example, the picture is placed to the right of the fields to avoid underlaying the text. When you are working with a watermark, a subdued picture designed to be nearly invisible, place it directly above the text.

  3. On the Standard toolbar, click Print Preview.

    The picture prints first (entirely in the Page Header section), then the body of the report follows.

  4. Once you are finished previewing the report, return to the Design tab.
To make the picture underlay the following section
  1. On the Format menu, click Section.

    The Section Expert dialog box appears.

  2. In the Sections list, click Page Header, then select the Underlay Following Sections check box.
  3. Click OK to preview the report again.

    The picture now prints in both the Group Header and Details sections, next to (instead of above) the text in the body of the report.

    Note: Using the technique of placing a picture to the right of the body of the report, you can set up a chart or an employee picture to print beside the details pertaining to that chart or employee.

  4. Once you are finished previewing the report, return to the Design tab.
  5. Resize the object vertically to make it two or three times larger, then preview the report again.

    The bitmap file now underlays more sections.

The area in which the picture underlays depends on the following conditions:

  • the size of the picture
  • the section in which the picture was originally placed
  • the position of the picture in the section.

By modifying size and placement of an object, you can create a variety of visual effects, using the underlay feature.


Pre-printed forms

If you print on pre-printed forms, you will be able to:

  • scan a form
  • place it in the report as a bitmap
  • use the underlay feature to line up the bitmap and report, as well as move objects anywhere you want them to appear
  • eliminate the need to print the forms separately by printing the report and the form as a single unit.

Hiding report sections

Seagate Crystal Reports has three properties you can set in the Section Expert to hide report sections.

Hide (Drill-Down OK)

The Hide property hides a section whenever you run the report. For example, in a summary report, the Hide property can be used to display only the summaries, but not the details behind the summaries. When the Hide property is applied to a section, it becomes visible when the Drill-down cursor is used to drill down on the section contents. This property is absolute; it cannot be conditionally applied using a formula.

Suppress (No Drill-Down)

The Suppress property also hides a section when you run the report. Unlike the Hide property, however, you cannot apply the Suppress property, then drill down to reveal the section contents. This property can be applied absolutely, or conditionally using a formula. This is useful for writing form letters. For example, in a form letter, you might create two Details sections: one to suppress when sales are over $X and one to suppress when sales are under $X.

Suppress Blank Section

The Suppress Blank Section property hides a section whenever there is nothing in it. If something is placed within the section, then it becomes visible.


Hiding report objects

Seagate Crystal Reports has three formatting options in the Format Editor for hiding individual objects.

Suppress If Duplicated (Common tab)

The Suppress If Duplicated property prevents a field value from printing if it is identical to a duplicate of the value that comes immediately before it.

The value does not print, but the space in which it would have printed remains.


Suppress If Zero (Number tab)

The Suppress If Zero property prevents a value from printing if it is a zero value. The value does not print, but the space in which it would have printed remains. To remove the blank space, select the Suppress Blank Section check box in the Section Expert.

Note: This will only work if there are no other objects in the section.Use the Section Expert to eliminate blank lines in this situation, then clear the Suppress Blank Section check box for the section that the field is in. This will eliminate the lines as long as there are no other objects in the section.

Suppress (Common tab)

The Suppress property hides an object when you run the report. For example, it is common to apply this property to formulas that are needed to do some report calculations, but that you do not want to print when you run the report. When you select this property, the selected object does not print.

Note: You can click the Conditional Formula button for any of these properties and create a formula that will make the setting conditional on some event. See Working with conditional formatting.

To set these properties, select the object, then click Object Properties from the Supplementary toolbar to open the Format Editor dialog box. When the Format Editor appears, set the properties.


Placing text-based objects

When a text-based object is placed on a report, the object is represented by an object frame. The height of the object frame is based on the height of the font. The width, however, is determined differently, depending on the object you are working on.

  • For database fields that are not memo fields, the width is initially determined by the width of the field as defined in the database, and by the average character width as provided by the selected font and font size.

    For example, you have a database field called {customer.LAST NAME} and your database defines this field as a text field with a length of 35 characters. When you place this field on your report, the width of the boundary is 35 times the average character width of the font and font size that the database field is formatted to. Remember that this is the initial default boundary width. The width can always be resized to increase or decrease as you see fit.

  • For text-based objects, the default width is approximately 17 average character widths wide. Objects are different from database fields in that their width automatically expands as you enter in text and/or database fields into the object. As with all other text-based objects, the width can be resized by the user.
  • For different number fields (double, single, integer, long integer, and byte) the default widths are all different. As with all text-based objects, the width can be resized by the user.


Preventing the truncation of text inside an object

Whether the default widths are accepted or the text-based objects are resized, a problem could arise if the text inside the object prints right to the edge of the object frame. While the report may look fine on the machine it was designed on, when the report is printed using another printer driver that measures the font wider, the length of the text grows, but the object frame remains fixed. The resulting text is cut-off or truncated.

To prevent the truncation of text inside an object
  1. Right-click the object you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Format Text.

    The Format Editor dialog box appears.

  3. On the Common tab, select the Can Grow check box.
  4. Click OK to save your changes.

    The object is then formatted to print on multiple lines. If the text prints wider than the object, the text wraps onto additional lines.


Preventing breaks in non-spacing text inside an object

For text strings that do not contain spaces, such as single words, the text string is broken at the edge of the object frame before the line starts to wrap.

To prevent the breaks in non-spacing text inside an object
  1. Select the object you want to format.
  2. Expand the object frame to make it wider than the widest block of text inside the frame.

There are many times when the actual text in a database field is far less than the maximum amount the field can contain. For example, a {table.LAST NAME} field is designed with a field size of 80 and the longest name in the database is 28 characters. In this case, when you first place the field in your report, the field is 80 times the average character width. Reduce the width of the field, but include enough space to account for growth.

While each of these options offers an effective solution when dealing with a single text-based object in a section, there are still design considerations to take into account when placing more than one object in a section. When sizing an object, consider its placement with regard to other objects in the section.

Avoid designing reports where the space between each object is very tight. Leave room for growth by expanding the width of the object by approximately 5 per cent. Or, if this is not possible, consider reducing the size of the font.


Placing multi-line, text-based objects

While text-based objects that are formatted to print on multiple lines follow the same design rules as other objects, they have one additional characteristic to be considered. If the printer driver expands or contracts the spacing of the text, word wrapping may differ, changing the number of lines necessary to print the object in order to accommodate growth or shrinkage.

When placing multi-line, text-based objects, you could encounter problems if other objects in the same section are placed directly below them.

Unlike single-line, text-based objects, expanding the object frame of a multi-line, text-based object to accommodate growth is not a viable option. When you do this, the line width increases according to the expanded boundaries.

So, when possible, place multi-line, text-based objects at the bottom of a section. If they require more lines to print, the section expands downward to accommodate the growth, and they do not endanger other objects.


Importing text-based objects from a file

Using Seagate Crystal Reports, you can import a formatted, text-based object from an existing file onto your report.

To import text-based objects from a file
  1. Double-click the text-based object you want to format, then right-click it to bring up the shortcut menu.
  2. On the shortcut menu, click Insert from file.
  3. In the Open dialog box that appears, select the file in which your text-based object is stored, then click Open.

    The object is imported from the file onto your report, replacing the object you selected to format in Step 1.


Spacing between text-based objects

Use the grid and guidelines options to help evenly align text-based objects.

You can select the Snap To Grid option, set the grid to a maximum of one inch, and make the grid visible or invisible on the Design tab, Preview tab, or both. For more information on working with grids, see Using the grid.

You can also work without a grid, placing objects wherever you want them on a report. You may want to work in a free-form environment while retaining the ability to align objects, or to move or resize them as a group. You can do this using guidelines. See Using guidelines.

Using the grid

The grid is a series of row and column coordinates. When the grid is selected, Seagate Crystal Reports enables you to place text-based objects only at these coordinates, not between them. You can then space data on your report and align objects as needed. If you attempt to place an object between grid coordinates, the object "snaps" to the grid; that is, the object automatically moves to the nearest set of row and column coordinates.

Each report section contains a design grid. You can select the grid on or off, as well as set it to different sizes when required. By default, the grid is not selected. See Selecting the grid.

Once set, the grid remains the same size for all sections. It is measured from the upper-left corner of each section and continues down and to the right, until the end of the section. A new grid of the same size then starts from the upper-left corner of the next section, and so on, through the end of the report.

If you select the Snap To Grid option, the following conditions occur:

  • The upper-left corner of all newly placed, text-based and OLE objects snap to a grid point.
  • Objects placed on a report before the Snap To Grid option is selected do not snap to the nearest grid point. They remain in the same place.
  • If you resize an object, the side or sides that you are resizing snap to the nearest grid point.


Selecting the grid

The Design and Preview tabs have an underlying grid structure that you can activate on the Layout tab in the Options dialog box.

To select the grid
  1. On the File menu, click Options.

    The Options dialog box appears.

  2. On the Layout tab, in the Grid options area, you can show the underlying grid structure on the Design or Preview tab, or both, select free-form placement, and specify grid size.
  3. Click OK to save your changes.


Using guidelines

Seagate Crystal Reports provides guidelines to help you accurately place objects on your report. Guidelines are non-printing lines that you can place anywhere on the Design and Preview tabs to aid in alignment. They have a snap property that automatically snaps objects to them.

However, the snap property of guidelines works differently for text-based objects than other objects, such as OLE objects. When a text-based object snaps to a guideline, it is the baseline of the text, not the object frame that snaps to the guideline.

Note: You can find the baseline of a text-based object by locating the special indicators positioned on either side of the object directly at the baseline.

To place several text objects of different font sizes on one line with their baselines lined up, snap them to a guideline at the baseline indicator.

Becoming familiar with the properties and functionality of the grid and guidelines requires some experimentation.

If you select the Snap To Grid option and you do not select the Free-Form placement option, the following conditions occur:

  • All objects snap to the guidelines for vertical placement.
  • The left boundary snaps to both vertical guidelines and grid points.


Viewing guidelines

You can view guidelines on the Design and Preview tabs by selecting the view options in the Options dialog box.

To view guidelines
  1. On the File menu, click Options.

    The Options dialog box appears.

  2. On the Layout tab, in the View options area, select the Show Guidelines in Design check box and/or the Show Guidelines in Preview check box.
  3. Click OK to save your changes.


Inserting guidelines

Seagate Crystal Reports automatically inserts guidelines in certain situations.

  • Whenever you add a field or formula field to a report, the program creates a guideline at the left edge of the field frame and snaps the field and field title to it.
  • When a field is summarized, the program snaps the summary to the same guideline to ensure proper alignment.
  • When you right-click the shaded areas to the left of a section, then select the Arrange Lines option from the shortcut menu, the program creates one or more horizontal guidelines in the section and snaps the fields
    to them.

There are times when you want to manually insert guidelines.

Each guideline is attached to an arrowhead on its originating ruler.

Note: If you select the Snap To Grid option, you can only insert or move guidelines in grid increments.


Positioning objects using guidelines

Guidelines consist of a snap property that automatically snaps objects to them. That is, objects connect to the guidelines as positioning devices.

Objects can snap to a horizontal guideline on the top, horizontal midline (the invisible line that bisects an object horizontally), or bottom.

Objects can snap to a vertical guideline on its left side, vertical midline (the invisible line that bisects an object vertically), or right side.

When a guideline has its snap property selected and the guideline is moved, all objects snapped to the guideline are moved. The snap property can be selected on the Layout tab in the Options dialog box. See Using the grid.

Note: When a guideline is moved, any object that is snapped to it is moved as well. But if you move an object that is snapped to a guideline, the guideline does not move.


Snapping objects using guidelines

You may have two or more objects that you want to resize and they are either the same size (height or width) or different sizes. The process for resizing with two guidelines is the same in either case.

To snap objects using guidelines
  1. Create a guideline.
  2. Snap one side of the object to that guideline.

  3. Create a second guideline to the right of the object.

    Note: The guideline should not be touching the object.

  4. Click the object to activate the sizing handles.

  5. Drag the resizing handle over to the second guideline.

    .

  6. For each additional object you want to snap to both guidelines, repeat Steps 2 through 5.
  7. If the objects are not the desired size, drag one or both of the guidelines until the objects are the correct size.


Resizing objects using guidelines

If you snap an object to guidelines on two sides (top and bottom, or left and right), you can resize the object by dragging one or both of the guidelines. This is especially useful if you need to resize a number of objects similarly at the same time.

To resize objects using guidelines
  1. Snap the objects to the guidelines.
  2. Drag one of the guidelines to resize the objects.


Indenting lines

Using Seagate Crystal Reports, you can control line indentation for memo fields, string fields, and text-based objects. For objects, you have the option of indenting lines for a particular paragraph by positioning the cursor at the start of that paragraph. Or, if you select an object in its entirety, you can apply the same indenting specifications to all the paragraphs within that object.

Keep in mind that any line following a carriage return will be considered the first line of a new paragraph.

To indent lines
  1. Right-click the field or object you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Paragraph Formatting.

    The Format Editor dialog box appears with the Paragraph Formatting
    tab open.

  3. In the Indentations area, you can indent the first line of the paragraph; indent every paragraph line from the left margin; and indent every paragraph line from the right margin.

    Note: Only indentation values within the range of the field or object width are accepted.

  4. Click OK to save your changes.


Overflow Field Representation

Seagate Crystal Reports uses Overflow Field Representation to assist users when working with numeric or currency values in report cells. Normally, if a numeric or currency value is larger than the field containing it, that value is truncated, or "clipped." For example, values like 100,000,000 might appear on the report as 1,000, or as 000 (depending on the properties you have set). This could potentially cause confusion when the report is read.

When the Allow Field Clipping option is cleared, numeric/currency field values that exceed the field size will be represented by number signs (######) in the Preview tab, letting you know immediately when the field is too small.

To allow for overflow field representation
  1. Right-click the currency field or number field you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Format Field.

    The Format Editor dialog box appears with the Number tab open.

  3. Click the Customize button.

    The Custom Style dialog box appears with the Number tab open.

  4. To allow overflow field representation, clear the Allow Field Clipping check box.

    Note: You also have the option to click the Format button to enter a formula in the Format Formula Editor. In the Format Formula Editor, you can specify that field clipping will be disabled only when certain conditions are met.

  5. Click OK to save your changes.

To view the results, refresh the report. If you disabled field clipping, any numeric/currency field values that are larger than the fields containing them will be represented by number signs (######).


Selecting multiple objects

You can select multiple objects, including text, field, chart, map, bitmap, OLAP grid, Cross-Tab and OLE objects, to format them together.

Once you have selected multiple objects, you can move, align, size, cut, and copy and paste them as a group. You can also change their font, color, and paragraph style.

Objects are moved, aligned, and sized based on a "main" object, which is usually the last object you select. You can change the main object to another by right-clicking the desired object.

Note: When moving multiple objects, if the new location does not accommodate all of the selected objects, but can accommodate the main object, then the main object and those objects that can be accommodated will be moved. The other objects will remain in their original position.

To select multiple objects
  1. Click one object, and Ctrl-click the other objects you want to select.
  2. Right-click the main object.
  3. On the short-cut menu, select the appropriate formatting option.


Free-form placement

You may also want to use Seagate Crystal Reports without a grid, in a free-form environment similar to that of a drawing program. Free-form means that you can place objects anywhere you want them to appear on your report. Your only restriction is that the program does not allow you to place chart and Cross-Tab objects on the Page Header, Page Footer, or Details section.

To work in a free-form environment, select the Free-Form Placement option on the Layout tab in the Options dialog box.

Free-form placement on

In order to create dynamic reports and reduce printer driver dependency as much as possible, it is recommended that all sections of the report be formatted with the Free-Form Placement option turned on. This is especially true if your report includes OLE objects such as charts, boxes, lines, and bitmapped images (e.g. company logos).

When a section is formatted with free-form placement, all objects can be placed anywhere on that section. Seagate Crystal Reports places objects within a section based on their absolute coordinates. These coordinates determine the vertical placement of objects on your report. What this means is that you control the vertical placement of single-line, text-based objects rather than the printer driver. In doing so, you can better protect your reports from printing inconsistencies caused by using different printer drivers.

However, while the printer driver no longer controls the vertical spacing of text-based objects within the sections, it still determines horizontal spacing of text within the text-based objects, as well as the inter-line spacing of multi-line, text-based objects. So, while free-form placement gives you better control, you must still take into account these considerations when designing your reports. See Placing multi-line, text-based objects.


Free-form placement off

If a section has the Free-Form Placement option turned off, the program no longer references the object's absolute coordinates to determine where it prints, except under the following conditions.

  • The absolute x coordinate is still referenced to determine where each object begins printing horizontally (left and right placement).
  • The y coordinate is still referenced for vertical placement of the object, but the coordinates may be adjusted by the Crystal Reports Designer when the printer driver changes.

So, if the report is printed using a printer driver that measures inter-line spacing greater than the original printer driver, the y coordinate increases and the text-based object prints farther down the page. With the Free-Form Placement option turned off, the user no longer controls the vertical placement of text-based objects; the printer driver determines that instead.

However, the placement of OLE objects such as graphics, boxes, and lines is not controlled by the printer driver. Therefore, when placing and printing, the Crystal Reports Designer always references the absolute coordinates of these objects. Due to the various placement methods, problems can arise when both text-based objects and OLE objects are placed on a report.

For example, a box (OLE object) is placed around a database string field (text-based object). Everything looks great and everything is aligned as it should be. However, if the report is printed using a printer with an especially high measurement for inter-line spacing, then the following conditions occur.

  • The placement of the box does not change relative to the section in which it is placed (the x and y coordinates do not change).
  • The vertical placement of the text-based object changes because the y coordinate is adjusted upward.

Note: The value is a measurement from the upper-left corner of the section; so, the greater the value, the farther down the page the object prints.

If you are distributing reports that have sections formatted with the Free-Form Placement option turned off, and you want the objects in those sections to be surrounded by a border or formatted with lines, it is better to modify the objects' border properties than to insert lines and boxes. This way, the borders always stay with the objects. Right-click the object, then select the Change Border option from the shortcut menu. See Adding borders, color, and shading to a field.

Remember, any section can be formatted with the Free-Form Placement option turned on or off. While it is better to turn the option on in some cases and not in others, it is highly recommended that every section of your report be formatted in the same manner.


Free-form placement using guidelines

You may want to work in a free-form environment while retaining the ability to align objects, or to move or resize them as a group. You can do this using guidelines.

Guidelines are lines that extend vertically or horizontally from the Design and Preview tabs. Guidelines have a snap property. When you move an object within a guideline's magnetic range, the object snaps, or attaches itself, to the guideline.

  • Once an object is snapped to a guideline, if the guideline is moved, the object also moves.
  • If you have several objects snapped to a guideline, they all move when the guideline is moved.
  • If you have several objects snapped to a guideline on two sides (right and left, or top and bottom) and one of the guidelines is moved, all of the objects resize similarly.

Using guidelines in a free form environment provides flexibility with control. See Using guidelines.


Vertical placement

On the Common tab of the Format Editor, you can use the text rotation options to vertically align the fields and text-based objects on your report.

When you select a text rotation of 90 degrees, the text shifts 90 degrees in a counter-clockwise direction.

When you select a text rotation of 270 degrees, the text shifts 270 degrees in a counter-clockwise direction.

Note:

  • If text rotation is left at 0 degrees, your report is horizontally formatted, left to right.
  • For text rotation of text-based objects, the Can Grow option that prevents the truncation of text inside an object is automatically cleared. For more information on the Can Grow option, see Preventing the truncation of text inside an object.
  • Vertically formatted text that spans over the edge of the page cannot be displayed as part of your report.
  • Text rotation cannot be used with non-formatted text that appears as a printer or TrueType font.


Inserting character and line spacing

With Seagate Crystal Reports, you can specify the amount of spacing between characters or lines for memo fields, string fields, and text-based objects.

To insert character and line spacing
  1. Right-click the field or object you want to format to bring up the
    shortcut menu.
  2. On the shortcut menu, click Change Font.

    The Format Editor dialog box appears with the Font tab open.

    You will use this tab to set up the character spacing values.

  3. In the Spacing area, in the Character spacing exactly field, specify the value n that each character occupies.

    The value n is defined as the distance in number of points measured from the start of one character to the start of the next. When you change the character spacing, you change only the spacing between adjacent characters, not the font size of the characters.

    For example, if you specify a 14-point font with a character spacing of 14 points, each character will remain as a 14-point font size, occupying a space that is 14 points wide.

  4. Click the Paragraph Formatting tab.

    You will use this tab to set up the line spacing values.

  5. In the Spacing area, in the Line spacing field, specify the line spacing as a multiple of the font size you are using, or as an exact number of points.
  6. Click OK to save your changes.


Inserting fractional font sizes

On the Font tab of the Format Editor, you can select a fractional font size for database fields and text-based objects on your report.

To insert fractional font sizes
  1. Right-click the field or object you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Change Font.

    The Format Editor dialog box appears with the Font tab open.

  3. In the Size list, select a fractional font size for the field or object.
  4. Click OK to save your changes.

Note: You cannot select a fractional font size for every report you work with by selecting the options on the File > Options > Fonts tab. You can only select a fractional font size for individual database fields and text-based objects.


TrueType fonts

Designing your report with printer-specific fonts can lead to problems when using different printers. The fonts may not be supported by the other printers, or if they are supported, the fonts may not be installed on the printers.

During the printing process, if you encounter printer-specific fonts that are unrecognizable to the printer driver, Seagate Crystal Reports substitutes the fonts, creating inconsistent results. To avoid this situation, only common TrueType fonts should be used when designing reports.


Page margins

Setting specific margins

Seagate Crystal Reports gives you the option of setting margins to meet your specifications.

To set specific margins
  1. On the File menu, click Page Setup.

    The Page Setup dialog box appears.

  2. Change the default page margins to fit your needs.
  3. Click OK to save your changes.

Note: All margins are calculated from the paper edge. Thus, a left margin of .25 inches causes the printing to start exactly one quarter inch in from the edge of the paper.


Using default margins

If you decide to design your report using the default margins, the following problems may occur.

  • When printing a report in another environment where the printer's default margins are greater than its setting, the report objects on the right side of the report print off the page.
  • When printing a report in another environment where the printer's default margins are smaller (allowing a larger printing area), the entire report moves to the left side of the page.

It is recommended that you always set your own margins. Even if the margins you want to use are the same as the default margins, be sure that the Use Default Margins option in the Page Setup dialog box is not selected, and you set your margins manually using Page Setup.


Default printer

In general, it is a good idea not to choose a specific printer. Even though the printer may be identical to the default printer, how the printer is recognized can still vary for different operating systems.

For example, an HP Laser III printer is being installed on three different operating systems.

  • With Microsoft Windows 95 and 98, the printer name can be changed so that HP Laser III is Front Reception Printer, but the printer driver will be listed as HPPCL5MS.DRV.
  • With Microsoft Windows NT, the printer name is also referenced and can be changed by the user, but the printer driver is always WINSPOOL.

If you select a specific printer, Seagate Crystal Reports looks for that printer by name. If the printer you selected cannot be found, the default printer is chosen, resulting in the possibility of printing inconsistencies.

When selecting a specific printer, such as a label printer or a printer dedicated to printing invoices, the printer name must be the same as the name of the printer the report was designed on. Be aware that anyone printing the report must use that same printer or they could encounter problems.

Note: If your report is part of an application that you are distributing, you can provide a Select Printer dialog box. Using this dialog box, users of your report can choose the correct printer or rename the printer accordingly.


Setting page orientation and paper size

You can print your reports using either portrait or landscape orientation, and in a variety of paper sizes. You can specify these options using the Printer Setup command from the File menu.

To set page orientation and paper size
  1. On the File menu, click Printer Setup.

    The Print Setup dialog box appears.

  2. In the Printer area, in the Name list, select the printer you want to use, if it is not already the default printer.
  3. In the Paper area, in the Size and Source lists, select the desired paper.

    The paper size options are directly related to the printer you select. For example, the HP LaserJet driver (PCL) offers a choice of letter, legal, executive, or A4 paper sizes, whereas the PostScript printer driver lets you choose from letter, legal, note, A4, B5, letter small, and A4 small paper sizes.

  4. In the Orientation area, click Portrait or Landscape.
  5. Click OK to save your changes.


Printer drivers

Updating printer drivers

In order to maintain performance, Seagate Crystal Reports queries the printer driver for each of the font elements (font metrics), such as average character height, character width, height of the ascenders and descenders, internal leading, and so on. A problem may develop if using an older printer driver that does not return the font metrics accurately. If you are experiencing problems when printing (missing fields, incorrect formatting, and so on), it is recommended that you obtain and install the most recently updated drivers for your printer. In many cases, the newer printer drivers provide accurate font metrics and any printing issues are quickly resolved.


Inconsistencies due to printer drivers

When printing, inconsistencies may occur if different printer drivers are used to create and print your reports. These inconsistencies are a result of the various methods that individual printer drivers use to measure text metrics such as font size. When printed, text-based objects may be misaligned, truncated, or overprint each other. Examples of text-based objects include string or character fields, text objects, memo fields, numeric fields, and formula fields.

Problems such as these may arise when you have:

  • two identical printers, but each one is using a different printer driver
  • two different printers using the same printer driver
  • two different printers using different printer drivers
  • one printer driver that uses the TrueType font and a second printer driver that maps TrueType fonts to PostScript fonts
  • two identical printers using the same printer driver, but each one is printing from a different version of Microsoft Windows
  • two identical printers using the same printer driver, but the printer drivers are different versions
  • two identical printers, two identical printer drivers, and two identical operating systems, but the resolution of the video drivers is different.

Therefore, while a document using one printer driver may require six full lines to display a block of text:

  • using a second printer driver that measures fonts narrower could result in the same block of text requiring less than six full lines
  • using a third printer driver that measures fonts wider could require more than six full lines.

For the most part, this situation cannot be avoided. The goal of the report distributor is to design reports that accommodate printer driver dependency and still print consistently using different printer drivers. To do this, Seagate Crystal Reports provides several design solutions. If taken into account when creating your report, these solutions can ensure proper printing and distribution for your report in almost any environment.


Formatting properties

You can set formatting properties using the Format Editor for objects and the Section Expert for report sections. In most cases, you can set one of two types of properties:

  • absolute (always apply the property)
  • conditional (apply the property only if certain criteria are met).


Working with absolute formatting

Absolute formatting is formatting that applies under any condition. This type of formatting property always follows a select, then apply procedure. For example, you select what it is that you want to format (object or section), then you apply the formatting to the selection using property settings.

You can use the following dialog boxes to format your reports:

  • Format Editor to format field values
  • Section Expert to format entire sections
  • Highlighting Expert to conditionally format currency and number fields.

Each of these dialog boxes contains a number of different formatting properties, as well as the tools for turning the properties on or off and specifying attributes.


Adding borders, color, and shading to a field

Seagate Crystal Reports allows you to add borders, color, and shading to fields on your report in order to emphasize important data and create professional-looking reports.

To add borders, color, and shading to a field
  1. Right-click the field you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Change Border.

    The Format Editor dialog box appears with the Border tab open.

  3. Select the line style, color, and background color of the field.
  4. Click OK to save your changes.


Adding and editing lines

Seagate Crystal Reports allows you to add lines to a report to emphasize important data and create professional-looking reports.

To add lines to a report
  1. On the Supplementary toolbar, click Insert Line.

  2. Use the pencil cursor to draw the line where desired.
To edit lines on a report
  1. Right-click the line you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Format Line.

    The Format Editor dialog box appears.

  3. On the Format Line tab, make the desired changes to the line.
  4. Click OK to save your changes.


Adding and editing boxes

Seagate Crystal Reports allows you to add boxes to a report to emphasize important data and create professional-looking reports.

To add boxes to a report
  1. On the Supplementary toolbar, click Insert Box.

  2. Use the pencil cursor to draw the box where desired.
To edit boxes on a report
  1. Right-click the box you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Format Box.

    The Format Editor dialog box appears.

  3. On the Format Box tab, make the desired changes to the box.
  4. Click OK to save your changes.


Adding shapes to a report

When designing report formats in Seagate Crystal Reports, you can insert a variety of shapes such as circles, eclipses, and boxes with rounded corners, as part of your report. This is especially useful for formatting reports in languages that require these shapes to effectively communicate.

To add shapes to a report
  1. Add a box to your report.

    See Adding and editing boxes.

  2. Right-click the box to bring up the shortcut menu.
  3. On the shortcut menu, click Format Box.
  4. In the Format Editor that appears, click the Rounding tab.

  5. Move the slider to the right to increase the curvature of the box corners.

    The box that you started with gradually changes to an ellipse or circle, depending on how far you move the slider to the right.

  6. Once the appropriate shape is created, click OK to save your changes.


Adding accounting conventions to a report

As a way of supporting the conventions used in the accounting profession, Seagate Crystal Reports lets you decide on how to display the currency symbol, negative values, and zero values on your financial reports. You can also set up your report to reverse the signs for credit and debit amounts.

To add accounting conventions to a report
  1. Right-click the currency field or number field you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Format Field.

    The Format Editor dialog box appears with the Number tab open.

  3. In the Style area, select how you want the system number format to appear for either positive or negative values.
  4. In the Currency Symbol (system default) area, specify how you want the currency symbol to appear with the values on your report.
  5. Click OK to save your changes.
To customize the accounting conventions for a report
  1. Right-click the currency field or number field you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Format Field.

    The Format Editor dialog box appears with the Number tab open.

  3. In the Style area, select Custom Style, then click the Customize button.

    The Custom Style dialog box appears with the Number tab open.

  4. Select the Use Accounting Format check box.

    Once you select this option, the following conditions occur:

      • In the Negatives list, how the negative values appear on your report are determined by the Windows locale settings. The negative values are represented by either a minus sign or brackets.
      • In the Show Zero Values as list, the dash symbol is automatically selected to represent zero values on your report.
      • On the Currency Symbol tab of the Custom Style dialog box, the currency symbol is positioned on the left-side of the currency and numeric values.

        Note: Changes made to the Windows locale settings are implemented only after you exit and restart Seagate Crystal Reports.

  5. Select the Reverse Sign for Display check box to reverse the signs for debit and credit amounts in your financial reports.
  6. Click OK to save your changes.
  7. Click OK again to return to your report.


Using white space between rows

The height of a section in relation to the objects within it affects the amount of white space that appears between rows on the report.

The free-form Design tab lets you add and delete white space in two ways:

  • using the Resizing cursor to resize the area on the Design tab
  • changing the option in the Section Expert.

Note: You can also right-click the shaded area to the left of the section and select Fit Section from the shortcut menu. The program automatically resizes the section so that the bottom boundary is even with the baseline of the bottom object in the section.


Adding white space by resizing

To add extra white space between rows in the report, move the pointer over the lower section boundary line. The pointer changes to a Resizing cursor.

Note: White space can also be added to a section by right-clicking the shaded area to the left of the section and selecting Insert Line from the shortcut menu. The program resizes the section automatically, adding the amount of space necessary to hold a line of typical database fields.


Deleting white space by resizing

To delete unnecessary white space within a section, move the pointer over the lower section boundary line. The pointer changes to a Resizing cursor.


Deleting white space by suppressing a section

If an entire section is blank (for example, if you are not putting anything into the Page Footer section of the report), you can eliminate the unnecessary white space by suppressing the section in the Section Expert.

To delete white space by suppressing a section
  1. On the Format menu, click Section.

    The Section Expert dialog box appears.

  2. In the Sections area, click the section you want to suppress.
  3. On the Common tab, select the Suppress (No Drill-Down) check box.
  4. Click OK to return to your report.

    The blank section will no longer be printed.


Working with conditional formatting

Conditional formatting is formatting that applies only under certain conditions. For example, in a report you may only want:

  • customer balances printed in red if they are past due
  • the dates to appear in Day, Month, Year format if the customer is Canadian
  • background color to appear on every other line.

Seagate Crystal Reports makes it easy to apply conditional formatting in these and hundreds of other situations.

With absolute formatting, you follow the select, then apply procedure. For conditional formatting, you follow the same general procedure, but you go a step further and set up conditions that determine whether or not the formatting will be applied. You specify these conditions using simple formulas.For more information on creating formulas using Crystal syntax, see Crystal syntax fundamentals. Or, for more information on creating formulas using Basic syntax, see Basic syntax fundamentals.

When a conditional formatting formula is set up, the formula overrides any fixed settings you have made in the Format Editor. For example, if you select the Suppress option, then set up a conditional formula for the Suppress option, the property will still apply only if the condition in the formula is met.

Seagate Crystal Reports enables you to set both on and off properties and set attribute properties conditionally. However, each of these requires a different kind of formula.


Conditional on or off properties

A conditional on or off property tests to see if a condition has been met. It is on if the condition is met, off if the condition is not met. There is no middle ground. Use Boolean formulas for this kind of formatting.

Crystal syntax example

condition

Basic syntax example

formula = condition

The program tests each value to see if it meets the condition and it returns a "yes" or "no" answer. It then applies the property to every value that returns a "yes" answer.


Conditional attribute properties

A conditional attribute property tests to see which of two or more conditions is met. The program then applies the formatting appropriate to the condition. For example, assume that you want values under quota printed in red and all other values printed in black. The program tests to see whether the value is under quota or not. If it is under quota, then it applies the red attribute; if it is not, then it applies the black attribute.

Use an If-Then-Else formula for this kind of conditional formatting. For Crystal syntax, see If expressions. Or, for Basic syntax, see If statements.

Crystal syntax example
If Condition A Then
    crRed
Else
    crBlack
Basic syntax example
If Condition A Then
    formula = crRed
Else
    formula = crBlack
End If

When conditional attribute properties are set up, Seagate Crystal Reports loads a selection of attributes into the Functions list in the Formula Editor. Double-click any of these attributes to add them to a formula. For example, if you are setting horizontal alignment conditionally, the Functions list contains attributes such as DefaultHorAligned, LeftAligned, and Justified. If you are setting borders conditionally, the Functions list contains attributes such as NoLine, SingleLine, and DashedLine.

You can take this kind of property one step further. You can specify a list of conditions and a property for each; you are not limited to two conditions. For example, if you have a number field on your report that contains sales figures from countries around the world, you can specify the number attribute(s) that you want to apply to each country. In this case, your conditions would specify that if it is from Country A, the program should apply the Country A attribute; if it is from Country B, the Country B attribute; if it is from Country C, the Country C attribute, and so on.

With more than two alternatives, use this kind of formula:

Crystal syntax example
If Condition A Then
    crRed
Else If Condition B Then
    crBlack
Else If Condition C Then
    crGreen
Else
    crBlue
Basic syntax example
If Condition A Then
    formula = crRed
ElseIf Condition B Then
    formula = crBlack
ElseIf Condition C Then
    formula = crGreen
Else
    formula = crBlue
End If

Use a multi-condition If-Then-Else formula for this kind of conditional formatting.


Changing conditional fonts

For memo or string fields that are based on conditions such as a parameter value, you can change the font, font style, size, and color for these fields using the Format Editor.

To change conditional fonts
  1. Right-click the field you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Change Font.

    The Format Editor dialog box appears with the Font tab open.

  3. To change any of the font options, click the appropriate Formula button, located on the right side of the dialog box.
  4. In the Format Formula Editor dialog box, you can specify that conditional fonts will change only when certain conditions are met.
  5. Click Save.

    Note:

      • If there is an error in the formula, a message box appears, asking whether to exit without examining the error. If you click No, a second message box will be displayed, detailing the error.
      • If there is no error in the formula, you are returned to the Format Editor. Note that the Formula button has changed. This indicates that a formula has been entered for that property. Search for Formula Compiler Errors in Seagate Crystal Reports online help.
  6. Click OK to return to your report.


Creating footers after the first page

You may choose to print a page footer on all pages except the first page. You can do this by formatting the Page Footer section conditionally, using an on or off property.

To create footers after the first page
  1. Place the field you want displayed as a page footer in the Page Footer section of the report.
  2. On the Format menu, click Section.

    The Section Expert dialog box appears.

  3. In the Sections area, click Page Footer.
  4. To open the Format Formula Editor dialog box, click the Formula button, located to the right of the Suppress (No Drill-Down) check box.
  5. Enter the following formula in the Format Formula Editor:
Crystal syntax example

PageNumber = 1

Basic syntax example

formula = PageNumber = 1

This formula suppresses the page footer on the first page, but not on any of the other pages.

  6. Click Save.

Note:

  • If there is an error in the formula, a message box appears, asking whether to exit without examining the error. If you click No, a second message box will be displayed, detailing the error.
  • If there is no error in the formula, you are returned to the Section Expert. Note that the Formula button has changed. This indicates that a formula has been entered for that property. Search for Formula Compiler Errors in Seagate Crystal Reports online help.
  7. On the Standard toolbar, click Preview to preview the report and ensure that the page footer appears on all pages but the first.

Note:

  • If you have a multi-line page footer and have inserted the lines into separate Page Footer sections, you will need to suppress each section conditionally, using the formula above.
  • To create a page header that appears on all pages but the first, place the header information in the Page Header section and then suppress that section conditionally, using the same formula that was used for suppressing the Page Footer section.


Using the Highlighting Expert

Seagate Crystal Reports includes the Highlighting Expert that allows you to efficiently apply conditional formatting to currency and number fields. The Highlighting Expert is most commonly used for highlighting field values that are in some way distinguished from the other values in the report. For example, if you wanted to highlight the {customer.LAST YEAR'S SALES} field in red whenever the sales are greater than $25,000, you could specify in the Highlighting Expert that when the value is greater than $25,000, a red background color is applied to the field. You can also use the dialog box to set conditional font color and border style.

Think of the Highlighting Expert as an alternative to the Formula Editor. The Highlighting Expert essentially runs the following equation: If Condition is True, Then Apply These Formatting Specifications. For this purpose, the dialog box is divided into two areas: the Item list area which displays the formula, and the Item editor area which allows you to set the formula. The Item editor includes the Sample field that lets you view the formatting specifications being applied.

Some of the benefits to using the Highlighting Expert include:

  • using the Highlighting Expert for numeric/currency fields in Cross-Tabs
  • the ability to undo highlighting.


Setting highlighting priorities

The Priority buttons in the Item list area of the Highlighting Expert allow you to set the priorities for your formulas. This is useful when you have two or more formulas that could offer conflicting results in some situations.

For example, suppose you are highlighting the Unit Price field on the report. You assign to this field a highlighting formula that shows a yellow background when a unit price is greater than $100. Imagine then, that on this same report, you create another highlighting formula that shows a red background when a unit price is greater than $200. Considering that 100 is a subset of 200, you could have Unit Price fields with yellow backgrounds when, in fact, those fields should have red backgrounds. In other words, a unit price of $300 could receive either a red or a yellow background, depending on which formula has been assigned priority.

To set the priority for a formula
  1. On the Format menu, click Highlighting Expert.
  2. Highlight the formula.
  3. In the Item list area, click the Priority arrows to move the selected formula to a position above or below the formula(s).

    Note: A formula has priority over another formula when it is higher in the Items list area.

  4. Click OK.
  5. Click the Preview tab, or refresh the report to see the highlighting changes.

    Note: The Remove and Remove All buttons in the Item list area can be used to delete formulas.


Conditionally formatting fields using the Highlighting Expert

Using the Highlighting Expert, you can conditionally format only currency and number fields.

To conditionally format fields using the Highlighting Expert
  1. Right-click the currency or number field you want to format to bring up the shortcut menu.
  2. On the shortcut menu, click Highlighting Expert.

    The Highlighting Expert dialog box appears.

  3. Click the Priority arrows to specify the priority for each new formula that you apply. See Setting highlighting priorities.
  4. In the Item editor area, select a comparison from the Value is list, and enter a numeric value in the adjacent box.
  5. In the Font color, Background, and Border lists, specify your formatting changes to the select field.
  6. Click OK to return to your report.


Undo/Redo activities

Seagate Crystal Reports includes multiple levels of undo. With multiple levels of undo, you can undo any number of changes to an object, in reverse order, until you have your report in the condition you want it.

The program also has a redo feature that reverses an undo. If you move an object, for example, and do not like its new position, you can click Undo to move it back to its original position. If you then change your mind, you can click Redo to restore the latest change.

The Undo and Redo buttons have lists that allow you to undo or redo a number of changes at one time.

  • To undo an action, click Undo on the Standard toolbar.

    The first time the button is clicked, it reverses the most recent change made to the report. Each additional time the button is clicked, it reverses the next most recent change.

    To undo several actions at once, click the arrow button to display the list of actions. Select the series of actions you wish to undo.

  • To redo a change after you have undone it, click Redo on the Standard toolbar.

    The program disables the Undo button and the Undo/Redo commands whenever there is nothing to undo/redo or when you have made a change that cannot be reversed.

    To redo several actions at once, click the arrow button to display the list of actions. Select the series of actions you wish to redo.

Note: You can only undo or redo actions in order from the most recent backward. You cannot undo an action without undoing more recent actions.


Charting

Seagate Crystal Reports enables you to present summarized data in colorful, easy-to-read charts. This section demonstrates how to create charts and how to use them in reports to make report data more meaningful and easier to understand. You can choose from a number of chart layouts and types, as well as drill down to see the details behind the graphical summaries and format chart objects.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample reports installed with Seagate Crystal Reports which demonstrate the kinds of charts you can include on your reports are:

  • Chart.rpt
  • Financial Statement.rpt
  • World Sales Report.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


Charting concepts

Charting overview

Seagate Crystal Reports enables you to include sophisticated, colorful charts in your reports. You can use charts any time you want to improve the usefulness of a report.

For example, if you have a sales report grouped by Region with a subtotal of Last Year's Sales for each region, you can quickly create a chart that will display Sales per Region.

You can chart on the following:

  • summary and subtotal fields
  • detail, formula, and Running Total fields
  • Cross-Tab summaries
  • OLAP data.

You will typically chart on summary and subtotal information at the group level. However, depending on the type of data you are working with, you can create an Advanced, Cross-Tab, or OLAP grid chart for your report.


Chart layouts

The Chart Expert provides four layouts that correspond to certain sets of data.

You can create charts with any of the following layouts, and depending on the data you are using, you can change the chart from one layout to another.

Advanced

Use the Advanced layout when you have multiple chart values or when you do not have any group or summary fields in the report.

You can use multiple dimensions in advanced charts, a function that allows you to create a 3D group. Other specific functions with the Advanced layout include:

  • values can be grouped in ascending, descending, or specified order, as well as by Top N or Sort totals
  • values can be plotted for each record
  • charts can be based on formula and Running Total fields.
Group

The Group layout is a simplified layout in which you show a summary on change of field for topics such as Country.

Note: In order to create a chart using the Group layout, you must have at least one group and at least one summary field for that group.

Cross-Tab

Use the Cross-Tab layout to chart a Cross-Tab object. A Cross-Tab chart does not require group or summary fields.

OLAP

Use the OLAP layout to chart on an OLAP grid. An OLAP chart does not require group or summary fields.


Chart types

Different sets of data are particularly suited to a certain chart type. The following is an overview of the main chart types and their most common uses.

Bar

A bar chart (also known as a column chart) displays or compares several sets of data. Two useful bar charts are the Side-by-Side bar chart and the Stacked bar chart.

  • Side-by-Side bar chart
    A Side-by-Side bar chart displays data as a series of vertical bars. This type of chart is best suited for showing data for several sets over a period of time (for example, last year's sales figures for AZ, CA, OR, and WA).
  • Stacked bar chart
    A Stacked bar chart displays data as a series of vertical bars. This type of chart is best suited for representing three series of data, each series represented by a color stacked in a single bar (for example, sales for 1997, 1998, and 1999).
Line

A line chart displays data as a series of points connected by a line. This type of chart is best suited for showing data for a large number of groups (for example, total sales over the past several years).

Area

An area chart displays data as areas filled with color or patterns. This type of chart is best suited for showing data for a limited number of groups (for example, percentage of total sales for AZ, CA, OR, and WA).

Pie

A pie chart displays data as a pie, split and filled with color or patterns. Pie charts are typically used for one group of data (for example, the percentage of sales for the entire inventory); however, you have the option to choose multiple pie charts for multiple groups of data.

Doughnut

A doughnut chart is similar to a pie chart, displaying data as sections of a circle or doughnut. If, for example, you charted sales by region on a particular report, you would see the total number of sales (the figure) in the center of the doughnut and the regions as colored sections of the doughnut. As with the pie chart, you have the option to choose multiple doughnut charts for multiple groups of data.

3-D Riser

A 3-D Riser chart displays data in a series of 3-dimensional objects, lined up side-by-side, in a 3-dimensional plane. The 3-D Riser chart shows the extremes in your report data. For example, the difference in sales between countries is visually dynamic when presented in this chart.

3-D Surface

3-D Surface charts present a topographic view of multiple sets of data. If, for example, you need a chart to show the number of sales by customer by country, in a visually dynamic and relational format, you might consider using the 3-D Surface chart.

XY Scatter

An XY Scatter chart is a collective of plotted points that represent specific data in a pool of information. The XY Scatter chart allows the user to consider a larger scope of data for the purpose of determining trends. For example, if you input customer information, including sales, products, countries, months, and years, you would have a collective of plotted points that represents the pool of customer information. Viewing all of this data on an XY Scatter chart would allow you to speculate as to why certain products were selling better than others or why certain regions were purchasing more than others.

Radar

A radar chart positions group data, such as countries or customers, at the perimeter of the radar. The radar chart then places numeric values, increasing in value, from the center of the radar to the perimeter. In this way, the user can determine, at a glance, how specific group data relates to the whole of the group data.

Bubble

A bubble chart displays data as a series of bubbles, where the size of the bubble is proportional to the amount of data. A bubble chart would be very effective with the number of products sold in a certain region; the larger the bubble, the greater the number of products sold in that region.

Stock

A stock chart presents high and low values for data. It is useful for monitoring financial or sales activities.


Where to place a chart

The placement of a chart determines which data is displayed and where it is printed. For example, if you place a chart in the Report Header section, the chart includes data for the entire report. If you place it in a Group Header or Group Footer section, it displays group specific data.

Note: If your report contains subreports, you can place charts in those subreports as well. See Subreports.


Drill-down with charts

Not only is charting a means of presenting data — it is also an analysis tool. You can activate the drill-down mode by right-clicking the group chart on the Preview tab and click Drill-down from the shortcut menu. When you are in drill-down mode, move the pointer over a section of the group chart on the Preview tab, so that the pointer becomes a Drill-down cursor, then double-click to view the underlying details for that section of the chart.

Drill-down with legends

If the chart consists of one or more group fields, you can use the chart legend to drill down on individual groups. Double-click the drill-down cursor on the markers and text in the legend to view the details about that section of the chart.


Creating charts

Charting on details or formula fields (Advanced layout)

The Advanced layout allows you to create a chart based on specific values. Since charts are a good way to display summarized information, they are often based on a summary field in your report. With an Advanced layout, you can create a chart without the need for a summary field by using values that appear in the Details section of your report.

To create a chart based on the Advanced layout, you must specify two things:

  • conditions (there can be two)
  • values (there can be multiple values).

Condition

The condition is used to indicate when to plot the point. For example, a chart showing last year's sales for your customers uses the Customer Name field as the condition. Each time the condition changes (the customer name changes), a point is plotted.

You also have the option of plotting a point for each record, or plotting one point for all records.

Value

The Advanced chart uses the value to indicate what information is plotted as the points on your chart. For example, to create a chart showing last year's sales for your customers, the Last Year's Sales field would be the value.


To chart on a details or formula field

  1. On the Insert menu, click Chart.

    The Chart Expert dialog box appears.

  2. On the Type tab, in the Chart type list, click the chart type that best illustrates your data. See Chart types.
  3. Click the Data tab.

  4. In the Layout area, click Advanced.
  5. In the Placement area, in the Place graph list, specify how often your chart appears on the report, then click Header or Footer to specify where to place your chart.
  6. In the Data area, specify the database fields you want to use as conditions.

    You can select On change of from the list, then add up to two database fields in the box underneath the list.

    The arrow buttons on the Chart Expert dialog box allow you to move fields from one list to the other. Single arrows move only the selected field; double arrows move all fields at the same time.

  7. Add the database fields you want to use as values to the Show values list.
  8. If you do not want Seagate Crystal Reports to automatically summarize the chart values, select the Don't summarize values check box.
  9. On the Axes and Options tabs, add data values, a legend, or other elements to your chart.
  10. Click the Text tab.
  11. Accept the default title information or add new titles to your chart.
  12. Click OK.

    Your chart is placed in the Header or Footer section of the report, depending on your selection in Step 5.

    Note: When your chart is inserted, it may cover a portion of the report. Move and resize the chart so that it fits properly within the report.


Charting on summary or subtotal fields (Group layout)

Many of the charts you create are based on summary or subtotals within your report. In order to create these charts, you must have a summary or subtotal already inserted into your report. For more information on inserting summaries and subtotals, see Summarizing grouped data and Subtotaling.

To chart on a summary or subtotal field
  1. On the Insert menu, click Chart.

    The Chart Expert dialog box appears.

  2. On the Type tab, in the Chart type list, click the chart type that best illustrates your data. See Chart types.
  3. Click the Data tab.

  4. In the Layout area, click Group.

    Note: When summarizing or subtotaling a field, the data is automatically grouped. See Sorting, Grouping, and Totaling.

  5. In the Placement area, in the Place graph list, specify how often your chart appears on the report, then click Header or Footer to specify where to place your chart.
  6. In the Data area, in the On change of list, click the group field you want to base your chart on, then in the Show list, click the summary field you want to display on your chart.
  7. On the Axes and Options tabs, add data values, a legend, or other elements to your chart.
  8. Click the Text tab.
  9. Accept the default title information or add new titles to your chart.
  10. Click OK.

    Your chart is placed in the Header or Footer section of the report, depending on your selection in Step 5.

    Note: When your chart is inserted, it may cover a portion of the report. Move and resize the chart so that it fits properly within the report.


Charting on Cross-Tab summaries (Cross-Tab layout)

Seagate Crystal Reports allows you to include a chart based on summary values in your Cross-Tab report. For example, with a Cross-Tab that shows the amount of a certain product sold in each region of the United States, you may want to include a chart showing the percentage of total sales provided by each region for that product.

To create a Cross-Tab chart you must first have a Cross-Tab in your report. For more information, see Cross-Tab Objects.

To chart on a Cross-Tab summary
  1. On the Insert menu, click Chart.

    The Chart Expert dialog box appears.

  2. On the Type tab, in the Chart type list, click the chart type that best illustrates your data. See Chart types.
  3. Click the Data tab.

  4. In the Layout area, click Cross-Tab.
  5. In the Placement area, click Header or Footer to specify where to place your chart.
  6. How often your chart appears on the report depends on where the Cross-Tab summary field has been placed.
  7. In the Data area, in the On change of list, click the group field you want to base your chart on.
  8. If necessary, in the Subdivided by list, click a secondary row or column you want to base your chart on.
  9. In the Show list, click the summary field you want to display on your chart.
  10. On the Axes and Options tab, add data values, a legend, or other elements to your chart.
  11. Click the Text tab.
  12. Accept the default title information or add new titles to your chart.
  13. Click OK.

    Your chart is placed in the Header or Footer section of the report, depending on your selection in Step 5.

    Note: When your chart is inserted, it may cover a portion of the report. Move and resize the chart so that it fits properly within the report.


Charting on an OLAP cube (OLAP layout)

The OLAP layout lets you chart on an OLAP grid. In order to create an OLAP chart, you must first have an OLAP grid in your report. For more information, see Creating an OLAP report.

To chart on an OLAP cube
  1. On the Insert menu, click Chart.

    The Chart Expert dialog box appears.

  2. On the Type tab, in the Chart type list, click the chart type that best illustrates your data. See Chart types.
  3. Click the Data tab.

  4. In the Layout area, click OLAP.
  5. In the Placement area, click Header or Footer to specify where to place your chart.

    Note: How often your chart appears on the report depends on where the OLAP grid has been placed.

  6. In the Data area, in the On change of list, click the field you want to base your chart on.
  7. If necessary, in the Subdivided by list, click a secondary row or column you want to base your chart on.
  8. On the Axes and Options tab, add data values, a legend, or other elements to your chart.
  9. Click the Text tab.
  10. Accept the default title information or add new titles your chart.
  11. Click OK.

    Your chart is placed in the Header or Footer section of the report, depending on your selection in Step 5.


Working with charts

Editing charts using the Chart Expert

Once you have created a chart, you may want to add a new title, headings, or a legend, change fonts, or even change the type of chart. Modifying charts is easy with the use of the Chart Expert.

To edit a chart using the Chart Expert
  1. Right-click the chart to bring up the shortcut menu.
  2. On the shortcut menu, click Chart Expert.
  3. In the Chart Expert dialog box, make the desired changes.
  4. Click OK.


Editing charts on the Analyzer tab

Seagate Crystal Reports provides a third tab, the Analyzer tab, specifically for advanced charting. Use this tab to organize your charts for more efficient analysis.

To launch the Analyzer tab
  1. On the Design or Preview tab, right-click the chart to bring up the shortcut menu.
  2. On the shortcut menu, click Chart Analyzer.

    Seagate Crystal Reports opens the Analyzer tab.

When viewing a chart on the Analyzer tab, you can perform the following operations by using the commands on the shortcut menu:

  • zoom in and out on bar and line charts
  • save the current template to a file
  • apply a new template to the chart
  • change the template specifications of the chart
  • change the chart titles
  • change the numeric axis grids and scales of the chart
  • perform any additional formatting operations specific to the chart type
  • auto-arrange the appearance of the chart.

Many of the operations listed here can be found in the Advanced Chart Settings menu on the Design, Preview, and Analyzer tabs. If you select an option from this menu on either the Design or Preview tab, your changes are applied to all instances of the chart on the report. Or, if you select an Advanced Chart Settings option on the Analyzer tab, you set the properties of an individual instance of the chart independently from the rest of the report.

With the Analyzer tab, up to two chart objects can be viewed simultaneously. In this case, the Analyzer tab becomes a split-screen tab, with each chart appearing in a separate section. To resize a section, move the cursor over the section boundary until the cursor becomes a Section Sizing cursor, and then drag the boundary line to expand or reduce the size of the section, as needed.

The Analyzer tab can also be used to work with chart objects that have been placed within a subreport. The program opens a separate Analyzer tab for each subreport that contains a chart object you are analyzing. You can view up to two chart objects from the same subreport simultaneously in the Analyzer tab.

Note: Changes performed in the Analyzer tab are applied to the currently selected chart or charts. However, you can apply changes to all instances of that chart or charts by selecting the Apply Changes option. You can have two charts selected in the analyzer at one time. When you try to select a third chart and bring it into the analyzer, you will be asked to discard one of the previously selected charts.


Formatting chart objects on the Analyzer tab

When viewing a chart on the Analyzer tab, you can move or resize the following chart objects by using the drag procedure:

  • chart
  • title
  • subtitle
  • footnote
  • legend
  • X axis title
  • Y1 axis title
  • Y2 axis title


Using the zooming features with bar and line charts

On the Preview and Analyzer tabs, you can find commands for zooming bar charts and line charts within your report. You have the ability to zoom in and out on these chart types at any time, with each time being referred to as instance-specific. If you decide to save the instance of the chart that has been zoomed in or out, you must save the data with the report.

To zoom in and out on a chart
  1. On the Preview or Analyzer tab, right-click the chart to bring up the shortcut menu.
  2. On the shortcut menu, click Zoom In.
  3. With the Zoom In cursor, click the chart.

    The chart zooms in one level of magnification.

  4. Click the chart again to zoom in further.

    Note: If you want to view a section of the chart in greater detail (e.g. a riser on your bar chart), you can drag the Zoom In cursor around the section to enclose it within the tracking rectangle.

  5. To zoom out on a chart, right-click the chart to bring up the shortcut menu.
  6. On the shortcut menu, click Zoom Out.
  7. With the Zoom Out cursor, click the chart.

    The chart zooms out one level of magnification.

  8. Click the chart again to zoom out further.


Auto-arranging charts

If you move or resize chart objects on the Analyzer tab, select the Auto-Arrange Chart feature to reset the chart.

To auto-arrange a chart
  1. On the Analyzer tab, right-click the chart to bring up the shortcut menu.
  2. On the shortcut menu, click Auto-Arrange Chart.

    Seagate Crystal Reports resets the chart on the Analyzer tab.


Changing chart size and position

You can use the Object Size and Position dialog box to specify the height, width, and position of the chart, in inches.

To change chart size and position
  1. On the Design or Preview tab, right-click the chart to bring up the shortcut menu.
  2. On the shortcut menu, click Object Size and Position.

    The Object Size and Position dialog box appears.

  3. In the X text box, enter the distance in inches from the left edge of the chart object to the left margin of the report section.

    The default distance is 0.04 inches.

  4. In the Y text box, enter the distance in inches from the upper edge of the chart object to the upper margin of the report section.

    The default distance is 0.02 inches.

  5. In the Height text box, enter the vertical height of the chart, in inches.
  6. In the Width text box, enter the horizontal height of the chart, in inches.
  7. Click OK to save your changes.

    Seagate Crystal Reports returns you to the report and implements your changes.


Changing the border of a chart

  1. On the Design or Preview tab, right-click the chart to bring up the shortcut menu.
  2. On the shortcut menu, click Change Border.

    The Format Editor dialog box appears with the Border tab open.

  3. Change the line style, color, background color, and add or remove a drop shadow from the chart border.
  4. Click OK to save your changes.

    Seagate Crystal Reports returns you to the report and implements your changes.


Using the underlay feature with charts

Since charts can print only in certain sections of your report, the underlay feature gives you more control in the overall look of your report. Instead of having a chart print ahead of the data it represents, it can appear next to the data for a more comprehensible report.

This is how your report looks when you underlay a chart with report data.


To underlay a chart

  1. Create your chart and place it in the Report Header section. See Creating charts.
  2. On the Insert menu, click Section.

    The Section Expert dialog box appears.

  3. In the Sections area, click Report Header, then select the Underlay Following Sections check box.
  4. Click OK.

    Seagate Crystal Reports returns you to the report. Your chart will now underlay the sections below it.

  5. If necessary, move or resize the chart.


Mapping

Seagate Crystal Reports enables you to include maps with reports made up of geographic data. This section explains how to use maps in reports to make report data more meaningful and easier to interpret. You can customize and rearrange the appearance of a map and activate the drill-down mode to view the details behind the graphical summaries.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample report installed with Seagate Crystal Reports that contains a geographical map is:

  • Sales With Geographic Map.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


Mapping concepts

Mapping overview

With Seagate Crystal Reports, you can include geographic maps in reports. Maps help you analyze report data and identify trends more efficiently. For example, you could create a map that shows sales by region. You would then be able to:

  • use one of the five map types to analyze the data
  • use the Analyzer tab to adjust the appearance and organization of the map (allowing you to better identify trends)
  • drill down on the map regions to view underlying data.

In order to place a generic, group-based map on a report, you must first have a group and a summary or subtotal field present for that group. However, the program does provide several specialized map layouts that do not require groups and summaries.

Note: When a field is summarized or subtotaled, the program automatically groups the data. For more information, see Sorting, Grouping, and Totaling.


Map layouts

The Map Expert provides four layouts that correspond to certain sets of data.

You can create maps with any of the following layouts, and depending on the data you are using, you can change the map from one layout to another.

Advanced

Use the Advanced layout when using multiple map values or when you do not have any groups or summaries in the report.

Group

The Group layout is a simplified layout in which you show a summary on change of a geographic field (such as Region).

Note: In order to create a map using the Group layout, you must have at least one group and at least one summary field for that group.

Cross-Tab

Use the Cross-Tab layout when mapping on a Cross-Tab object. A Cross-Tab map does not require groups or summary fields.

OLAP

Use the OLAP layout when mapping on an OLAP grid. An OLAP map does not require groups or summary fields.

Note: If there is no map associated with the data you specify, then an empty block will appear unless the section that the map is placed in has been formatted to suppress if blank.


Map types

The Map Expert also provides five basic map types, each suitable for a different strategy of data analysis. When deciding which map type best fits your report, you should consider the type of data you want to analyze. For example, if you want the map to display one data item for each geographic division (city, state, country, and so on), then you might use a Ranged, Dot Density, or Graduated map. On the other hand, if you want the map to display more than one value for each new geographic division, then you could use a Pie Chart map or a Bar Chart map. The following is an overview of the main map types and their most common uses.

Ranged

A Ranged map breaks the data into ranges, assigns a specific color to each range, then color codes each geographic area on the map to display the range. For example, you could create a map that displays Last Year's Sales by Region. If you have sales ranging from zero to 100,000, you might give the map five ranges, with equal intervals of 20,000 each. You could use shades of red (going from dark to light red) to color code each region according to those sales figures. Then you could use this map to see where sales are the highest.

With equal intervals, you might end up with all your regions ranging between zero and 20,000, except perhaps one region (for example, California) that might have exceptionally high sales (such as 98,000). This map would be a very distorted representation of the data. A more useful map would have ranges like 0-5000, 5001-10000, 10001-15000, 15001-20000, and over 20000. It is important to carefully define your ranges.

There are four different distribution methods for ranged maps.

  • Equal count
    This option assigns intervals in such a way that the same number of regions (or as close to the same number of regions as possible) appear in each interval. In other words, this option would assign intervals so that each color on the map is assigned to the same number of regions. The numeric quantity of the summary values in each interval may or may not be equal, depending on the individual regions and their summary values.
  • Equal ranges
    This option assigns intervals in such a way that the summary values in each interval are numerically equal. The number of regions in each interval may or may not be equal, depending on the individual regions and their summary values.
  • Natural break
    This option assigns intervals using an algorithm that attempts to minimize the difference between the summary values and the average of the summary values for each interval.
  • Standard deviation
    This option assigns intervals in such a way that the middle interval breaks at the mean (or average) of the data values, and the intervals above and below the middle range are one standard deviation above or below the mean. Standard deviation is the square root of the variance. It projects how various values in a set of values deviate from the mean for that set.
Dot Density

A Dot Density map displays a dot for each occurrence of a specified item. For example, you might create a United States map that shows one dot for each shipbuilder in the nation. In states like Tennessee, there would be no dots. However, in some coastal states, such as South Carolina, you might be able to count the dots on the map, since their dispersal would be fairly wide.

The purpose of a Dot Density map is to provide an overall impression of the distribution of the specified item. A Dot Density map is much like a nighttime satellite photo of the United States, where you can see the lights of all the cities. Such a map is not a very accurate means of communicating information (particularly if you have a large number of items), but it is a good way to give an overview of the distribution.

Graduated

A Graduated map is much like a Ranged map; it shows one symbol per instance of a specified item. This symbol is a circle by default, but you can choose a different symbol if you prefer. Each symbol is proportional in size to the value of the item it represents (within a range of three sizes).

A Graduated map communicates the same information as the Ranged map, but you would usually create a Ranged map for a case in which the geographic areas have distinct geographic boundaries (as in the case of Regions), while you would use a Graduated map for displaying data that is linked to points rather than precise areas (as in the case of Cities).

For example, a map of an individual region could use graduated circles to represent the sales for each office. The size of each circle would be proportional to the sales (or to the sales range) of the office it represents. On this map, an office with a sales figure of $70,000 might have a large circle, and an office with a sales figure of $20,000 might have a small circle. So, a Graduated map provides a more efficient representation of point data (e.g. Cities) than a Ranged map does, and it uses sized symbols rather than colors to distinguish variations in the values of the items it represents.

Pie Chart

A Pie Chart map displays a pie chart over each geographic area. The pie charts represent data items that make up a whole. Each slice of the pie represents an individual data item and shows that item's percentage in the whole. For example, you could create a Pie Chart map showing heating fuel types by region. You might have four types of heating fuel (four slices in each pie): electricity, gas, wood, and solar. Each region would then have a pie chart showing the breakdown of heating fuel types within that region. Washington state would probably use a high percentage (a large slice of the pie) of electricity because of the hydropower in that region, while Idaho would probably use a high percentage (a large slice of the pie) of natural gas.

You can use this map type to compare the distribution of several items within a particular region. You can also specify that the pie charts be sized proportionately so that, as with the symbols in a Graduated map, the pie charts will appear in various sizes, depending on the underlying data values. This will allow you to compare the totals between regions.

Bar Chart

A Bar Chart map works like a Pie Chart map, but may be more useful for certain sets of data. Typically, you would use a Bar Chart map for items that do not total 100%; that is, for data items that do not make a whole, or for data items that are unrelated. For example, you could create a Bar Chart map that displays use of heating fuel by region. You might choose to analyze use of three types of fuel: electricity, gas, and solar. Each bar chart on the map could contain individual bars for each of these types. In this example, the data items (electricity, gas, and solar) do not comprise a whole. There may be other types of fuel used in these regions, such as wood, but this map only focuses on three of them. Also, the purpose of the map is to compare each region's use of each fuel type with that of every other region. In a Pie Chart map, you could show these three fuel types as percentages of the entire fuel use within each region, and though you could compare the percentages for each region, you would probably not be able to compare the actual values for each region because each region would have the same total value (100%).


Where to place a map

When you choose where to place the map, you determine the amount of data that will be included in the map. For example, if you place the map in the Report Header section, the map includes data for the entire report. If you place it in a Group Header or Group Footer section, it displays group-specific data. This choice will also determine whether the map prints once for the entire report, or many times (once for each instance of a given group).

Note: If your report contains subreports, you can place maps in those subreports as well. See Mapping on subreports.


Drill-down with maps

Not only is mapping a means of presenting data — it is also an analysis tool. You can activate the drill-down mode by right-clicking the group map on the Preview tab and clicking Drill-down from the shortcut menu. When you are in drill-down mode, move the pointer over a section of the map on the Preview tab, so that the pointer becomes a Drill-down cursor, then double-click to view the underlying details for that section of the map.

Note: If you drill down on a region that has no data associated with it, you will get a message saying, "There are no detail records for that {Region Name}."


Creating maps

The process for creating a map varies depending on the data you are mapping on. The following sections detail the mapping process for each map layout.

Mapping on details fields (Advanced layout)

Using the Advanced layout, you can map on specific values rather than summaries. This layout also allows you to use multiple fields as map values. Use this layout to use multiple map values or when you do not have any groups or summaries in a report.

Note: You must map on a geographic field, such as Country, Region, or City. Seagate Crystal Reports cannot generate a map based on a non-geographic field.

To map on a details field
  1. On the Insert menu, click Map.

    The Map Expert dialog box appears.

  2. On the Data tab, in the Layout area, click Advanced.
  3. In the Placement area, in the Place map list, specify how often your map appears on the report, then click Header or Footer to specify where to place your map.
  4. In the Data area, add the database field you want to base your map on to the Geographic field.

    The arrow buttons on the Map Expert dialog box allow you to move fields from one list to the other. Single arrows move only the selected field; double arrows move all fields at the same time.

    Note: You must map on a geographic field, such as City, Region, or Country; otherwise, Seagate Crystal Reports cannot generate your map.

  5. Add the database field you want to appear with each change to the On change of field.
  6. Add the database fields you want to use as values to the Map values list.
  7. If you do not want Seagate Crystal Reports to automatically summarize the map values, select the Don't summarize values check box.
  8. Click the Type tab.

  9. Click the map type that best illustrates your data (Ranged, Dot Density, Graduated, Pie Chart, or Bar Chart). See Map types.
  10. In the Options area, apply formatting options to your map.
  11. Click the Text tab.

  12. In the Map title field, enter a title for your map.
  13. In the Legend area, you can click one of the following options:
      • Full legend to show a detailed legend on your map
      • Compact legend to show a condensed legend on your map
      • No legend to exclude the legend from your map.
  14. If you click Full legend, click Made by map to have Seagate Crystal Reports create a legend title based on your map, or click Specify to enter your own legend title and subtitle.
  15. Click OK.

    Your map is placed in the Header or Footer section of the report, depending on your selection in Step 3.


Mapping on group fields (Group layout)

To map on a group, you can use the Group layout, in which you show a summary (such as Last Year's Sales) on change of a geographic field (such as Region). In order to create a map using the Group layout, you must have at least one group and at least one summary field for that group.

To map on a group
  1. On the Insert menu, click Map.

    The Map Expert dialog box appears.

  2. On the Data tab, in the Layout area, click Group.
  3. In the Placement area, in the Place map list, specify how often your map appears on the report, then click Header or Footer to specify where to place your map.
  4. In the Data area, in the On change of list, click the group field you want to base your map on, then in the Show list, click the summary field you want to display on your map.
  5. Click the Type tab.
  6. Click the map type that best illustrates your data (Ranged, Dot Density, or Graduated). See Map types.
  7. In the Options area, apply formatting options to your map.
  8. Click the Text tab.
  9. In the Map title field, enter a title for your map.
  10. In the Legend area, you can click one of the following options:
      • Full legend to show a detailed legend on your map
      • Compact legend to show a condensed legend on your map
      • No legend to exclude the legend from your map.
  11. If you click Full legend, click Made by map to have Seagate Crystal Reports create a legend title based on your map, or click Specify to enter your own legend title and subtitle.
  12. Click OK.

    Your map is placed in the Header or Footer section of the report, depending on your selection in Step 3.


Mapping on Cross-Tab summaries (Cross-Tab layout)

With the Cross-Tab layout, you can map on a Cross-Tab summary field. For example, with a Cross-Tab that shows the total number of items of a product sold in each region of the United States, you may want to include a map that shows the percentage of the total sales of the product provided by each region.

In order to create a Cross-Tab map you must first have a Cross-Tab in your report. For more information about Cross-Tabs, see Cross-Tab Objects.

To map on a Cross-Tab summary
  1. Select the Cross-Tab summary field you want to base your map on.
  2. On the Insert menu, click Map.

    The Map Expert dialog box appears.

  3. On the Data tab, in the Layout area, click Cross-Tab.
  4. In the Placement area, click Header or Footer to specify where to place your map.
  5. In the Data area, in the Geographic field list, click a geographic field to supply the geographic areas for your map.
  6. If necessary, in the Subdivided by list, click another field to map on.
  7. Seagate Crystal Reports uses this field to subdivide the pie or bar charts appearing on your map.
  8. In the Map on list, click a summary field to supply the numeric data for your map.
  9. Click the Type tab.
  10. Click the map type that best illustrates your data. See Map types.
      • If you plan to map on only one field, be sure to select None from the Subdivided by list, then choose either the Ranged, Dot Density, or Graduated map type.
      • If you plan to map on two fields, be sure to select an additional field from the Subdivided by list, then choose either the Pie Chart or Bar Chart map type.
  11. In the Options area, apply formatting options to your map.
  12. Click the Text tab.
  13. In the Map title field, enter a title for your map.
  14. In the Legend area, you can click one of the following options:
      • Full legend to show a detailed legend on your map
      • Compact legend to show a condensed legend on your map
      • No legend to exclude the legend from your map.
  15. If you click Full legend, click Made by map to have Seagate Crystal Reports create a legend title based on your map, or click Specify to enter your own legend title and subtitle.
  16. Click OK.

    Your map is placed in the Header or Footer section of the report, depending on your selection in Step 4.


Mapping on an OLAP cube (OLAP layout)

Using the OLAP layout, you can map on an OLAP grid. In order to create an OLAP map, you must first have an OLAP grid in your report. For more information about OLAP grids, see Creating an OLAP report.

To map on an OLAP cube
  1. Select the OLAP grid on which you want to map.
  2. On the Insert menu, click Map.
  3. The Map Expert dialog box appears.

  4. On the Data tab, in the Layout area, click OLAP.
  5. In the Placement area, click Header or Footer to specify where to place your map.
  6. In the Data area, select the summary and geographic fields that you want to use for your map.
  7. Click the Type tab.
  8. Click the map type that best illustrates your data (Ranged, Dot Density, or Graduated). See Map types.
  9. In the Options area, apply formatting options to your map.
  10. Click the Text tab.
  11. In the Map title field, enter a title for your map.
  12. In the Legend area, you can click one of the following options:
      • Full legend to show a detailed legend on your map
      • Compact legend to show a condensed legend on your map
      • No legend to exclude the legend from your map.
  13. If you click Full legend, click Made by map to have Seagate Crystal Reports create a legend title based on your map, or click Specify to enter your own legend title and subtitle.
  14. Click OK.

    Your map is placed in the Header or Footer section of the report, depending on your selection in Step 4.


Mapping on subreports

Inserting a map into a subreport involves the same process used to insert a map into the main report. The only difference is that you must insert the map with the subreport Design tab active.

The process for creating a map varies depending on the type of data you are mapping on.

To map on a subreport
  1. On the Insert menu, click Map.

    The Map Expert dialog box appears.

  2. Make any necessary changes to the Map Expert, then click OK.

    Seagate Crystal Reports places the map in the section you specified in the Map Expert, and returns you to the report.

  3. Resize or move your map as desired.


Working with maps

Editing maps using the Map Expert

Once you have created a map, you may want to add a new title, headings, and a legend, and you may want to change fonts, or even the map type. From either the Design or Preview tab, you can open the Map Expert and make your modifications.

To edit a map using the Map Expert
  1. Right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Map Expert.
  3. In the Map Expert dialog box, make the desired changes.
  4. Click OK.


Editing maps on the Analyzer tab

Seagate Crystal Reports provides a third tab, the Analyzer tab, specifically for advanced mapping. Use this tab to organize your maps for more efficient analysis. The Analyzer tab allows you to set the properties of an individual instance of a map independently from the rest of the report.

To launch the Analyzer tab
  1. On the Design or Preview tab, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Map Analyzer.

    Seagate Crystal Reports opens the Analyzer tab.

When viewing a map on the Analyzer tab, you can perform the following operations:

  • zoom in, zoom out, and pan the map
  • center the map
  • change the map title, map type, and set the overall style of the map
  • reorganize the layers of report elements (for example, you can display the major cities layer above the highways layer)
  • resolve data mismatches
  • change the geographic map
  • hide and show the Map Navigator.

Note: The Analyzer tab's zooming, panning, and centering capabilities are also available as shortcut commands on the Map Navigator and the Preview tab (right-click the map object on the Preview tab). For more information about the Map Navigator, see Zooming, panning, and centering maps with the Map Navigator.

With the Analyzer tab, up to two map objects can be viewed simultaneously. In this case, the Analyzer tab becomes a split-screen tab, with each map appearing in a separate section. To resize a section, move the cursor over the section boundary until the cursor becomes a Section Sizing cursor, and then drag the boundary line to expand or reduce the size of the section, as needed.

The Analyzer tab can also be used to work with map objects that have been placed within a subreport. The program opens a separate Analyzer tab for each subreport that contains a map object you are analyzing. You can view up to two map objects from the same subreport simultaneously on the
Analyzer tab.

Note: You can also resize the map legend displayed to the right of each map.


Changing the map title

  1. Right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Change Map Title.
  3. In the Change Map Title dialog box, enter a new title.
  4. Click OK to save your changes.

    Seagate Crystal Reports returns you to the Analyzer tab and implements your changes.


Changing the map type

From within the Analyzer tab, you can change the map type and set the properties for that map. For example, if you are analyzing a Ranged map, and you want to see how the data would look if it were presented in a Dot Density style, you can rearrange the map without having to return to the Map Expert and rework the format. The Analyzer tab also offers more advanced options for changing the appearance of the map you have specified.

To change the map type
  1. On the Analyzer tab, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Change Map Type.

    The Customize Map dialog box appears.

  3. In the Map type list, click the new map type.
  4. In the Options area, apply formatting options to your new map.

    The properties made available to you vary depending on the map you have selected.

  5. Click OK to save your changes.

    Seagate Crystal Reports returns you to the Analyzer tab and implements your changes.


Changing map layers

It takes only a moment to rearrange map layers. You can also set properties, such as visibility for those layers, and you can add and remove layers as needed.

To change map layers
  1. On the Analyzer tab, right-click the map to bring up the shortcut menu.
  2. Click Change Map Layers.

    The Layer Control dialog box appears.

  3. In the Layers list, click Up or Down to arrange the map layers.
  4. In the Properties area, set the properties for each map layer, specifying whether the layer is visible and whether it is automatically labeled.
  5. If necessary, click Display to open the Display Properties dialog box.
  6. Use this dialog box to set the default display mode and zoom range (the minimum and maximum possible magnification) for the layer in question, then click OK to return to the Layer Control dialog box.
  7. Click OK to save your changes.

    Seagate Crystal Reports returns you to the Analyzer tab and implements your changes.


Resolving data mismatches

Sometimes the map you are working with uses a different geographic name from the one used in the database. For example, a map of Europe may use "United Kingdom" while the database uses the abbreviation "U.K." Until you resolve the data mismatch, the map will not be able to display any information for the selected geographic region.

To resolve data mismatches
  1. On the Analyzer menu, click Resolve Mismatch.

    The Map Region Resolver dialog box appears, listing the geographic names that do not correspond between the database and map.

  2. On the Keyword Matching tab, in the Assign this heading list that is used by the database, click the heading you want to resolve.

    The selected heading may be automatically assigned to a keyword from the To this keyword list that is used by the map.

  3. To assign a keyword yourself, click another keyword from the To this keyword list.
  4. If there is a match, click Assign.

    The new assignment is displayed in the bottom part of the Map Region Resolver dialog box.

  5. Once you are finished resolving the data mismatches, click OK.

    The map can now display data for the selected geographic region.


Changing the geographic map

If you prefer to have your data values presented with a different geographic map, specify your changes using the Change Map dialog box.

To change the geographic map
  1. On the Analyzer tab, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Change Geographic Map.

    The Change Map dialog box appears, displaying the name of the current map you are using, and a list of replacement maps that you can choose from.

  3. In the Candidate Maps list, click the new map you want to use.
  4. Click OK to save your changes.

    Seagate Crystal Reports returns you to the Analyzer tab and implements your changes.


Changing map size and position

You can use the Object Size and Position dialog box to specify the height, width, and position of your map, in inches.

To change map size and position
  1. On the Design or Preview tab, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Object Size and Position.

    The Object Size and Position dialog box appears.

  3. In the X text box, enter the distance in inches from the left edge of the map object to the left margin of the report section. The default distance is 0.04 inches.
  4. In the Y text box, enter the distance in inches from the upper edge of the map object to the upper margin of the report section.

    The default distance is 0.02 inches.

  5. In the Height text box, enter the vertical height of the map, in inches.
  6. In the Width text box, enter the horizontal height of the map, in inches.
  7. Click OK to save your changes.

    Seagate Crystal Reports returns you to the report and implements your changes.

Note: You can also change size and position by moving and resizing the map. However, the Object Size and Position dialog box allows you to make exact adjustments.


Changing the border of a map

  1. On the Design or Preview tab, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Change Border.

    The Format Editor dialog box appears with the Border tab open.

  3. Change the line style, color, background color, and add or remove a drop shadow from the map border.
  4. Click OK to save your changes.

    Seagate Crystal Reports returns you to the report and implements your changes.


Using the underlay feature with maps

Since maps can only print in certain areas and sections of your report, the underlay feature makes mapping even more useful. Instead of having a map print before the data it represents, you can have the map appear alongside the data, thus making the report easier to read and easier to understand.

To underlay a map
  1. Create your map and place it in the Report Header section.

    For more information, see Creating maps.

  2. On the Insert menu, click Section.

The Section Expert dialog box appears.

  3. In the Sections area, click Report Header, then select the Underlay Following Sections check box.
  4. Click OK.

    Seagate Crystal Reports returns you to the report. Your map will now underlay the sections below it.

  5. If necessary, move or resize the map.


Zooming, panning, and centering maps with the Map Navigator

On the Analyzer tab, the Map Navigator provides a small scale version of the currently displayed map. Similar to the Preview and Analyzer tabs, the Map Navigator includes commands for zooming, panning, and centering geographic maps. You can zoom in and out on your maps whenever you need to view more specific or general information.
By panning, you can quickly drag your map anywhere. You can then return your map to the center of the tab by using the center command.

One of the benefits to using the Map Navigator is that it always offers a complete view of the geographic map you are working on. If you use the Map Navigator to perform a command on a particular part of the map, the changes are reflected on the full-sized map on the Analyzer tab. For example, you could choose the Zoom In command on the Map Navigator to examine the eastern United States in more detail. The full-sized map displayed on the Analyzer tab would then zoom in one level of magnification on the eastern United States, leaving the map on the Map Navigator intact.

While the Map Navigator allows you to easily select a portion of the map, it does not display your changes in detail. The mapping tasks that require more attention to detail should be performed with the full-sized map displayed on the Analyzer tab.

Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com


To zoom in and out on a map

  1. On the Map Navigator, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Zoom In.
  3. Drag the selection cursor around the map section you want to see, then decrease the size of the cursor to zoom in on the section.

    The full-sized map on the Analyzer tab zooms in one level of magnification.

  4. Decrease the size of the selection cursor again to zoom in further.
  5. To zoom out on a map, right-click the Map Navigator to bring up the shortcut menu.
  6. On the shortcut menu, click Zoom Out.
  7. Increase the size of the selection cursor to zoom out on the map section.

    The full-sized map on the Analyzer tab zooms out a level of magnification.

  8. Increase the size of the selection cursor again to zoom out further.
To pan a map
  1. On the Map Navigator, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Pan.
  3. Click the panning cursor, then drag it to the desired map section.
To center a map
  1. On the Map Navigator, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Center Map.

Note:

  • You can also click None from the shortcut menu to disable all movement options. This will prevent accidental panning or zooming.
  • If a map occurs once for each instance of a group, any panning or zooming settings you specify are instance-specific. In other words, if you zoom in on the map in one group header, this setting is only for that group header. None of the headers have been changed. This way you can set each map to different settings.
  • If the Save Data with Report option is selected from the File menu, your panning and zooming settings will be saved with the report. If the option is not selected, then only the default map settings will be saved.


Hiding and showing the Map Navigator

You have the option of hiding or showing the Map Navigator.

To hide the Map Navigator
  1. On the Analyzer tab, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Hide Map Navigator.

    The Map Navigator is removed from the Analyzer tab.

To show the Map Navigator
  1. On the Analyzer tab, right-click the map to bring up the shortcut menu.
  2. On the shortcut menu, click Show Map Navigator.

    The Map Navigator is displayed on the Analyzer tab.


OLE

This section explains how Object Linking and Embedding (OLE) can be used to edit graphics or other objects from within your report instead of opening an additional application.


OLE overview

Object Linking and Embedding (OLE) enables you to insert objects (OLE objects) into a report from other applications (OLE server applications) and then use those applications from within Seagate Crystal Reports to edit the objects if necessary.

If you were not using OLE, you would have to exit Seagate Crystal Reports, open the original application, change the object, return to Seagate Crystal Reports, delete the object originally inserted, and then insert the newly revised object.


OLE terminology

Before you work with OLE objects in Seagate Crystal Reports, it might be helpful to review some terminology:

  • OLE
    OLE is an acronym for Object Linking and Embedding. It refers to the ability to create compound reports; that is, reports that contain elements from other applications that can be edited using the original application.
  • OLE Object
    An OLE object is, broadly speaking, a presentation of data that was created in another application and that maintains a relationship with the application that was used to create it. A bitmap created in Paint, an Excel spreadsheet, or a graph from MS Graph may all be OLE objects if they are inserted in the receiving document as OLE objects. If they are not inserted as OLE objects, they retain no relationship with the original application.
  • OLE Container Application
    An OLE container application is one that can contain and process OLE objects created in other applications (such as Paint or Excel). Seagate Crystal Reports is a container application.
  • Container Document
    A container document is a document that was created using the container application and that contains an OLE object.
  • OLE Server Application
    An OLE server application is an application that is able to create OLE objects which can then be placed into container documents. Microsoft Word and Excel are examples of applications that are both OLE servers and OLE containers. That is, they can both create new OLE objects and they can contain OLE objects created elsewhere.
  • Server Document
    The server document is a file created in the server application that stores the original OLE object.


Types of OLE objects

  • Static object
    A static OLE object is a picture of an object that can be displayed and printed, but not edited in place. It does not have a connection to the server document.
  • Embedded object
    An embedded object contains a representation of the object, as well as information that defines the content. It does not have a connection to the original object in the server document. As a general rule, use embedded objects when you need to edit the object independently of the original server document.
  • Linked object
    A linked object contains a representation of the data and a link to the file where it originated. As a general rule, use linked objects when the data in the server document is changing and you want the object in your report to be updated when you open the report.


General OLE considerations

There are several points to keep in mind when utilizing OLE functionality.

  • When you double-click an embedded OLE object, the object is activated for editing and the Report Designer merges its menus and toolbars with those of the object's server application. When you are finished editing, click outside the object and the Report Designer toolbars reappear.
  • When you double-click a linked OLE object, the program opens the object's server application with the object displayed and ready for editing. You cannot edit a linked object in place in Seagate Crystal Reports because you are working on the original object. Since the object could be linked to multiple documents, displaying the original in the server application limits access to one editor at a time.
  • Windows 3.x shipped Microsoft PaintbrushTM (PBRUSH.EXE) as the native bitmap editor. Windows 95 and Windows 98 ship Microsoft PaintTM (MSPAINT.EXE) as the new bitmap editor. While Windows 95 and Windows 98 know to register and convert PBRUSH.EXE OLE bitmaps as MSPAINT OLE bitmaps, the opposite is not true.
  • You can open a report containing a bitmap object created in Windows 3.1, in Windows 95 and Windows 98; however, you cannot open a Windows 95 and Windows 98 report that contains a bitmap object in Windows 3.1. Thus, if you are going to be working back and forth between these two operating systems, it is best to create the reports in Windows 3.1 rather than in Windows 95 and Windows 98.


Inserting OLE objects into reports

There are several ways to insert OLE objects into an application.

  • The OLE object choice on the Insert menu can be used to import an existing object or create a new one. You can place either embedded or linked objects using this method.
  • Paste Special on the Edit menu can be used to cut the object from an OLE server application and paste it in a report. If the object can be pasted in multiple formats, you need to decide which format to use. For example, when inserting text from a Microsoft Word document, you can paste the text as Microsoft Word document text (which can be edited in Word), or as a metafile, which is simply a non-editable picture of the text. Use Paste Special to place either embedded or linked objects.
  • Finally, you can drag and drop an object from an OLE server application. You do this by opening Seagate Crystal Reports in one window and the OLE server application in another and then dragging the object between the two. However, when an object is dragged into a report, the object is embedded, not linked.

Note: When inserting and selected information (portions of larger files), it is best to use either Copy and Paste Special, or drag and drop editing. When inserting entire files, click OLE Object from the Insert menu.


To drag and drop OLE objects

This procedure assumes that you have Microsoft Excel or another spreadsheet program on your computer that is an OLE server application.

  1. Open both Seagate Crystal Reports and Microsoft Excel and size the program windows so that they are both visible. You will need to be able to see both the object's origin and its destination.
  2. Open an existing report in Seagate Crystal Reports.
  3. Create a spreadsheet in Microsoft Excel by typing the numbers one through ten (1-10) in cells A1 through A10.
  4. Select cells A1 through A10.
  5. Move the cursor to the left edge of the highlighted cells until an arrow pointer appears.
  6. Press the left mouse button and hold it down. This activates the cells to be moved. Since you're only going to copy the cells, press the Ctrl key and hold it down too.
  7. Drag the cells into the Details section of the report in Seagate Crystal Reports, and when you have the cells positioned, release the mouse button then the Ctrl key.
  8. Right-click the spreadsheet object in the report and observe that it is identified as an OLE object and that the second command from the last identifies it as a Worksheet Object.
  9. Double-click the spreadsheet object.

    The menus and tools change to those from the OLE server application. You can now edit the object in-place. The object is an embedded object. Any changes you make to the object will not affect the original.

  10. Click outside the object when you are finished.

    The menus and tools change back to those of Seagate Crystal Reports.


How OLE objects are represented in a report

An OLE object is displayed in a report in any of several different formats depending on how you chose to insert the object.

  • If you have chosen to display the object as an icon, the icon will appear in the report. Users can choose to edit the bitmap later by double-clicking the icon.
  • If the object was created from an existing file, the data from that file (or an icon) is displayed in the report. This data can be edited by double-clicking the object or its icon.
  • If you are creating a new object, the application for the object type that you chose will open, and you can begin designing the object. When you are finished, close or exit the application. The object (or its icon) will be displayed in the report.


Editing OLE objects in reports

In-place editing

In-place editing is the ability to change an OLE object's properties from within an OLE container application (such as Seagate Crystal Reports). The container application's menu items change to provide the editing tools from the server application so that you can make changes easily.

When an OLE object is placed in a report, the object becomes part of the report. To edit the object, double-click it and then modify it using the editing tools found in the object's original application or from a similar application that allows in-place editing.


Dynamic OLE menu commands

The Object on the Edit menu is dynamic; it changes to reflect the properties of the selected object.

The object may be described as a Document object, Bitmap Image object, Picture object, Worksheet object, or something similarly descriptive.

  • If the object is embedded, the Edit menu displays those commands that are available to that type of embedded object.
  • If the object is linked, the Edit menu displays commands for that type of linked object.

Commands on the context menus change in a similar fashion.

These dynamic commands are provided to give you more control when working with OLE objects.

OLE and the Insert Picture command

When the Object command on the Insert menu is used to place pictures in a report, the picture can be treated as either an embedded or a linked object.

When the Picture command on the Insert menu is used to place pictures in a report, the Report Designer converts them into static objects.

Static objects do not support editing. To edit a static object, it has to be converted into an editable type of object using the Convert command on the Edit menu.


Working with static OLE objects

To insert a static OLE object

  1. Create a report using the sample data from xtreme.mdb. Place any field in the Details section of the report.
  2. Click the Design tab.
  3. On the Insert menu, click Picture.

    The Open dialog box appears.

    Note: Seagate Crystal Reports supports Bitmap, TIFF, JPEG, and PNG files.

  4. Select the Xtreme.gif from the \Program Files\Seagate Software\Crystal Reports\Samples\Databases directory.

    Note: The location of the bitmap may vary depending on the destination specified during installation.

  5. Click Open.
  6. When the object frame appears, place the picture on the far left side of the Report Header section.
  7. Right-click the picture, and notice that the picture is identified as an OLE object on the shortcut menu.
  8. When you double-click the object, nothing happens. A static OLE object cannot be edited.

To convert a static OLE object to a bitmap image object

  1. Right-click the static OLE object you placed, and choose Convert Picture Object from the shortcut menu.

    The Convert dialog box appears.

  2. Select Paintbrush Picture in the Object Type list, and click OK.

    You have just converted a static OLE object to a modifiable OLE object.

  3. Right-click the object you have just converted.

    The second command from the bottom of the shortcut menu is now Bitmap Image Object, the same command that appeared for the first object you linked.

  4. Double-click the object.

    Microsoft Paint, or another graphics application installed on your machine opens, just as it did for the linked bitmap image object.

  5. Click Save and save the report as OLE.RPT.


Working with embedded vs. linked objects

Since embedded and linked objects each have different properties, it is important for you to consider the capabilities of each when deciding which OLE format to use.

Embedded objects

An embedded object can be created from within Seagate Crystal Reports or by using a file that already exists. If you use an existing file, the object is copied to the report.

When changes are made to an embedded object it does not affect the original file and vice versa. The changes are made only to the object within your report.

To insert an embedded OLE object
  1. Click the Design tab.
  2. On the Insert menu, click OLE Object.

    The Insert Object dialog box appears.

  3. Select Create From File.

    The dialog box changes, allowing you to either type in an object name or browse.

  4. Click Browse and choose Xtreme.gif from the \Program Files\Seagate Software\Crystal Reports\Samples\Databases directory.

    Note: The location of the bitmap may vary depending on the destination specified during installation.

  5. Click Open to return to the Insert Object dialog box.
  6. Click OK to return to the report. An object frame appears.
  7. Place the object in the Report Header section, just to the right of the first picture.
  8. Right-click this picture and observe that it is also identified as an OLE Object on the shortcut menu. The second command from the bottom of the shortcut menu identifies it as a Bitmap Image Object. It is an embedded OLE object.
  9. Double-click the object. Note that you have remained in Seagate Crystal Reports but the menus and tools have merged with Microsoft Paint, or those of another graphics package installed on your machine. These tools can be used to edit the bitmap in place. Remember that even though you are working with the tools of the OLE server application, you are not working on the original file; you are working with a copy and nothing you do here will affect the original.


Linked objects

When a linked object is inserted into a report, Windows copies a snapshot of the data from a file that already exists. The image of the object is added to your report along with a reference to the data used to create it. The actual data remains with the original file.

When the object is activated from within a report, the original file is opened inside the application that was used to create it. Any changes you make directly affect the original file also.

If you want the data in an object to remain available to other applications, and always reflect the most current changes to the data, link the object to the report.

When you have a linked object and you break the link using the Links dialog box, all connections to the original data in the server document are broken. A linked object in a container application is merely a representation of that object and a link between the object and the server document. When you break the link you're left with only the representation, with no relationship to the original data or to the editing capabilities of the server application. In this situation, Seagate Crystal Reports turns the object into a picture, a stand-alone object that can neither be edited using OLE capabilities nor converted into a modifiable OLE object.


To link a bitmap image object

  1. On the Insert menu, click OLE Object.

    The Insert Object dialog box appears.

  2. Select Create From File.

    The dialog box changes, enabling you to enter an object name or browse.

  3. Click Browse and choose Xtreme.gif from the \Program Files\Seagate Software\Crystal Reports\Samples\Databases directory.

    Note: The location of the bitmap may vary depending on the destination specified during installation.

  4. Click Open to return to the Insert Object dialog box.
  5. Select the Link check box.
  6. Click OK to return to the report.

    An object frame appears.

  7. Place this object just to the right of the embedded object.
  8. Right-click this object and observe that this object is identified as an OLE object. The second command from the bottom of the shortcut menu identifies this as a Linked Bitmap Image Object.
  9. Double-click the object. Microsoft Paint or the graphics application you are using opens, displaying the original file. Any changes you make to the original will be reflected in the object that appears in your report.
  10. Close Microsoft Paint or the graphics application that you are using and return to your report.


Cross-Tab Objects

A Cross-Tab object is a grid that displays values that are grouped and summarized in two directions. This section provides you with information about how you can use Cross-Tab objects in your report.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample reports installed with Seagate Crystal Reports which contain cross-tab objects are:

  • CrossTab.rpt
  • Balance Sheet.rpt
  • Inventory CrossTab.rpt
  • Income Statement.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


What is a Cross-Tab object?

A Cross-Tab object is a grid that returns values based on the criteria you specify. Data is presented in compact rows and columns. This format makes it easy to compare data and identify trends. It is made up of three elements:

  • rows
  • columns
  • summary fields.

  • The rows in a Cross-Tab run horizontally (from side to side). In the example above, "Gloves" is a row.
  • The columns in a Cross-Tab run vertically (up and down). In the example above, "USA" is a column.
  • The summary fields are found at the intersection of rows and columns. The value found at each intersection represents a summary (sum, count, etc.) of those records that meet the row and the column criteria. In the example above, the value at the intersection of "Gloves" and "USA" is four, the number of gloves sold in the USA.

A Cross-Tab also includes several totals:

  • At the end of each row is a total for that row. In the example above, this total represents a single product sold in all countries. At the end of the "Gloves" row is the value 8, the total number of gloves sold in all countries.
  • At the bottom of each column is a total for that column. In the example above, this total represents all products sold in a single country. The value at the bottom of the "USA" column is four, the total number of products (gloves, belts and shoes) sold in the USA.
  • At the intersection of the Totals column (totals for the products) and the Totals row (totals for the countries) is a grand total. In the example above, the value at the intersection of the Total Column and Total Row is 12, the total number of all products sold in all countries.


Cross-Tab example

This example demonstrates how you can use a Cross-Tab object to make it easier to understand complex data. The goal of this report is to analyze the unit sales of five different bicycle locks in four different regions (a unit sales of locks by region report). For greater clarity, only the most essential information in these reports has been included:

  • the region from which the order came
  • the name of the lock
  • the quantity ordered.

The first way of looking at the data is in the most basic of all reports, a columnar report with no grouping or sorting.

Report of order data - no sorting/grouping

This report presents details. Each row represents an individual order. There are many orders from each of the regions for different locks. But because there is no summary information, it is nearly impossible to get any useful information out of a report like this.

The next logical step is to group the data in some way. You can group it by region, or by product line. The following section shows a look at both of these options.


Report of order data - grouped by region

This report uses the data seen in the first report, but here the data is grouped by region. All the orders in each region are grouped together, but each regional group contains orders for different types of locks. Because the groups contain different kinds of data, summarizing the Quantity field will determine the total number of locks sold per Region, but not the total of each type.

Each region group contains orders for different kinds of locks.


Report of order data - grouped by product

This report groups the data by product. Each group displays all the orders for a specific product. At first it appears that this might be useful, but then it becomes clear that each product group includes orders from several different regions.

The information is helpful, and it brings you closer to your goal, but you are still a long way from having the information you need.

Each product group contains orders for many regions.


Report of order data - grouped by region and product

This report is the logical next step. If the By Region report contains multiple products in each region group, and the By Product report contains multiple regions in each product group, then it seems to make sense to combine the two. Doing that, you group first by Region and then by Product.

Each group contains orders for one product for one region.

But the data is all spread out and remains difficult to analyze. This information is useful, and with a little work you can use a report like this to get the comparison information you need. However, a Cross-Tab offers a better solution.


Order data in a Cross-Tab object

With Cross-Tabs, all the information you need is provided in a compact format. The report shows the products sold in each region and what the unit sales were. It is easy to see, for example, that Guardian Mini Locks are not popular at all in California but they are the biggest seller in BC or that Florida is being outsold by Alabama in every lock category.

In this Cross-Tab:

  • Product names make up the row headings.
  • Regions make up the column headings.
  • The value at each row/column intersection is the sum of all the orders for a particular product for a particular region; for example, the total number of Guardian Mini Locks purchased in British Columbia.
  • The total at the end of each row is the total of all of the purchases for one product in all regions; for example, the total number of Guardian ATB Locks purchased in Alabama, British Columbia, California, and Florida combined.
  • The total at the bottom of each column is the total number of all kinds of locks ordered in one region; for example, the number of locks of all kinds purchased in California.
  • The total in the bottom right corner is the grand total showing the total unit sales of all five locks in all four regions.

The report is compact, and enables you to compare your customers' purchasing habits quickly.


Creating a Cross-Tab report

This section provides you with the steps to create a Cross-Tab object in a new report and how to add a Cross-Tab object to an existing report.

Things to keep in mind when using Cross-Tab objects:

  • You can have multiple rows, columns, and summarized fields.
  • You can insert as many Cross-Tab objects in a report as you need.
  • You can insert the Cross-Tab into either the Report Header or Footer, or the Group Header or Footer.
  • You can place Cross-Tab objects in subreports. This is useful when you want to refer to the results from another report.


To create a new cross-tab report

  1. On the File menu, click New.

    The Seagate Crystal Report Gallery appears.

  2. In the Choose an Expert area click Cross-Tab.

  3. Click OK.

    The Cross-Tab Report Expert appears. This expert is made up of seven tabs: Data, Links, Cross-Tab, Style, Customize Style, Chart, and Select.


Specifying the data source

  1. Click the data source type: Database, Query, or Dictionary.

    This example uses Database.

    The Data Explorer dialog box appears.

  2. Locate the data source.

    This example uses the Xtreme Sample Database.

  3. Click the plus sign to expand the folder.

  4. Select the tables that contain the fields to include in the report.

    This example uses Customer, Orders, Orders Detail and Product.

  5. Click Add.
  6. Click Close.

    The Links tab appears.


Modifying the links

  1. In this example, check to make sure that the Customer table is linked to the Product table via the Orders and Orders Detail tables.

    If you do not like the linking that Seagate Crystal Reports has automatically suggested, change it by clicking Clear Links, and then select the fields that you would like to link together.

  2. Click Next.

    The Cross-Tab tab appears.


Defining the structure of the Cross-Tab

Add fields to the Rows, Columns, and Summarized Field areas.

  1. From the Customer table, click Region, then click Add Row.

    The Region field is added to the Rows area.

  2. From the Product table, click Product Class, then click Add Column.

    The Product Class field is added to the Columns area.

  3. From the Orders table, click Order Amount, then click Add Summarized Field.

    The Orders Amount is added to the Summarized Field area.

  4. Apply additional structure by:
      • Adding formulas to any of the fields - select the field then, click New Formula.

        For more information see Working with the Formula Editor.

      • Defining the sort method - select the field then, click Group Options (ascending, descending or specified order).
      • Changing the summary operation - select the field then, click Change Summary.
  5. Click Next.

    The Style tab appears.


Applying a predefined style

  1. Select a style.

    For this example choose Original.

  2. Click Next.

    The Customize Style tab appears.


Formatting the Cross-Tab

Change the background color of a dimension
  1. Select the dimension.
  2. Select the color from the Background Color drop down list.
  3. Click Next if you have finished customizing your Cross-Tab.
Create an Alias for a Dimension

You can create aliases to shorten long dimension names. This is useful when you plan on referring to a dimensions in conditional formatting formulas (GridRowColumnValue function).

  1. Select the dimension.
  2. Enter the alias name.
  3. Click Next if you have finished customizing your Cross-Tab.
Changing Grid Object Options

You can change the formatting of your grid objects using the check boxes associated with the following options:

  • Show cell margins
  • Indent row labels
  • Repeat row labels
  • Keep columns together
  • Row totals on top
  • Column totals on left
  • Suppress empty rows
  • Suppress empty columns.
Format grid lines

In the Format grid lines area you can define whether the lines show or not, as well as the color, style, and width.

  1. Click Format Grid Lines.

    The Format Grid Lines dialog box appears.

  2. From the list, choose the description of the area where you would like the lines to appear, or click the appropriate area in the Format Grid Line diagram.
  3. Select the color, style, and width.
  4. Select the Draw check box to have your lines appear in the report.
  5. Click OK.
  6. Click Next.

    The Chart tab appears.


Adding a chart

  1. Work through the Type, Data, Axes, Options, and Text tabs to add a chart to your cross-tab.

For more information see Charting concepts.

  2. Click Next.
  3. The Select tab appears.


Selecting fields

Use this tab to apply selection conditions. This limits the results that are returned in your report to only those records that you are interested in.

  1. Click the field to apply selection to.

    For this example choose Region.

  2. Click Add.

    The field is added to the Select Fields area and the filter drop-down list appears below the Available fields area.

  3. From the filter drop-down list choose a filter method.

    Choose is one of as the filter method.

    Choose AZ, CA, OR, from the drop-down list.

    The report will provide you with a breakdown and summary of accessory and bicycle sales for Arizona, California, and Oregon.


Completing the report

  1. Click Preview Report.

    The Cross-Tab appears in the Preview tab.

  2. If you do not want the report to appear in the Report Header, click the Design tab, and move the Cross-Tab to the Report Footer, or Group Header or Footer.

Note: If you place the Cross-Tab in the Report Footer, unsuppress the footer, by right-clicking in the Report Footer area and selecting Don't Suppress.

  3. Click the Preview tab to view the report.


To add a Cross-Tab to an existing report

In this example, a Cross-Tab is added to an existing report to show the sales in North America compared to the rest of the world.

  1. Open your report.

    This example uses the Group by Intervals.rpt included in the Feature Examples directory.

  2. Click the Design tab.
  3. On the Insert menu, click Cross-Tab.

    The Format Cross-Tab dialog box appears. This dialog box is made up of [image] three tabs: Cross-Tab, Style, and Customize Style.

Defining the structure of the Cross-Tab

Add fields to the Rows, Columns, and Summarized Field areas.

  1. From the Report Fields list, click Country, then click Add Row.

    The Country field is added to the Rows area.

  2. From the Report Fields list, click Last Year's Sales, then click Add Summarized Field.

    The Last Year's Sales field is added to the Summarized Field area.

  3. Apply additional structure:
      • Click Country in the Rows area.
      • Click Group Options.
      • Select in specified order from the drop-down list.
      • Type North America for the Name of the Named Group.
      • Click New.
      • Choose is one of from the drop-down list.
      • Select Canada, Mexico, and the U.S. from the drop-down list.

      • Click OK to close the Define Named Group dialog box.
      • Click OK to close the Cross-Tab Group Options dialog box.
Choosing a predefined style
  1. Click the Style tab.
  2. Select a style.
Applying a custom style
  1. Click the Customize Style tab.
  2. Customize the style as desired.
Finishing the Cross-Tab
  1. Click OK.
  2. Place the Cross-Tab in either the Report Header or Report Footer.
  3. On the Report menu, click Refresh Report Data.

    The updated report appears.


Formatting Cross-Tabs

Seagate Crystal Reports has powerful formatting capabilities that can be applied to Cross-Tabs. You can:

  • change the width and height of Cross-Tab cells
  • format the background color of an entire row/column at once
  • format the background of Grand Totals
  • format fields individually
  • format several fields at once
  • suppress empty rows, columns, or totals
  • print Cross-Tabs that span multiple pages, with the option of repeating the row headings
  • apply grid line formatting
  • indent row labels
  • place row totals on top or bottom
  • place column totals on left or right.

By applying such formatting as background color, borders, and fonts, you can emphasize important data and create professional-looking and easy-to-understand Cross-Tabs.

For more information see Formatting properties.


Changing width and height of Cross-Tab cells

  1. In the Design tab, click a Row or Column heading within the Cross-Tab, to activate the sizing handles.
  2. Click and drag one of the sizing handles to expand the width or height of the Cross-Tab cell.
  3. Click the Preview tab to view the changes.

Note: Changing one row or column heading affects all of the rows or columns.


Formatting background color of entire rows/columns

Use background colors to emphasize rows or columns within you Cross-Tab.

  1. Right-click the blank top-left area of the Cross-Tab and select Format Cross-Tab from the shortcut menu.

    The Cross-Tab dialog box appears.

  2. Click the Customize Style tab.
  3. Click the row (in the Rows area) or column (in the Columns area), and select a color from the Background Color drop-down list.
  4. Click OK to return to the Cross-Tab.

    The row/column is formatted as specified.


Formatting fields individually

  1. Right-click the field you want to format and choose Format Field from the shortcut menu.

    The Format Editor appears.

  2. In the Format Editor, make font, background, borders, numbering, currency symbols, and printing characteristics choices.
  3. Click OK to return to the Cross-Tab.

    The field is formatted as specified.

Formatting several fields at one time

  1. Use the Shift-click method to highlight the desired fields.
  2. Right-click any one of them and choose Format Objects from the shortcut menu.

    The Format Editor appears.

  3. In the Format Editor, make font, background, borders, numbering, currency symbols, and printing characteristics choices.
  4. Click OK to return to the Cross-Tab.

    The fields are formatted as specified.


Suppressing Cross-Tab data

This section provides you with the steps required to suppress data in your report. You can suppress:

  • Empty rows and columns
  • Row and column grand totals
  • Subtotals and their labels.
To suppress empty rows and columns
  1. Right-click the blank top-left area of the Cross-Tab and select Format Cross-Tab from the shortcut menu.

    The Cross-Tab dialog box appears.

  2. Click the Customize Style tab.
  3. Select either the Suppress Empty Rows or Suppress Empty Columns check box.
  4. Click OK.

    Now, when you print the report, empty rows and/or columns will not appear.

To suppress row and column grand totals
  1. Right-click the blank top-left area of the Cross-Tab and select Format Cross-Tab from the shortcut menu.

    The Cross-Tab dialog box appears.

  2. Click the Customize Style tab.
  3. Select either the Suppress Row Grand Totals or Suppress Column Grand Totals check boxes.
  4. Click OK.
To suppress subtotals and labels

If you have more than two groups in your Cross-Tab you can suppress the subtotal and label for one of them.

  1. Right-click the blank top-left area of the Cross-Tab and select Format Cross-Tab from the shortcut menu.

    The Format Cross-Tab dialog box appears.

  2. Click the Customize Style tab.
  3. Click the field whose subtotal you want to suppress.

    The Suppress Subtotal and the Suppress Label check boxes become active.

  4. In the Group Options area select the Suppress Subtotal check box.
  5. Click the Suppress Label check box to suppress the label associated with subtotal.
  6. Click OK.


Printing Cross-Tabs that span multiple pages

When you create a Cross-Tab that is wider or longer than the specified page size, the program automatically spans the printing across enough pages to accommodate the size of the Cross-Tab. In the Preview tab, a line will appear at each page break. For ease in reading, column headings will be repeated on subsequent pages. Row headings can also be repeated using the Keep Columns Together option.

To repeat row labels
  1. Right-click the blank top-left area of the Cross-Tab and select Format Cross-Tab from the shortcut menu.

    The Cross-Tab dialog box appears.

  2. Click the Customize Style tab.
  3. Select the Repeat Row Labels check box, if desired.


Creating and Updating OLAP Reports

This section describes how to create OLAP reports with a variety of OLAP and Multi-Dimensional data sources and how to update them when the location of your data changes.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample report installed with Seagate Crystal Reports that contains an OLAP cube is:

  • OLAP Cube Report.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


OLAP reporting with Seagate Crystal Reports

Although relational databases such as SQL servers and PC databases are the most common sources of data, Online Analytical Processing (OLAP) and Multi-Dimensional Data (MDD) are rapidly becoming the popular data-storage and analysis formats. Seagate Crystal Reports provides the same access and reporting features for OLAP data sources that it provides for relational data.

Note: The term OLAP is used in this topic to refer to all common forms of OLAP and Multi-Dimensional Data storage and access systems.

OLAP Grid Objects

When you design a report with OLAP data, Seagate Crystal Reports creates a primary report containing one or more OLAP grid objects. OLAP grid objects look and act much like Cross-Tab objects, but they are designed specifically for OLAP data.

OLAP grid objects provide true multi-dimensional reporting. Add dimensions to either axis to analyze three, four, or more dimensions in a single OLAP grid. Or instead of viewing multiple dimensions within one OLAP grid, create multiple OLAP grids within the same report.


Creating an OLAP report

OLAP reports are created using the OLAP Report Expert. The expert is made up of seven tabs. Before you start creating your report, ensure you have the following information:

  • OLAP Type (Essbase Cube, IBM DB2 OLAP Server, OLE DB for OLAP, Informix MetaCube, or Holos HDC Cube)
  • Server/Database name
  • User ID
  • Password
  • Parameters (applies only to OLE DB for OLAP).
To create an OLAP report

This procedure uses the sample xtreme.hdc cube included in the OLAP Data folder.

  1. From the File menu, click New.

    The Seagate Crystal Report Gallery appears.

  2. Select OLAP.

  3. Click OK.

    The OLAP Report Expert appears with the Data tab active.


Specifying the data source

Use the Data tab to define the OLAP data source.

  1. Click Server Type.

    The Choose OLAP Type dialog box appears.

  2. Select the OLAP Type you are using.

  3. Click OK.

    The Browse For Database dialog box appears.

  4. Click Browse, and select the OLAP source.

    This example uses the xtreme cube.hdc found in the OLAP Data folder.

  5. Click Open.

    The Browse For Database dialog box appears.

  6. Click OK.

    The Data tab appears with the supplied data source information.

  7. Click the Next tab.


Defining the structure of the grid

Use the Rows/Columns tab to define how your data is structured within the grid. You can place the dimensions into either the Columns or Rows areas.

  1. Select a dimension to appear in the report.
  2. Click either Add Row or Add Column, depending on where you would like the dimension to be located.
  3. Continue adding dimensions to the Rows and Columns areas.

  4. Click the Up and Down Arrow buttons associated with the Rows and Columns area to arrange the order of the dimensions.

    Note:

      • If you accidentally add a dimension to either the Rows or Columns area, click Remove to return it to the Dimensions list.
      • The Show Long Names check box is selected by default. This means that, for example, the month field will be displayed as January, February, etc., as opposed to M01, M02, etc.
  5. Click the field picker to specify the fields to be included in your report.

    The Select Fields for Dimension dialog box appears.

  6. Select the fields you would like to include.
  7. Click OK.
  8. Click Next.

    The Filter/Page tab appears.


Specifying the number of grids and applying filters

Use this tab to limit the records that are returned, and specify the number of grids that are required.

The Filter area determines the boundaries that will be placed on your report. For example, if you have a time dimension that is made up of fiscal quarter fields, you could specify the report return the results for a specific quarter.

Note: If all of your fields were used in the Rows/Column tab nothing will appear here.

The Page area enables you to determine the number of grids and the subject of each. For example, if you have a product dimension, you could put this in the page area and specify two different products. This would result in two grids with the same rows, columns, and formatting, but each one would be based on a different product.

Specify a filter
  1. Click the field picker to determine the field that is going to be used as the filter.

    The Select Fields for Dimension dialog box appears.

  2. Select the appropriate field, expanding the structure if necessary.
  3. Click OK.
  4. Click Next if you do not want to add a page.

    The Style tab appears.

Add a page
  1. Drag and drop the dimension(s) into the page area.

    The Select Fields for Dimension dialog box appears.

  2. Expand the dimensions structure and select the appropriate fields.
  3. Click OK.
  4. Click Next.

    The Style tab appears.


Applying a predefined style

  1. Select a predefined style for the grid from the list.

    A preview of the color scheme you select appears on the right.

    Note: The color of the style you select may not appear correctly if your screen resolution is set to 256 colors. Increase the resolution to correct this.

  2. Click Next.

    The Customize Style tab appears.


Formatting the grid

Change the background color of a dimension
  1. Select the dimension.
  2. Select the color from the Background Color drop down list.
  3. Click Next if you have finished customizing your grid.
Create an Alias for a Dimension

You can create aliases to shorten long dimension names. This is useful when you plan on referring to a dimension in a conditional formatting formulas (GridRowColumnValue function).

  1. Select the dimension.
  2. Enter the alias name.
  3. Click Next if you have finished customizing your grid.
Changing Grid Object Options

You can change the formatting of your grid objects using the check boxes associated with the following options:

  • Show cell margins
  • Indent row labels
  • Repeat row labels
  • Keep columns together
  • Row totals on top
  • Column totals on left
  • Suppress empty rows
  • Suppress empty columns.

Format grid lines

In the Format grid lines area you can define whether the lines show or not, as well as the color, style, and width.

  1. Click Format Grid Lines.

    The Format Grid Lines dialog box appears.

  2. From the list, choose the description of the area where you would like the lines to appear, or click the appropriate area in the Format Grid Line diagram.
  3. Select the color, style, and width.
  4. Select the Draw check box to have your lines appear in the report.
  5. Click OK.
  6. Click Next.

    The Labels tab appears.


Labelling dimensions

In the Labels tab you are able to define which dimensions will be labeled and how they will be displayed in the grid. The dimensions available to you are the ones that have been designated as a page or filter.

  1. Using the arrow buttons, move the dimensions to the Unlabeled and Labeled areas as required.
  2. Make changes to the appearance of the label by using the options available in the Label Position and Label Spacing areas.

  3. Click Next.

    The Chart tab appears.


Inserting a chart

The charting process for OLAP reports is similar to Standard reports.

For more information refer to Charting on an OLAP cube (OLAP layout) and Creating charts.


Completing the process

To finalize your report, click either Design Report or Preview Report.


Updating an OLAP report

The location of the OLAP data accessed by your report may change. Some possible scenarios include:

  • The location of the OLAP server or database may change due to restructuring of Information System resources.
  • Another cube instance may have been successfully processed and reflect more current information.
  • New reports may be developed on a smaller database that represents a subset or production version of the primary OLAP database, then ported over to the actual working database to report on real data.

Before updating your report it is important to ensure that is compatible with the data. Some things to look for include:

  • removing dimensions contained in the report that are not in the cube
  • removing fields referred to explicitly in the design of the report, such as a formula.

Note: If a report contains subreports or grids, and the database used for the them have changed name or location, you must update each subreport or grid.


To update a cube location in an OLAP grid object

  1. Select the grid by clicking on the border.
  2. From the Database menu, click Set OLAP Cube Location.

    The Confirm Command dialog box appears.

  3. Click Yes.

    The Set OLAP Database Location dialog box appears.

  4. Click Select.

    The Choose OLAP Type dialog box appears.

  5. Select the OLAP Type.
  6. Click OK.

    The Connect To Server dialog box appears.

  7. Enter the OLAP Server, User ID, and Password.

    Note: The fields will vary depending on the OLAP type you are using.

  8. Click Connect.

    The Chose Cube dialog box appears.

  9. Select a cube.
  10. Click OK.

    The Set OLAP Location dialog box appears.

  11. Click OK.

    The Propagate Set Location dialog box appears.

  12. Click Yes to update the remaining OLAP grids and follow the updating the database location steps; otherwise click No to return to the report.
Updating the database location
  1. Click Yes to update the database location.

    The Set Location dialog box appears.

  2. Select the database, then click Set Location.

    The Data Explorer appears.

  3. Expand the directory for the cube.
  4. Select the table, then click Set.

    The Connect to Server dialog box appears.

  5. Enter the OLAP Server, User ID, and Password.

Note: The fields will vary depending on the OLAP type you are using.

  6. Click Connect.

    The Chose Cube Dialog box appears.

  7. Select the cube, then click OK.
  8. The Propagate Set Location dialog box appears with a message asking you to propagate the server and database changes across tables with the same original information.
  9. Click Yes.


Using the Informix MetaCube SQL Method for reporting

There are two methods for creating OLAP reports based on Informix MetaCube information. The first is using the OLAP Report Expert, and the second is using the Informix MetaCube SQL Method.

This section provides you with instructions for creating OLAP reports for Informix MetaCube databases using the Informix MetaCube SQL Method.

Creating a report with Informix MetaCube is very similar to creating a report based on any relational database. When creating a report, you will see a list of Tables, Sample tables, and Predefined queries with dimensions, attributes, and measures. When working with OLAP data, it is often a good idea to create a Cross-Tab style report. In addition, it is also a good idea to add a filter to your report to limit the number of records that are returned when you run the report. This filtering can be done using the Record Selection Formula Editor.

The following procedures use the Metademo DataSource included with the Informix Metacube CD.


To create an OLAP report using the Informix MetaCube SQL Method

  1. On the File menu, click New.

    The Seagate Crystal Report Gallery appears.

  2. Confirm that Report Expert and Standard are selected, then click OK.

  3. Click Database.

    The Data Explorer appears.

  4. Expand the More Data Sources folder, then click the Informix MetaCube folder.

  5. In the RDBMS Login & Choose DSS System dialog box, enter the Password, then click OK.

  6. Select the Brand Channel Net Profit table.
  7. Click Add, then click Close.

    The Standard Report Expert appears.

  8. Click Next.

    The Fields tab appears.

  9. For this example select the Channel.Channel, Product Brand, and Sales Transactions fields then click Add.

  10. Click Preview Report to view the report.

Note: You may have to adjust the column widths of the fields and field headers to see all the data. If you wish to hide the Channel Field column simply select the top element in the field, click the right mouse button and select Delete from the shortcut menu.


To create an Informix MetaCube Cross-Tab report

  1. On the File menu, click New.

    The Seagate Crystal Report Gallery appears.

  2. Select the Cross-Tab Expert.

  3. Click OK.

    The Cross-Tab Report Expert appears.

  4. Click Database.

    The Data Explorer appears.

  5. Expand the More Data Sources folder, then expand the Informix Metacube folder.

  6. In the RDBMS Login & Choose DSS System dialog box, enter the password, then click OK.

    Note: If you have already been working with Informix MetaCube reports during this session, you may not be required to login.

  7. Select the Audio Sales YTD by Channel and Brand Channel Net Profit tables, then click Add, then click Close.

    The Cross-Tab Report Expert appears with the Links tab active.

  8. Click Next.

    The Fields tab appears.

  9. Drag and drop the following fields from the Report Fields area to the appropriate Cross-Tab areas:
      • Attributes.Channel.Channel field from the Audio Sales YTD Channel table to the Rows area.
      • Attributes.Product.Brand field from the Brand Channel Net Profit table to the Columns area.
      • Measures.Sales Transactions.Net Profit field from the Brand Channel Net Profit table to the Summarized Fields area.

  10. Click Preview Report to see a Cross-Tab report based on the fields you selected.
  11. Save the report.

    This report is used in the adding a field to a Cross-Tab report tutorial.


To add a field to an Informix MetaCube Cross-Tab report

This tutorial is based on the report created in the tutorial for creating Informix MetaCube Cross-Tab reports.

  1. Select the entire Cross-Tab object by clicking in the top, left-hand corner of the object above the top row header, to the left of the far left column header.
  2. On the Format menu, click Format Cross-Tab.

    The Format Cross-Tab dialog box appears.

  3. Drag and drop the Attributes.Time.Fiscal Year field from the Audio Sales YTD by Channel table into the Columns area.

  4. Click OK.

    Fiscal Years is now added to the Cross-Tab report.

    Note: You may have to expand the columns to see all of the information.

  5. Save the report.

    This report is used in the pivot fields in an Informix MetaCube Cross-Tab report tutorial.


To pivot fields in an Informix MetaCube Cross-Tab report

This tutorial is based on the report created in the tutorial on how to add a field to an Informix MetaCube Cross-Tab report. Because of the numerous brands, the report is difficult to work with as far as viewing data or printing. To make it more user friendly, it would be beneficial to switch the fields so that the columns became rows and rows became columns.

  1. Click on the top column header "Alden" and drag it so that it is positioned over the row header "Department Stores" and drop it.

  2. Now take the row header "Department Stores" and drag it so it is positioned over the column header "Year 1996" and drop it.

  3. To finish, take the "Year 1996" column header and position it over the Alden row header and drop it.


To update the location for an Informix MetaCube using the MetaCube SQL method

  1. On the Database menu, click Set Location.

    The Set Location dialog box appears.

  2. Select the Database, then click Set Location.

    The Data Explorer appears.

  3. Select the table.
  4. Click Set.

    The Propagate Set Location dialog box appears.

  5. Click Yes.
  6. Click Done.


Distributing and Viewing Reports

This section provides you with information about how to distribute finished reports using a variety of methods (printing, faxing, exporting). In addition, it includes instructions for viewing your reports using a web browser and Crystal Report Viewers.

Additional Resources

Read or download a technical brief that discusses printing, distributing and viewing reports from the Seagate Software Community web site:

http://community.seagatesoftware.com/library/overview.asp


Distributing Reports

Seagate Crystal Reports enables you to distribute your report using a variety of methods. This section covers how to:

  • print a report
  • fax a report
  • export a report
  • save a report in Seagate Crystal Reports 7 format
  • open and save reports using a web folder
  • use a web browser with a Report Viewer to view a report.


Printing a report

To print a report
  1. On the File menu, select Print, then click Printer.

    The Print dialog box appears.

  2. Choose the following:
      • Print range: all pages or a specific range.
      • Number of copies.
      • Collate copies: if this option is selected, the report will print each page in order. For example, if you are printing two copies of a report with four pages your report will print page one, two, three, and four of the first copy, then print the second copy.
  3. Click OK.

    The Printing Records dialog box appears showing the progress of your print job.


Faxing a report

Many fax applications, such as Microsoft® Fax and DelrinaTM WinFax, allow you to set up a printer driver that will fax documents over a modem. When using one of these applications, you can fax a report from Seagate Crystal Reports.

To fax a report
  1. On the File menu, click Printer Setup.

    The Print Setup dialog box appears.

  2. Select the fax driver from the Name drop-down list.
  3. Click OK.
  4. On the File menu, select Print, then click Printer.

    The Print dialog box appears.

  5. Click OK.

    Your fax application appears, prompting you to select a cover page and to fill in the appropriate fax information.


Exporting a report

Finished reports can be exported to a number of popular spreadsheet and word processor formats, as well as to HTML, ODBC, and common data interchange formats. This makes the distribution of information easier. For example, you may want to use the report data to project trends in a spreadsheet package or to enhance the presentation of data in a desktop publishing package.

The exporting process requires you to specify a format and a destination. The format determines the file type, and the destination determines where the file is located.


Format Types

Seagate Crystal Reports provides you with nineteen different export format types. They include:

  • Character-separated values
  • Comma-separated values (CSV)
  • Crystal Reports (RPT)
  • Crystal Reports 7 (RPT)
  • Data Interchange Format (DIF)
  • Microsoft® Excel
  • HTML 4.0
  • HTML 3.2
  • Lotus 1-2-3
  • ODBC
  • Page Separated HTML
  • Paginated Text
  • Adobe Acrobat(PDF)
  • Record style (columns of values)
  • Report Definition
  • Rich Text Format
  • Tab-separated text
  • Tab-separated values
  • Text
  • Word for Windows document.

In addition to the standard export format types installed on your machine you may find additional export format types are available to you. These are determined by the DLL files on your local machine.

Note: When you export a report to a file format other than Seagate Crystal Reports format (.RPT), you may lose some or all of the formatting that appears in your report. However, the program attempts to preserve as much formatting as the export format allows.


Destination

The destination determines the export location of your report. Seagate Crystal Report enables you to choose one of six destinations. They include:

  • Application
  • Disk file
  • Microsoft Exchange folder
  • Lotus Domino
  • Lotus cc:Mail (VIM)
  • Microsoft Mail (MAPI).


Exporting to an application

If you export to an application, the program exports the report to a Temp file in the specified format, and then opens the file in the appropriate application.

Note:

  • When exporting in ODBC format, "Application" and "Disk file" are the same.
  • You will need to specify a file path if you are exporting in HTML format.
  • The file name of the report and the file name of the Temp file cannot be the same.

The sections below provide instructions on how to export a report to the Microsoft Excel 7.0 Extended format for each of the different destination types.

To export to an application
  1. Open the report you would like to export.
  2. On the File menu, select Print, then click Export.

    The Export dialog box appears.

  3. Select the export format type from the Format drop-down list. In this case, choose Excel 7.0 (XLS) (Extended).
  4. Select Application from the Destination drop-down list.
  5. Click OK.

    The Format Options dialog box appears.

  6. Change the formatting options as needed.
  7. Click OK.

    The Exporting Record dialog box appears.

Note: Click Cancel Exporting to cancel the export process.

The program exports the report and opens it in the appropriate application. In this example, Microsoft Excel opens with the exported data.


Exporting to a disk file

If you export to a disk file, the program saves the report to the disk or diskette you have specified.

To export to a disk file
  1. Open the report you would like to export.
  2. On the File menu, select Print, then click Export.

    The Export dialog box appears.

  3. Select the export format type from the Format drop-down list. In this case, choose Excel 7.0 (XLS) (Extended).
  4. Select Disk file from the Destination drop-down list.
  5. Click OK.

    The Format Options dialog box appears.

  6. Change the formatting options as needed.
  7. Click OK.

    The Choose Profile dialog box appears.

  8. Select the appropriate directory.
  9. Enter the File name.
  10. Click Save.

The program exports the report and saves it in the designated directory. In this example the file is saved in the Temp directory in an .xls format.


Exporting to a Microsoft Exchange folder

Seagate Crystal Reports enables you to export a report file to a Microsoft Exchange folder. You select the folder, and the report is stored there in the format that you specify. A Microsoft Exchange folder can contain standard notes (mail), files, and instances of Microsoft Exchange forms.

To export to a Microsoft Exchange folder
  1. Open the report you would like to export.
  2. On the File menu, select Print, then click Export.

    The Export dialog box appears.

  3. Select the export format type from the Format drop-down list. In this case, [image] choose Excel 7.0 (XLS) (Extended).
  4. Select Exchange Folder from the Destination drop-down list.
  5. Click OK.

    The Choose Profile dialog box appears.

  6. Change the formatting options as needed.
  7. Click OK.

    The Choose Export File dialog box appears.

    Note: You will be prompted by the Microsoft OutlookTM Setup Expert if Microsoft Exchange, Microsoft Mail, or Internet E-mail is not set up on your machine.

  8. Select the desired profile from the Profile Name drop-down list. If the profile is not listed, click New to create it.
  9. Click OK when finished.
  10. When the Select a Folder dialog box appears, select the folder in the profile in which you want the report to appear, and click OK.

The report is exported to the Microsoft Exchange folder you selected. The exported report can now be accessed through the Microsoft Exchange client.


Exporting to Lotus Domino

Seagate Crystal Reports enables you to export to a Lotus Domino client version 3.0 or greater.

Note: The Lotus Domino OS/2 client is not supported.

To export to Lotus Domino
  1. Using the Lotus Domino Designer open an .nsf file and create a new form.
  2. Add the following optional fields to the form to provide the user with additional information:
      • Report - name of the report
      • Date - date and time of export
      • UserName - name of the user who exported the report
      • Comments - area where extra information can be added.
  3. Save the form as Report Form.
  4. Open the Seagate Crystal Report you would like to export.
  5. On the File menu, select Print, then click Export.

    The Export dialog box appears.

  6. Select the export format type from the Format drop-down list. In this case, choose Excel 7.0 (XLS) (Extended).
  7. Select Lotus Domino Database from the Destination drop-down list.
  8. Click OK.

    The Format Options dialog box appears.

  9. Change the format settings as required.
  10. Click OK.

    The Select Database dialog box appears.

  11. Double-click the Lotus Domino server to export the report to.
  12. Select the .nsf file to export the report to.
  13. Click OK.

    The Comments dialog box appears.

  14. Enter comments that are to appear when another user selects the report from the Lotus Domino Desktop.
  15. Click OK.

    The report appears as an attachment in a document within the .nsf file.

The next time a user logs onto the Lotus Domino database you specified, they will see the report in their desktop. The user can double-click the report file name to display the comments you wrote and then double-click the report icon to view the report.


Exporting to Microsoft Mail (MAPI)

  1. Open the report you would like to export.
  2. On the File menu, select Print, then click Export.

    The Export dialog box appears.

  3. Select the export format type from the Format drop-down list. In this case, choose Excel 7.0 (XLS) (Extended).
  4. Select Microsoft Mail (MAPI) from the Destination drop-down list.
  5. Click OK.

    The Format Options dialog box appears.

  6. Change the formatting options as needed.
  7. Click OK.

    The Send Mail dialog box appears.

  8. Enter the address details, then click Send.

    The Exporting Record dialog box appears.

Note: Click Cancel Exporting to cancel the export process.


Saving your report in Version 7 format

To enable people who are using Version 7 of Seagate Crystal Reports to make changes in the report you have created in Version 8, save your report as Crystal Reports (Version 7).

To save your report in Version 7 format
  1. On the File menu, click Save As.

    The Save As dialog box appears.

  2. Choose a folder.
  3. Enter the File name.

    Check to make sure it has a .rpt extension.

  4. From the Save as type drop-down list, select Crystal Reports (Version 7).

  5. Click Save.

Note: Seagate Crystal Reports Version 8 features are not supported in Version 7. You may not want to save your report in Version 7 format if you are using these features. For example, if your report uses formulas created with Basic syntax, the report will not compile correctly if you save in 7.0 format.


Exporting to HTML

Providing support for the Internet and corporate intranets becomes more important with every passing day. Seagate Crystal Reports recognizes this importance and provides World Wide Web support. Although incorporated as an export format, HTML represents a whole new export destination for reports as well.

By exporting reports in HTML format, Seagate Crystal Reports provides you with a new option for rapid, convenient distribution of important company data. Once exported, your reports become accessible with many of the most popular Web browsers, including Netscape and Microsoft Internet Explorer.


To export to HTML

  1. With the report you want exported active, click Export on the Standard toolbar.

    The Export dialog box appears.

  2. From the Format drop-down list, select HTML 3.2.
  3. Select a destination from the Destination drop-down list. The rest of this section assumes you select Disk file to store the HTML document in a directory on a Web server.
  4. Click OK.

    The Export To Directory dialog box appears. When exported to HTML format, a report is saved to one HTML file. If you prefer, click the check box to have each page saved to a separate file. For this reason, the program asks you for the name of a directory for an export destination, and uses default names for the HTML files. The initial HTML page will be saved as Reportfilename.HTM. This is the file you open if you want to view your report through your Web browser.

  5. Select an existing directory, or create a new directory for your report.
  6. To navigate through separate HTML files click the Page Navigator option.
  7. Click OK.

    The program exports the report to HTML format.


Exporting to an ODBC data source

Seagate Crystal Reports allows you to export reports to any ODBC data source. If you have an ODBC data source set up for a database or data format, you can export your report to that data format through ODBC.

For instance, you may have an ODBC data source set up through ODBC Administrator that you normally use to access database tables designed in Microsoft SQL Server. Using the Export dialog box, however, you can select your SQL Server data source and export your report as a new SQL Server database table.

Note: You must have an ODBC data source set up through ODBC Administrator in order for the program to export to a particular ODBC database format. See How to set up an ODBC data source.

Exporting to an ODBC data source allows you to:

  • change data from a centralized database format into a format compatible with a local DBMS application,
  • change data from a local database format into a format compatible with a centralized database,
  • create a new database table that can be used as a separate data set in future reporting,
  • create a mini data-warehouse, and
  • manipulate database data by filtering records, adding formulas, and removing fields to create a new database table that provides the data you need most for your work.


To Export to an ODBC data source

  1. With the report you want exported active, click Export on the Standard toolbar.

    The Export dialog box appears.

    {bmc bt_expor.gif}

  2. From the Format drop-down list, select the ODBC data source for the format in which you want to export your report. For example,
    ODBC - CRSS allows you to export your report to a Microsoft SQL Server database.
  3. Destination is ignored when you are exporting a report to an ODBC data source. You do not need to make any changes to the Destination edit box. Click OK in the Export dialog box.
  4. If your ODBC data source specifies a particular database, the report will be exported to that database. Otherwise, the Select Database dialog box appears. Select the database to which this report will be added as a new table, and then click OK.
  5. If the ODBC data source you selected requires a Logon ID and password, the Login or SQL Server Login dialog box appears. Enter your ID and Password, and then click OK.

    The Enter ODBC Table Name dialog box appears.

  6. Enter the name you want to give to the new table in the database, and then click OK.

The program exports the report as a new table to the database you specified.

Note: If your report contains a binary field, you will be unable to export it to an ODBC data source successfully.


Exporting to CC Mail

  1. With the report you want to export active, click Export on the Standard toolbar.

    The Export dialog box appears.

  2. From the Destination drop-down list, select Lotus cc:Mail (VIM).
  3. Click OK.

    The Character-Separated Values dialog box appears.

  4. Change the default Separator and Delimiter as required, then click OK.

    The number and Date Format dialog box appears.

  5. Select the Same number and Same date formats check boxes as required, then click OK.
  6. Enter password information as required, then click OK.

    The Send Mail window appears.

  7. Complete the fields as required, then click Send.


Working with Web Folders

You have the ability to open and save reports using Web Folders if you:

  • are running Windows 2000 or have Office 2000 installed
  • have access to a web server that is configured to support Web Folders
  • add a Web Folder from this server into your Web Folders folder.
To open your report
  1. On the File menu, click Open.

    The Open dialog box appears.

  2. Click Web Folders.
  3. Open the folder that contains the report.
  4. Double-click to open the report.
To save your report
  1. On the File menu, click Save As.

    The Save As dialog box appears.

  2. Click Web Folders.
  3. Locate the folder you would like to save the report to.
  4. Enter the file name.
  5. Click Save.

Note: After making changes to a report in a Web Folder, you must save the changes to the same file in the same Web Folder.


Using a web browser to view reports

Your Systems Administrator or Information Systems Manager will have set up an intranet/extranet site where you can view your reports in a browser. Contact your web administrator to ask for the URL. This URL will specify both the Web Component Server and Report Viewer.

There are three types of Web Component Servers:

  • WCS via ISAPI\NSAPI Extension
  • WCS CGI Extension
  • ASP Reports Server

There are six types of Crystal Report Viewers:

  • Report Viewer for ActiveX
  • Report Viewer for Java using Browser JVM
  • Report Viewer for Java using Java Plug-in
  • Report Viewer for Netscape Plug-in
  • Report Viewer for Standard HTML with Frames
  • Report Viewer for Standard HTML

Using the appropriate Web Component Server and Report Viewer, you can easily view and print your reports from a web browser.

Note: Crystal Report Viewers for Java and HTML can be used on any platform, while the Report Viewer Plug-in and the Report Viewer for ActiveX are made specifically for Windows environments.


Report Viewer Demonstration

If you are interested in trying out the functionality of a Web Component Server and Report Viewer, and have access to a web server, you can explore the Seagate Software Web Samples.

To access the Web Samples
  1. Click Start, select Programs, select Seagate Crystal Reports, then click Web Samples and Utilities Page.

    The Seagate Crystal Reports Web Samples & Utilities Home page appears.

  2. In the Report Server Samples area, click view the samples.

    The Report Server Samples page appears in your default browser.

  3. Choose a server from the Select a Server Type drop-down list.
  4. Choose a Report Viewer from the Select a Viewer drop-down list.
  5. Click view sample.

    The report appears in the Report Viewer specified.


Using the Report Viewer for ActiveX

  1. Type the URL for the report into your web browser. Obtain this from your Systems Administrator or Information Systems Manager.

    The first page of the requested report appears inside the Report Viewer. A Smart Navigation Group Tree is generated based on the groups in the report.

  2. Expand the tree and click a group to navigate to a specific part of the report.

Note: You may not have access to Smart Navigation with the Group Tree. Smart Navigation may be disabled for the report or for the Report Viewer itself.

In addition to the functions provided on the Standard toolbar, this Report Viewer has the following extra functions in its customized toolbar:

  • Close current view
  • Print
  • Refresh
  • Show/hide group tree
  • Zoom control
  • Go to first page
  • Go to previous page
  • Specify page number
  • Go to next page
  • Go to last page
  • Stop
  • Search text.

Place the mouse pointer over any of the buttons on the customized toolbar to see the associated ToolTip.

Note: If the report has been created using a different type of printer than the one available from your system, you may experience formatting problems when attempting to print a report displayed by the Report Viewer for ActiveX. The Report Viewer Print button uses printer settings saved with the report file. If you experience problems printing a report, contact your web server administrator.


Using the Report Viewer for Java (Browser JVM)

  1. Type the URL for the report into your web browser. Obtain this from your Systems Administrator or Information Systems Manager.

    The first page of the requested report appears inside the Report Viewer.A Smart Navigation Group Tree is generated based on the groups in the report.

  2. Expand the tree and click a group to navigate to a specific part of the report.

Note: You may not have access to Smart Navigation with the Group Tree. Smart Navigation may be disabled for the report or for the Report Viewer itself.

In addition to the functions provided on the Standard toolbar, this Report Viewer has the following extra functions in its customized toolbar:

  • Close current view
  • Go to first page
  • Go previous page
  • Specify page number
  • Go to next page
  • Go to last page
  • Stop
  • Refresh
  • Show/hide group tree
  • Magnification factor
  • Text to search for
  • Find next.

When you place the mouse pointer over a button on the customized toolbar the associated ToolTip appears in the bottom left hand side of the screen.

Note: You may experience minor problems scrolling through reports in the Report Viewer for Java. Such problems are a result of the Java virtual machine implemented in certain web browsers and cannot be accounted for by the Report Viewer for Java. If you experience problems, click repeatedly on the scroll buttons to scroll. Do not hold the scroll buttons down.


Using the Report Viewer for Java (Java plug-in)

  1. Type the URL for the report into your web browser. Obtain this from your Systems Administrator or Information Systems Manager.

    The first page of the requested report appears inside the Report Viewer. A Smart Navigation Group Tree is generated based on the groups in the report.

  2. Expand the tree and click a group to navigate to a specific part of the report.

Note: You may not have access to Smart Navigation with the Group Tree. Smart Navigation may be disabled for the report or for the Report Viewer itself.

In addition to the functions provided on the Standard toolbar, this Report Viewer has the following extra functions in its customized toolbar:

  • Close current view
  • Go to first page
  • Go to previous page
  • Specify page number
  • Go to next page
  • Go to last page
  • Stop
  • Refresh
  • Show/hide group tree
  • Magnification factor
  • Text to search for
  • Find next.

When you place the mouse pointer over a button on the customized toolbar the associated ToolTip appears in the bottom left side of the screen.


Using the Report Viewer for Netscape Plug-in

This Report Viewer for Netscape Plug-in has the same capabilities as the Report Viewer for ActiveX, enabling you to use it with a browser that supports plug-ins, that may not support ActiveX. For example, you could use this with Netscape Navigator and take advantage of all of the printing capabilities usually associated with ActiveX.

  1. Type the URL for the report into your web browser. Obtain this from your Systems Administrator or Information Systems Manager.

    The first page of the requested report appears inside the Report Viewer. A Smart Navigation Group Tree is generated based on the groups in the report.

  2. Expand the tree and click a group to navigate to a specific part of the report.

Note: You may not have access to Smart Navigation with the Group Tree. Smart Navigation may be disabled for the report or for the Report Viewer itself.

In addition to the functions provided on the Standard toolbar, this Report Viewer has extra functions in its customized toolbar:

  • Close current view
  • Go to first page
  • Go to previous page
  • Specify page number
  • Go to next page
  • Go to last page
  • Stop
  • Refresh
  • Show/hide group tree
  • Magnification factor
  • Text to search for
  • Find next.


Using the Report Viewer for HTML (Frames)

  1. Type the URL for the report into your web browser. Obtain this from your Systems Administrator or Information Systems Manager.

    The first page of the requested report appears inside the Report Viewer. A Smart Navigation Group Tree is generated based on the groups in the report.

  2. Expand the tree and click a group to navigate to a specific part of the report.

Note: You may not have access to Smart Navigation with the Group Tree. Smart Navigation may be disabled for the report or for the Report Viewer itself.

In addition to the functions provided on the Standard toolbar, this Report Viewer has extra functions in its customized toolbar:

  • First page
  • Previous page
  • Next page
  • Last page
  • Goto page
  • Refresh report
  • Search.


Using the Report Viewer for HTML

Type the URL for the report into your web browser. Obtain this from your Systems Administrator or Information Systems Manager.

The first page of the requested report appears as a standard HTML page inside the Report Viewer.

In addition to the functions provided on the Standard toolbar, this Report Viewer has extra functions in its customized toolbar:

  • First page
  • Previous page
  • Next page
  • Last page
  • Goto page
  • Refresh report
  • Search in report.


Creating Reports from Excel and Access

This section describes the Add-Ins for Microsoft Excel and Microsoft Access. It explains how the Seagate Crystal Report Wizard is installed and how you create reports from an Access table or query and an Excel spreadsheet.


Overview of the Seagate Crystal Reports Add-Ins

Seagate Crystal Reports takes advantage of Microsoft's Add-In technology by offering a report creation Wizard you can use with Microsoft Excel and Microsoft Access. The Seagate Crystal Report Wizard offers familiar report design capabilities directly within your Microsoft Office applications—you can create a Crystal report from your data without leaving Excel or Access.

The method for working with the Add-Ins is similar in both Excel and Access:

  • Install the Seagate Crystal Report Wizard in your Office application (only if you installed Office after you installed Seagate Crystal Reports) by using the Microsoft Add-In Manager.

    You need to do this only once. The Add-In remains a part of the Office application until you choose to remove it.

  • Select a spreadsheet (or selected cells), table, or query and launch the Wizard.
  • Use the creation Wizard's familiar screen layout to create a report to your specifications.

Note: The Add-Ins work with only the Office 97 and Office 2000 versions of Excel and Access.


About the Microsoft Excel Add-In

Choose an entire data range in a spreadsheet, or select certain cells to create a Seagate Crystal Report. The report you create is linked to your Excel spreadsheet and can be refreshed to show changes made to the spreadsheet data.

Note: Excel Add-In reports are updated when you refresh their data in Seagate Crystal Reports if you have:

  • added a row to the selected spreadsheet range (but not pre-appended or appended a row)
  • deleted a row from the selected spreadsheet range
  • modified a cell within the selected spreadsheet range.

After you create a report using the Wizard, you can preview it using the default ActiveX viewer or you can launch Seagate Crystal Reports or Seagate Analysis to modify it.


About the Microsoft Access Add-In

Choose a table or query to create a Seagate Crystal Report. The report you create is linked to your Access table or query and can be refreshed to show changes made to the database.

Note:

  • Access Add-In reports will not reflect database changes until you close the modified table or query in Access and refresh the report data in Seagate Crystal Reports.
  • Access Add-In reports must be based on one table or query (but not a query with input parameters).

After you create a report using the Wizard, you can preview it using the default ActiveX viewer or you can launch Seagate Crystal Reports or Seagate Analysis to modify it.


Working with the Microsoft Excel Add-In

Installing the Seagate Crystal Report Wizard in Excel

The Microsoft Excel Add-In may need to be installed through Excel's Add-In Manager before you can use it. If you installed Excel after Seagate Crystal Reports, refer to the following procedure. If, however, you installed Excel before Seagate Crystal Reports, the Add-In is installed automatically.

Note: If the Excel Add-In is automatically installed and you choose to remove it, you must install it manually (using the following procedure) and then use the Microsoft Add-In Manager to uninstall it.

Once the Seagate Crystal Report Wizard is added to Excel, you can select it anytime you use Excel.

To install the Seagate Crystal Report Wizard in Excel
  1. On the Tools menu in Excel, choose Add-Ins.
  2. In the Add-Ins dialog box, click Browse.
  3. Search for the file Crptxls.xla in the Browse dialog box.

    Crptxls.xla is installed in the \Program Files\Seagate Software\Report Designer Component directory by default. The file may have been moved to another directory by a system administrator.

  4. After choosing Crptxls.xla, click OK.

    The Seagate Crystal Report Wizard is added to the Add-Ins dialog box and is selected by default.

  5. Click OK.

After installing the Excel Add-In and selecting its check box, a Seagate Crystal Report Wizard menu option is added to the Tools menu and a button is added to the Standard toolbar. You can use either of these to open the Seagate Crystal Report Wizard.


Using the Seagate Crystal Report Wizard to create a report in Excel

The Seagate Crystal Report Wizard in Excel offers familiar Crystal layout and selection screens to help you create a report from your spreadsheet. You can select a range of cells, or an entire data range in a spreadsheet to use as your report content.

Note: When you create a report from an Excel spreadsheet, Seagate Crystal Reports creates a database file (.mdb). This file, the Excel spreadsheet file (.xls), and the report file itself (.rpt) cannot be moved or you'll lose the links between them and won't be able to refresh your report data later.

To create a report in Excel using the Seagate Crystal Report Wizard
  1. On the Tools menu in Excel, choose Seagate Crystal Report Wizard.

    If your spreadsheet has unsaved data, Excel warns you to save before running the Wizard.

  2. Type a data range in the cell range box, or click its button to choose a range directly from the spreadsheet.

    Clicking the button minimizes the Wizard so you can click-drag to select a data range. To return to the Wizard, click the button on the minimized Wizard.

    Note: To select an entire data range in the spreadsheet, click Expand the selected range automatically.

  3. With a data range selected, click Create Crystal Report.

    The Seagate Crystal Report Wizard appears.

    Note: As you design your report, the program creates a database file (.mdb). The database file, the spreadsheet file (.xls), and the resulting report file (.rpt) cannot be moved or you won't be able to refresh your report data later.

  4. Add the database fields you want to appear in your report to the Fields to Display list.

    The arrow buttons on this dialog box enable you to move fields from one list to the other. Single arrows move only the selected field; double arrows move all fields at the same time.

  5. Click Next to choose fields to group on.
  6. Add the database fields you want to group on to the Group By box.

    When a group field is selected, you can choose a sorting order from the Sort Order box.

  7. Click Next to choose fields to summarize on.
  8. Add the database fields you want to total on to the Summarized Fields list.

    Summarized fields apply to the group specified in the For the Group box. You can use the same fields in each of several different groups.

    When a summary field is selected, you can choose a summary type for it and add a grand total.

  9. Click Next to sort groups on their summarized totals.

    You can select Sort All Groups, or you can specify a Top or Bottom N.

  10. Click Next to create a record selection for your report.
  11. Add the database fields you'll use to filter your report to the Filtered Fields list.

    Define your record selection by selecting from the box of limiting operators and entering the appropriate field value.

  12. Click Next to select a report style.
  13. Click Next to enter a title and saving location for your report.
  14. Choose a method for viewing your report.

    There are four options:

      • Preview (read only)
      • Edit with Seagate Crystal Report Designer
      • Analyze with Seagate Analysis
      • View Later.

    The Preview option opens the report in the ActiveX viewer. You can view, print, and refresh the report in the viewer.

    The Edit and Analyze options open the report in the appropriate program. You can view, print, refresh, and modify the report while using all the capabilities of Seagate Crystal Reports or Seagate Analysis.

    The View Later option saves the report with the name you gave it to the directory you specified.

Now that your report has been created, you can use it and modify it as you would any other report in Seagate Crystal Reports. It remains linked to your Excel spreadsheet so if you refresh the report after altering the spreadsheet, your changed data is displayed (see About the Microsoft Excel Add-In).


Working with the Microsoft Access Add-In

Installing the Seagate Crystal Report Wizard

The Microsoft Access Add-In may need to be installed through the Access Add-In Manager before you can use it. If you installed Access after Seagate Crystal Reports, refer to the following procedure. If, however, you installed Access before Seagate Crystal Reports, the Add-In is installed automatically.

Note: If the Access Add-In is automatically installed and you choose to remove it, you must install it manually (using the following procedure) and then use the Microsoft Add-In Manager to uninstall it.

Once the Seagate Crystal Report Wizard is added to Access, you can select it anytime you use Access.

To install the Seagate Crystal Report Wizard
  1. On the Tools menu in Access, point to Add-Ins and then click Add-In Manager.

    The Add-Ins option is available only after a database has been opened in Access.

  2. In the Add-In Manager dialog box, click Add New.
  3. Search for the file Crptaccwz2k.mde(or Crptaccwz97.mde if you are using Microsoft Access 97) in the Open dialog box.

    Crptaccwz2k.mde is installed in the \Program Files\Seagate Software\Report Designer Component directory by default. The file may have been moved to another directory by a system administrator.

  4. After choosing Crptaccwz2k.mde, click Open.

    Crystal Report Access Wizard is added to the available Add-Ins list in the Add-In Manager dialog box.

  5. Click Close.

After installation, the Access Add-In is available from the Tools menu (the Add-Ins submenu), or from within the database dialog box.


Using the Seagate Crystal Report Wizard to create a report in Access

The Seagate Crystal Report Wizard offers familiar Crystal layout and selection screens to help you create a report from your table or query.

To create a report in Access using the Seagate Crystal Report Wizard
  1. On the Tools menu in Access, point to Add-Ins and then click Seagate Crystal Report.

    If your database table or query is open, Access warns you to save before running the wizard.

    The Choose a Table or Query dialog box appears if you haven't already highlighted a table or query in the Database dialog box or the New Report dialog box.

    Another way to open the Seagate Crystal Report Wizard is to select the Reports option in the Database dialog box, click New, select the Seagate Crystal Report Wizard, and then click OK. If you use this method, you can select your table or query on the New Report dialog box, and go to step 3.

  2. From the Choose a Table or Query dialog box, select the table or query you want to use and click OK.

    The Seagate Crystal Report Wizard appears.

  3. Add the database fields you want to appear in your report to the Fields to Display list.

    The arrow buttons on this dialog box enable you to move fields from one list to the other. Single arrows move only the selected field; double arrows move all fields at the same time.

  4. Click Next to choose fields to group on.
  5. Add the database fields you want to group on to the Group By box.

    When a group field is selected, you can choose a sorting order from the Sort Order box.

  6. Click Next to choose fields to summarize on.
  7. Add the database fields you want to total on to the Summarized Fields list.

    Summarized fields apply to the group specified in the For the Group box. You can use the same fields in each of several different groups.

    When a summary field is selected, you can choose a summary type for it and add a grand total.

  8. Click Next to sort groups on their summarized totals.

    You can select Sort All Groups, or you can specify a Top or Bottom N.

  9. Click Next to create a record selection for your report.
  10. Add the database fields you'll use to filter your report to the Filtered Fields list.

    Define your record selection by selecting from the box of limiting operators and entering the appropriate field value.

  11. Click Next to select a report style.
  12. Click Next to enter a title and saving location for your report.
  13. Choose a method for viewing your report.

    There are four options:

      • Preview (read only)
      • Edit with Seagate Crystal Report Designer
      • Analyze with Seagate Analysis
      • View Later.

    The Preview option opens the report in the ActiveX viewer. You can view, print, and refresh the report in the viewer.

    The Edit and Analyze options open the report in the appropriate program. You can view, print, refresh, and modify the report while using all the capabilities of Seagate Crystal Reports or Seagate Analysis.

    The View Later option saves the report with the name you gave it to the directory you specified.

Now that your report has been created, you can use it and modify it as you would any other report in Seagate Crystal Reports.


Using Formulas

This section explains the basics of formulas and introduces you to the Formula Editor in order for you to begin to create formulas.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample reports installed with Seagate Crystal Reports that contain formulas are:

  • Formulas.rpt
  • Date Range Formula.rpt
  • Summary With Formula.rpt
  • Percentages.rpt
  • new path markerInventory.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp

You can also get the latest utilities and user-defined functions for Seagate Crystal Reports from Seagate Software's Community web site:
http://community.seagatesoftware.com/updates/default.asp


Formulas overview

In many cases, the data needed for a report already exists in database table fields. For example, to prepare an order list you would place the appropriate fields on the report. By placing these fields ...

You get this kind of report:

Sometimes, however, you need to put data on the report that does not exist in any of the data fields. In such cases, you need to create a formula. For example, to calculate the number of days it takes to process each order, you need a formula that determines the number of days between the order date and the ship date. Seagate Crystal Reports makes it easy for you to create such a formula.


Typical uses for formulas

There are many uses for formulas. If you have a need for specialized data manipulation, you can do it with a formula.

Creating calculated fields to add to your report

To calculate a price discounted 15%:

Crystal syntax example:

{Orders_Detail.Unit Price}*.85

Basic syntax example:

formula = {Orders_Detail.Unit Price}*.85
Formatting text on a report

To change all the values in the Customer Name field to uppercase:

Crystal syntax example:

UpperCase ({Customer.Customer Name})

Basic syntax example:

formula = UCase ({Customer.Customer Name})
Pulling out a portion, or portions, of a text string

To extract the first letter of the customer name:

Crystal syntax example:

{Customer.Customer Name} [1]

Basic syntax example:

formula = {Customer.Customer Name} (1)
Extracting parts of a date

To determine what month an order was placed:

Crystal syntax example:

Month ({Orders.Order Date})

Basic syntax example:

formula = Month ({Orders.Order Date})


Formula components and syntax

Formulas contain two critical parts: the components and the syntax. The components are the pieces that you add to create a formula while the syntax is the rules that you follow to organize the components.

Formula components

Creating a formula in Seagate Crystal Reports is like creating one in any spreadsheet application. You can use any of the following components in your formula:

Fields

Example: {customer.CUSTOMER LAST NAME}, {customer.LAST YEAR'S SALES}

Numbers

Example: 1, 2, 3.1416

Text

Example: "Quantity", ":", "your text"

Operators

Example: + (add), / (divide), -x (negate)

Operators are actions you can use in your formulas.

Functions

Example: Round (x), Trim (x)

Functions perform calculations such as average, sum, and count. All functions available are listed with their arguments and are arranged by their use.

Control Structures

Example: "If" and "Select", "For" loops

Group field values

Example: Average (fld, condFld), Sum (fld, condFld, "condition")

Group field values summarize a group. For example, you could use group field values to find the percentage of the grand total contributed by each group.

Other formulas

Example: {@GrossProfit}, {@QUOTA}


Formula syntax

Syntax rules are used to create correct formula. Some basic rules are:

  • enclose text strings in quotation marks
  • enclose arguments in parentheses (where applicable)
  • referenced formulas are identified with a leading @ sign.

Crystal and Basic Syntax

When creating formulas, you have the option of using either Crystal or Basic syntax. Almost any formula written with one syntax can be written with the other. Reports can contain formulas that use Basic syntax as well as formulas that use Crystal syntax.

Crystal syntax is the formula language included in all prior versions of Seagate Crystal Reports. Basic Syntax is new to Seagate Crystal Reports 8.

If you are familiar with Microsoft Visual Basic or other versions of Basic, then Basic syntax may be more familiar to you. In general, Basic syntax is modeled on Visual Basic except that it has specific extensions to handle reporting.

If you are already comfortable with Crystal syntax, you can continue to use it, and benefit from the new functions, operators and control structures inspired by Visual Basic.

Note: Report processing is not slowed down by using Basic syntax. Reports using Basic syntax formulas can run on any machine that Seagate Crystal Reports runs on. Also, using Basic syntax formulas does not require distributing any additional files with your reports.

Related topics

To learn about Basic syntax, see Creating Formulas with Basic Syntax.

To learn about Crystal syntax, see Creating Formulas with Crystal Syntax.


Specifying Formulas

There are four different groups of formulas in Seagate Crystal Reports: report, formatting, selection, and search formulas. The majority of formulas in a report are report formulas and conditional formatting formulas.

Report formulas

Report formulas are formulas that you create to stand alone in a report. For example, a formula that calculates the days between the order date and the shipping date is a report formula.

Conditional formatting formulas

Formatting formulas change the layout and design of a report, as well as the appearance of text, database fields, objects, or entire report sections. You format text through the Format Editor. If you need to create a formatting formula, you access the Formula Editor from the Format Editor. See Working with conditional formatting.

Selection formulas

Selection formulas specify and limit the records and groups that appear in a report. You normally do not enter these formulas directly, but instead specify the selection using the Select Expert. Seagate Crystal Reports then generates the record selection and group selection formula. You have the option to manually edit these formulas, but you must use Crystal syntax. See Selecting records.

Search formulas

Search formulas help you locate data in your report. Like selection formulas, you normally do not enter these formulas directly, but instead specify the search criteria using the Search Expert. Seagate Crystal Reports generates the formula. You have the option to manually edit these formulas, but you must use Crystal syntax.

Note: If you already know Basic syntax, you need to know only a small amount of Crystal syntax to modify most selection and search formulas.


Working with the Formula Editor

In cases other than selection and search formulas—which you can define using the Select Expert and Search Expert—you create all formulas in the Formula Editor of Seagate Crystal Reports.

Accessing the Formula Editor

  1. On the Insert menu, click Formula Field.
  2. In the Field Explorer dialog box, highlight Formula Fields.
  3. Click New.
  4. In the Formula Name dialog box, enter the name of the formula you will create.
  5. Click OK.

    The Formula Editor appears.


Understanding the sections of the Formula Editor

The Formula Editor contains four main windows.

Window | Description of contents
Report Fields | Report fields contain all database fields accessible for your report. They also contain any formulas or groups already created for the report.
Functions | Functions are prebuilt procedures that return values. They perform calculations such as average, sum, count, sin, trim, and uppercase.
Operators | Operators are the "action verbs" you use in formulas. They describe an operation or an action to take place between two or more values. Examples of operators: add, subtract, less than, and greater than.
Formula text window | Area where you create a formula.


Choosing the syntax

The top right corner of the Formula Editor contains the drop-down list where you choose either Crystal or Basic syntax for the formula you are creating.

Note: Changing the syntax from Crystal syntax to Basic syntax or vice versa will change the list of functions in the Functions window as well as the list of operators in the Operators window. The functions and operators differ from syntax to syntax.

The available report fields remain the same since the report fields are available to both syntaxes.

Setting the default syntax

When you open the Formula Editor, Crystal syntax appears as the syntax default. If you want to change the syntax default, select Options from the File menu, then click the Reporting tab. Choose the preferred syntax from the Formula Language drop-down list and click OK. When you access the Formula Editor, the syntax you selected appears as the default.


Entering formula components

The Report Fields, Functions, and Operators tree at the top of the Formula Editor contain the primary formula components. Double-click any component from these trees to add this component to your formula.

For example, if you set the syntax to Basic Syntax and double-click the Operators -> Control Structures -> Multi-Line If in the Operators tree, the following text is transferred to the Formula text window with the cursor between the If and Then:

If | Then
ElseIf Then
Else
End If

The above text helps you organize the parts needed to write your formula.

The following example in Crystal syntax shows how double-clicking on the report fields, functions, and operators insert the required syntax for a formula.


Formula Editor buttons

The buttons on the Formula Editor toolbar perform the following functions:

Creates a new formula without leaving the Formula Editor.

Saves the formula.

Saves the formula and closes the Formula Editor.

You return to the Fields Explorer dialog box.

Tests the syntax of the formula and identifies syntax errors if they are found.

Undoes the last action performed.

Redoes the last action.

When you select a field from the Report Fields window and click the Browse Data button, a dialog box appears with a list of the values for the selected field.

View values for the selected field and select individual values to insert into your formula.

Searches the Formula Editor for a specified word, number, or formula string.

Inserts a bookmark at the beginning of a selected formula line. Click the button again to remove the bookmark.

Jumps to the next bookmark.

Jumps to the previous bookmark.

Deletes all bookmarks in the current formula.

Arranges all Report Fields, Functions, and Operators trees in alphabetical order.

Hides or views the Report Fields tree.

Hides or views the Functions tree.

Hides or views the Operators tree.


Changing the font size of the Formula Editor

The Options dialog box (File menu) allows you to change the font size and the background/foreground color of text, comments, and keywords in the Formula Editor.


Formula Editor Key Controls

The Formula Editor accepts the following key controls:

Keyboard Combination | Action Performed
Alt-T | Shows toolbar (when it has been closed).
Ctrl-A | Selects all.
Ctrl-C | Copies.
Ctrl-End | Goes to the end of the last line of the formula.
Ctrl-F | Opens the Find dialog box (same as clicking the find button).
Ctrl-F2 | Sets bookmark.
Ctrl-Home | Goes to the beginning of file.
Ctrl-Left Arrow | Goes to the beginning of the left work (+Shift key will do the selection).
Ctrl-M | Sets focus to formula name combination box.
Ctrl-N | Creates a new formula.
Ctrl-S | Saves and closes formula.
Ctrl-Shift- Tab | Changes focus to next control box (reverse order of Ctrl-Tab).
Ctrl-Tab | Changes focus to next control box.
Ctrl-V | Pastes.
Ctrl-X | Cuts.
Ctrl-Z | Undoes an action.
Ctrl-Shift-Z | Repeats an action.
End | Goes to end of line.
Enter | Copies a selected object from a list to the formula text box.
F2 | Goes to next bookmark.


Creating and modifying formulas

Creating a formula and inserting it into a report

  1. On the Insert menu, click Formula Field.

    The Field Explorer dialog box appears.

  2. Select Formula Fields.
  3. Click New.
  4. In the Formula Name dialog box, enter the name you want to identify the formula.
  5. Click OK.

    The Formula Editor appears.

  6. Choose either Crystal or Basic syntax.

    If you are unsure which syntax to choose see Formula syntax.

  7. Enter the formula by typing in the components or selecting them from the component trees.
  8. Click Check to identify any errors in the formula.
  9. Fix any syntax errors the Formula Checker identifies.
  10. When the formula has the correct syntax, click Save then Close.

    You return to the Field Explorer dialog box.

  11. Double-click the formula and position the cursor where you want the formula to appear on your report.
  12. Click once to set the field in the desired position.

Note: A formula that is placed on a report is indicated by @ (e.g. @ProcessTime).

Related topics

Creating Formulas with Basic Syntax.

Creating Formulas with Crystal Syntax.


Editing formulas

  1. Choose Insert from the main menu and select Formula Field.

    The Field Explorer dialog box appears.

  2. Right-click the formula you want to edit and choose Edit.

    The Formula Editor appears.

  3. Edit the formula.
  4. Click Check to identify any errors in the formula.
  5. Fix any syntax errors the Formula Checker identifies.
  6. When the formula has the correct syntax, click Save then Close.

    You return to the Field Explorer dialog box.


Searching and replacing text

  1. On the Insert menu, click Formula Field.

    The Field Explorer dialog box appears.

  2. Right-click the formula you want to edit and choose Edit.

    The Formula Editor appears.

  3. In the Formula Editor dialog box, click Find/Replace to open a Find dialog box.

    From this dialog box, you can search and replace text within the Formula text box.

  4. Click the Mark All button to mark all occurrences of the search text.
  5. Click the Replace All button to replace all occurrences of the search text with the contents of the Replace with text box.

You can also search (but not replace) within any of the Formula Editor trees (use the Search options to specify which list boxes you are searching). The Mark All, Replace, and Replace All buttons become inactive when you specify a search within a list box.


Copying formulas from online Help

The Seagate Crystal Reports online Help contains a section called "Formulas in Action" that covers 17 different formulas and report-related scenarios. Since the formulas you develop using the Formula Editor are text, you can copy useful online formulas directly into the Formula Editor and then modify them to fit your needs.

To copy formulas from online Help
  1. On the Help menu, click Search.

    The Seagate Crystal Reports online Help appears.

  2. Click the Index tab.
  3. Enter "Formulas in Action" in the search field and click Display.

    The Formulas in Action Help topics appear.

  4. Scroll through the topic until you locate the formula you want to copy.
  5. Highlight the formula and choose Copy from the Edit menu.

    Windows places a copy of the selected text on the Clipboard.

  6. Choose Insert from the main menu and select Formula Field.

    The Field Explorer dialog box appears.

  7. Double click Formula Fields.

    The Formula Name dialog box appears.

  8. Enter the name you want to identify the formula and click OK.

    The Formula Editor appears.

  9. Place the insertion point where you want the text to appear in the Formula text box of the Formula Editor and press Ctrl-V to paste the text from the Clipboard.
  10. Modify the formula by changing the fields, formulas, group fields, conditional statements, and text strings as necessary for use with the data in the new report.
  11. When the formula has the correct syntax, click Save then Close.

    You return to the Field Explorer dialog box.


Copying formulas from one report to another

You may want to copy a formula created in one report for use in another report. Copy the text formula from one report to another via the Clipboard.

To copy a formula from one report to another
  1. Select the formula field you want to copy in the report.
  2. On the Edit menu, click Copy.
  3. Open the report you want to copy the formula to.
  4. Choose Paste from the Edit menu.
  5. When the program displays the object frame, drag the formula to the new location.
  6. To make changes to the formula, right-click the formula and choose Edit Formula from the shortcut menu.

    The Formula Editor appears.

  7. Delete the old values and type in the new values, or select them from the Fields, Functions, and/or Operators tree.
  8. Click Save then Close when finished.


Key points for editing a copy of a formula

When making changes, use the following points as a guide:

  • All fields, formulas, and group fields referenced in the formula copy must actually exist in the new report. This means that any database referenced in the original formula (or a database with the same structure, field names, and alias) must be active in the new report.
  • If such a database is not active, you must change the field, formula, and group field references in the formula copy to correspond to elements in your new report.
  • If the formula contains conditional elements, make certain that the conditions apply to the data in the new report. For example, if the formula in your old report performed an action when the quantity was greater than 100, make sure that the greater than 100 condition makes sense in the new formula. When modifying a formula, you may find that greater than 10 or greater than 2000 makes more sense with your new data.
  • If you are using the formula with new data, and if your report contains statements similar to the following:

    If {file.FIELD} = "text string"

    Make sure that the text strings used in the formula match values that actually exist in the new data.


Deleting formulas

When a formula is created and added to a report, the Report Designer:

  • stores the specification for creating the formula, using the name you assigned to it
  • places a working copy of that formula at the point you specify in the report. A working copy is any occurrence of the formula in the report.

In order to completely delete formulas, you must delete the specification and all working copies of the formula.

Note: You cannot delete the specification without deleting all working copies of the formula.

Removing the working formula from your report

  1. Right-click the formula you want to delete from the report.
  2. Select Delete.

Note: Even after the working copies of a formula have been deleted from the report, the formula specification remains unchanged. The specification is listed in the Field Explorer dialog box. It is available if you wish to enter the formula in the report again.

Deleting the formula specification

  1. Choose Insert from the main menu and select Formula Field.

    The Field Explorer dialog box appears.

  2. Right-click the formula you want to delete and choose Delete.

Note: A dialog box appears if this formula is currently in use in a report. If you delete this formula, you will delete all references of it in reports. Click Yes to delete.


Debugging formulas

Debugging tutorial

Follow the example below to learn the necessary steps for debugging a formula. After completing this exercise, use the same principles to debug your own formulas.

About this tutorial

  • This tutorial uses the Xtreme.mdb sample database.
  • This tutorial uses Crystal syntax.
  • The following formula is the formula you will test for errors:
If ({customer.CUSTOMER NAME} [1 to 2 = "Bi" and
ToText({customer,CUSTOMER ID}) [1] = "6") Or
({customer.CUSTOMER NAME} [1] = 'Ro" and
ToText({customer.CUSTOMER ID}) [1] = "5")
    "PREFERRED CUSTOMER"
Else
    "DOES NOT FIT CRITERIA"

If correct, this formula should pick out all customers whose names begin with "Bi" and whose customer IDs begin with "6" as well as those companies whose names begin with "Ro" and whose customer IDs begin with "5". When printing the field, those selections will read "PREFERRED CUSTOMER", while the rest will read "DOES NOT FIT CRITERIA".

You will now break down the formula to check and see that each condition of the formula is working individually.


Formula1

  1. To get started, create a report using the Customer table in xtreme.mdb and place the following fields from left to right in the Details section:
{customer.CUSTOMER ID}
{customer.CUSTOMER NAME}

To test each portion of the formula, you will place a new formula field next to these two fields in the report.
  2. Create a new formula called Formula1.
  3. Type the following in the Formula text box of the Formula Editor:
If {customer.CUSTOMER NAME} [1 to 2 = "Bi" Then
    "TRUE"
Else
    "FALSE"
  4. Click Check to test for errors. You will receive the following error message:

The ] is missing.

  5. Correct the formula by inserting the missing " ] " after the 2.
  6. Click Check again. You will receive the following message:

No errors found.

  7. Click Save then Close to return to the Insert Fields dialog box.
  8. Insert the corrected formula field to the right of the two data fields in the Details section of your report.
  9. Click Print Preview on the Standard toolbar to check the values in the report and compare the fields to see if the field values returned by @Formula1 are correct.

You will find "TRUE" listed next to the customer names that begin with "Bi" and "FALSE" next to all the others. Now you will check the other portions of the formula. Create Formula2, Formula3, and Formula4, by following Steps 1 - 9, using the formulas specified below for each.

Insert each formula field on the same line of the Details section for easy comparison. Check each one for errors, fix as needed, and make sure the values returned are correct before moving on to the next formula.


Formula2

  1. Create a new formula called Formula2.
  2. Type the following in the Formula text box of the Formula Editor:
If ToText({customer,CUSTOMER ID}) [1] = "6" Then
    "TRUE"
Else
    "FALSE"
  3. Click Check to test for errors. You will receive the following error message:

This field name is not known.

  4. Correct the formula by replacing the comma (,) in the field name with a period (.).
  5. Click Check again. The formula should now be error-free.
  6. Place the formula to the right of the @Formula1 field.
  7. Click Print Preview on the Standard toolbar to check the values in the report and compare the fields to see if the field values returned by @Formula2 are correct.

You should see "TRUE" next to all customer numbers that begin with 6 and "FALSE" next to all customer numbers that do not begin with 6.


Formula3

  1. Create a new formula called Formula3.
  2. Type the following in the Formula text box of the Formula Editor:
If {customer.CUSTOMER NAME} [1 to 2] = 'Ro" Then
    "TRUE"
Else
    "FALSE"
  3. Click Check to test for errors. You will receive the following error message:

The matching ' for this string is missing.

  4. Correct the formula by changing the single quote (') before Ro to a double quote (").
  5. Click Check again. The formula should now be error-free.
  6. Place the formula to the right of the @Formula2 field.
  7. Click Print Preview on the Standard toolbar to see the values in the report and compare the fields to check if the field values returned by @Formula3 are correct.

You should see "TRUE" next to all Customer names that begin with "Ro" and "FALSE" next to all Customer names that do not begin with "Ro".


Formula4

  1. Create a new formula called Formula4.
  2. Type the following in the Formula text box of the Formula Editor:
If ToText({customer.CUSTOMER ID}) [1] = "5"
    "TRUE"
Else
    "FALSE"
  3. Click Check to test for errors. You will receive the following error message:

The word 'then' is missing.

  4. Correct the formula by typing in the word "Then" at the end of the first line after "5".
  5. Click Check again. The formula should now be error-free.
  6. Place the formula to the right of the @Formula3 field.
  7. Click Print Preview on the Standard toolbar to see the values in the report and compare the fields to check if the field values returned by @Formula4 are correct.

You should see "TRUE" next to all Customer IDs that begin with 5 and "FALSE" next to all Customer IDs that do not begin with 5.

Now that the formulas are error-free and the field values returned are correct, you will create a formula that links the separate components together. You will begin by linking the first two formulas (@Formula1 and @Formula2) and then you will add @Formula3 and @Formula4 to create the final formula @FinalFormula.


Formula1+2

  1. Create a new formula called Formula1+2.
  2. Type the following in the Formula text box of the Formula Editor:
If {customer.CUSTOMER NAME} [1 to 2] = "Bi" and
ToText({customer.CUSTOMER ID}) [1] = "6" Then
    "TRUE"
Else
    "FALSE"
  3. Place the formula to the right of the @Formula4 field.

You should see "TRUE" next to each customer whose name begins with Bi and Id begins with 6, and "FALSE" next to all Customer IDs that do not meet this criteria.

If this formula is working correctly, you can create one last formula adding the code from @Formula3 and @Formula4.


FinalFormula

  1. Create a new formula called FinalFormula.
  2. Type the following in the Formula text box of the Formula Editor:
If ({customer.CUSTOMER NAME} [1 to 2] = "Bi" and
ToText({customer.CUSTOMER ID}) [1] = "6") or
({customer.CUSTOMER NAME} [1 to 2] = "Ro" and
ToText({customer.CUSTOMER ID}) [1] = "5") Then
    "PREFERRED CUSTOMER"
Else
    "DOESN'T FIT CRITERIA";
  3. Place the formula where you want it to appear in the Details section of the report. You can now delete all other formula fields from the report. See Deleting formulas.

You can use this same process of condition-by-condition testing for any formulas as a means of systematically checking them.


Error Messages and Formula Compiler Warnings

A ) is missing.

Parentheses must be used in pairs; each opening parenthesis must be matched with a closing parenthesis. One of your opening parentheses is not matched by a closing parenthesis. Insert the missing parenthesis and recheck.

A ] is missing.

Brackets must be used in pairs; each opening bracket must be matched with a closing bracket. One of your opening brackets is not matched by a closing bracket. Insert the missing bracket and recheck.

A Boolean range variable is not allowed.

You have entered a Boolean range variable. Range variables are allowed in all data types other than Boolean. Either change the data type to something other than Boolean, or enter a Boolean item variable to replace the Boolean range variable.

Access denied.

DOS will not allow access to a file specified. Make certain the file is not in use by another program (or another user on a network), and/or make certain you have the right network permissions and try again.

A day number must be between 1 and the number of days in the month.

You have entered a day number that does not fit the month. The Formula Checker displays this warning if, for the month of January, for example, you enter a day number of zero (0) or a number 32 or greater. Change the day number to fit the month and recheck.

A field is required here.

You have entered something in your formula other than a field at a position where a field is expected. Correct the problem and recheck.

A formula cannot refer to itself, either directly or indirectly.

You cannot enter a formula that refers to itself. For example, in creating the formula @Profit, you cannot use @Profit as the argument to a function. Remove the reference and recheck.

A function is required here.

The Formula Editor is expecting a function but none was entered. Review your formula and enter the required function or correct the formula if it is in error.

A memo field cannot be used in a formula.

You have picked a memo field for use in a formula. The use of memo fields in formulas is not allowed. Remove the memo field from the formula and try again.

A month number must be between 1 and 12.

You have entered a month number that falls outside the allowable range. Enter a month number between 1 and 12 and recheck.

A string can be at most 254 characters long.

The program allows strings in formulas to be up to 254 characters long. You have entered a string that exceeds that limit. Reduce the length of the string and recheck.

A subscript must be between 1 and the length of the string.

You have entered a subscript number that specifies a character that does not exist. If you enter a subscript that references the 6th or the 8th character in a five character string, for example, you will get this warning. Change the subscript to a value that exists and recheck.

A subscript must be between 1 and the size of the array.

You have entered a subscript that specifies an array item that does not exist. If you enter a subscript that references the 6th or 8th item in a five item array, for example, you will get this warning. Change the subscript to a value that exists and recheck.

All network licenses are in use. You will be able to run the program when a user leaves the program. To increase the number of licensed copies on your network, contact Seagate Software, Information Management Group at (604) 681-3435 and ask about Network LanPaks.

Your current license specifies the maximum number of users that can use the program on a network at any given time. The maximum number of users is currently using the program. You can increase the number of users allowed on the system at a given time by purchasing additional Network LanPaks through Seagate Software, Information Management Group.

A subtotal condition is not allowed here.

You have entered a subtotal condition for a subtotal that uses something other than a date or Boolean field as the sort and group by field. Your subtotal does not require a condition. Delete the condition and continue.

A subtotal condition must be a string.

You have entered a subtotal condition that is not in string format. Make certain when you enter the condition in the formula that it is surrounded by single or double quotation marks.

A variable cannot be redeclared with a different type.

You have declared a variable with the same name but a different data type than a variable already declared. This is not allowed. Either change the name of the variable or change the data type so it conforms with the original data type.

A variable is required here.

You have used the assignment operator (=:) in a formula without preceding it with a variable. The program expects to see a variable immediately before (to the left of) the assignment operator. Enter a variable and try again.

A variable name is expected here.

You have declared a variable data type without declaring a variable name. You must enter a variable name to complete the declaration. Enter the variable name and continue.

Dates must be between year 1 and year 9999.

You have entered a date that falls outside the allowable range. Enter a date that falls within the range of years 1 to 9999 (including the end values), and then recheck.

Cannot allocate memory.

This message typically indicates that there is not enough memory available. Close any reports that are not needed, and exit any programs that are not essential. Then try again.

Cannot reallocate memory.

This message typically indicates that there is not enough memory available. Close any reports that are not needed, and exit any programs that are not essential. Then try again.

Disk full.

You have attempted to save a report to a disk that is full. Either save to a different disk, or delete unnecessary files from the current disk and try again.

Division by zero.

You have entered a formula that attempts a division by zero. The program does not allow such a division. Edit the formula so it does not attempt to divide by zero, and then recheck.

To avoid this type of problem, you can use a test such as this:

If {file.FORECAST} = 0 Then

0

Else

{file.SALES} / {file.FORECAST}
Error in formula code. Please contact Seagate Software, Information Management Group.

There is something unusual about the formula that was not foreseen. Please save the formula text that produced this warning and contact the company.

Error in parse tree. Please contact Seagate Software, Information Management Group.

In parsing your formula, the program encountered a situation that the parse tree could not process. Please save the formula text that produced this warning and contact the company.

Field still in use.

The field you are requesting is currently in use. Try again once the field becomes available.

File name already in use. Please close the window for xxx before saving under this name.

You have tried to save a file under the name of a file already in use in an open report. Close that report first, and then try again.

File not found.

The file name you specified cannot be found. Either the filename or the path is incorrect. Enter the correct filename/path and try again. In some instances the file WBTRVDEF.DLL is missing from your directory. This file is required for reading Data Dictionary files along with WBTRCALL.DLL.

File permission error.

You have requested a file for which you do not have permission. You must gain the necessary permission before you can activate the file.

Incorrect Borland Custom Control DLL (BWCC.DLL) installed. Version m.n or higher required.

The program is finding and using a version of BWCC.DLL that is too old for proper program operation. Here's how this can happen:

BWCC.DLL is installed in the CRW directory (the same directory in which CRW.EXE or CRW32.EXE resides) during program installation.

The CRW directory is added to the end of the path statement in AUTOEXEC.BAT during installation (if you allowed the installation program to update the path statement).

If an older version of BWCC.DLL has been installed in the Windows directory, the Windows System directory, or a directory that appears earlier in the path than the CRW directory (the result of an earlier installation), the program picks up that version, not the newer version in the CRW directory.

To correct this problem

The correct version of BWCC.DLL is shipped with Seagate Crystal Reports. To correct the problem, delete older versions of BWCC.DLL that reside in directories earlier in the path than CRW.

If this does not solve the problem, move the latest version of BWCC.DLL from the CRW directory to the Window's directory.

Internal Error: PrintDlg fail: 4100.

There is no printer driver installed in the Windows Control Panel. When Seagate Crystal Reports opens a report, it looks for the printer that was saved with the report. If that printer cannot be found, it looks for the default printer. If there is no default printer set, the error message results.

Insufficient memory available.

There is not enough memory available to do what you want the program to do. Free up memory and try again.

Invalid DOS version.

You are using a version of DOS earlier than Version 3.0. Install DOS Version 3.0 or higher and try again.

Invalid file handle.

You have specified a file handle that does not exist. Enter the correct file handle and continue.

No default printer selected. You may use the Control Panel to select a default printer.

Please use the Control Panel to select a printer and start the program again.

You cannot begin to utilize the program unless you have a default printer selected. Trying to start the program without a default printer results in this error message.

To select a default printer:

Click the Printers icon in the Windows Control Panel; the Printers dialog box appears with all installed printers listed in the Installed Printers box.

If you have not yet installed the printer, install it first, and then double-click its listing.

Note: A printer must first be given the status Active before it can be selected as the default printer.

Note: For additional information in installing printers and default printers, please refer to the documentation that came with Microsoft Windows.

Non unique table reference: tablename.

This is usually caused if a table name contains an underscore or is more than 15 characters long, or starts with a number.

Not enough arguments have been given to this function.

The function requires more arguments than you have entered. Enter the missing argument(s) and recheck.

Not enough memory.

There is not enough memory available to process the command. Close any reports that are not needed, and exit any programs that are not essential. Then try again.

Numeric overflow.

An intermediate result or the final result cannot be represented because it is too big. Restructure or subdivide the formula to create smaller results, and then recheck.

Physical database not found.

The program is unable to locate either a DLL or the database. Check to make certain that the directories that hold these files are listed in the path statement.

Please cancel printing before closing.

Your Report Engine call is attempting to close a job while it is still in progress. Make certain that you cancel the printing before you close the print job.

Printer not available.

There are problems connecting to the selected printer. Reselect the printer through the Windows Control Panel and try again.

Report file already exists. Overwrite sample.rpt?

You are attempting to save a report under the same name as an existing report. This will overwrite the existing report and make it no longer available. Click Yes to overwrite the report, No to stop the saving process to give you a chance to select a different name.

Report has changed. Save changes to sample.rpt before closing?

You are attempting to close a report window without first saving it, even though you have made changes to the report since you opened it. The changes will be lost unless you save the report before closing. Click Yes to save the changes, No to close the report without saving the changes.

Sorry, this feature is not yet implemented. Try again later.

You have attempted to use a feature that has not been implemented in the current release. Wait till an upgrade that implements the feature and try again.

The formula cannot be evaluated at the time specified.

You are trying to force a field, formula, or function to be evaluated earlier than is possible. Evaluation time functions can only force a later evaluation time, never an earlier one. Change the formula to accommodate the required evaluation time.

This field cannot be used because it must be evaluated later.

You are trying to force a field, formula, or function to be evaluated earlier than is possible. Evaluation time functions can only force a later evaluation time, never an earlier one. Change the formula to accommodate the required evaluation time.

This function cannot be used because it must be evaluated later.

You are trying to force a field, formula, or function to be evaluated earlier than is possible. Evaluation time functions can only force a later evaluation time, never an earlier one. Change the formula to accommodate the required evaluation time.

The formula is too complex. Try simplifying it.

The formula could not be evaluated because it exceeds the limit of 50 pending operations. Pending operations are operations that are on hold due to order of precedence rules; they will be performed once the operations with higher level precedence are finished.

Sometimes it is possible to rearrange the formula and calculate the same value without requiring as many pending operations. As a very simplified example, in the formula 2+3*4, the addition cannot be performed until the multiplication has been done. The addition thus becomes pending, on hold until the multiplication is complete. If the formula is written as 3*4+2 instead, the operations can be performed left-to-right with the same result, thus eliminating the pending operation.

Correct the formula and recheck.

The matching } for this field name is missing.

Field names must be enclosed in braces { }. You have entered one of the required braces but not the other. Insert the missing brace and recheck.

The matching ' for this string is missing.

A string that begins with a ' must end with a ' before the end of the line. You have used the ' in one of those positions but not the other. Insert the missing punctuation and recheck.

The matching " for this string is missing.

A string that begins with a " must end with a " before the end of the line. You have used the ' in one of those positions but not the other. Insert the missing punctuation and recheck.

The number of copies of the string is too large or not an integer.

Using the ReplicateString function, you have requested too many copies or you are requesting a non-integer number of copies. Lower the number of copies requested or specify an integer number of copies and try again.

The number of days is too large or not an integer.

When adding days to dates, or subtracting days from dates, you can use only an integer number of days (a whole number); you cannot add or subtract non-integer numbers of days (1/2 days, 3.6 days, etc.). Additionally, once you add or subtract days from a date, the resulting date must fall within the allowable (year) date range, 0000-9999. If you enter a non-integer number of days or if your result falls outside the allowable range, the Formula Editor displays this warning. Correct the problem and recheck.

The number of decimal places is too large or not an integer.

The second argument to the Round(x, # places) or ToText(x, # places) functions must be a small integer (whole number). You have entered a number as the second argument (# places) that specifies too many decimal places or that is not an integer. Change the number to a small integer and recheck.

The record selection formula cannot include 'PageNumber', 'RecordNumber', 'GroupNumber', 'Previous', or 'Next'.

You cannot include PageNumber, RecordNumber, GroupNumber, Previous, or Next fields in record selection formulas. Eliminate the field(s) and recheck.

The record selection formula cannot include a summary field.

You have included a summary field in a record selection formula. The program does not allow this. Remove the summary field and recheck.

The remaining text does not appear to be part of the formula.

You have provided a formula operand (the item on which a formula operation is to be performed) where none is expected. Often this means that you have forgotten an operator, or an earlier part of a function, or some required syntax item. Correct the error and then recheck.

The result of a formula cannot be a range.

You have created a formula that results in a range. A formula must result in a single value. Correct the formula and recheck.

The result of a formula cannot be an array.

You have created a formula that results in an array. A formula must result in a single value. Correct the formula and recheck.

The result of the selection formula must be a Boolean.

You have created a selection formula that returns something other than a Boolean value. Reconstruct the formula using comparison operators (=, etc.) and recheck.

The string is non-numeric.

The argument to the ToNumber function must be a number stored as a string (for example, a customer number, an ID number, etc.). The string may be preceded by a minus sign and may contain leading and trailing blanks. You have used an argument that is non-numeric and therefore cannot be converted to a number. Change the argument to numeric and recheck.

The variable could not be created.

The variable you declared could not be created. Check the spelling and syntax of your declaration statement and try again.

The word 'Else' is missing.

In an If-Then-Else expression, you have left out (or misplaced) the 'Else' component and the formula will not function. Insert (or reposition) the 'Else' component and recheck.

The word 'then' is missing.

In an If-Then-Else expression, you have left out (or misplaced) the 'then' component and the formula will not function. Insert (or reposition) the 'then' component and recheck.

There are too many characters in this field name.

A field name may have at most 254 characters. You have entered a field name that exceeds that number. Enter a field name that has an allowable number of characters and try again.

There are too many characters in this string.

Strings in formulas are allowed to be up to 200 characters long. You have entered a string that exceeds that limit. Reduce the length of the string (or break it into 2 or more concatenated strings) and recheck.

There are too many digits in this number.

Numbers in formulas are allowed to have up to 25 digits before the decimal point. You have entered a number that exceeds that limit. Reduce the size of the number (or break it into 2 or more smaller numbers) and recheck.

There are too many letters and digits in this name.

A variable name can have at most 254 characters. You have entered a name that exceeds that number. Shorten the name to conform to the limit and continue.

There is an error in this formula. Please edit it for more details.

You have tried to accept a formula (via the Accept button in the Formula Editor) that contains an uncorrected error. Correct the error that was indicated and try again.

There must be a subtotal section that matches this field.

You have entered a subtotal in a formula without there being a corresponding subtotal in the report itself. Any subtotal you enter in a formula must duplicate a subtotal already in your report. Add the required subtotal to the report and then re-enter the formula, or delete the formula, and then recheck.

The special variable field could not be created.

This message typically indicates that there is not enough memory available. Close any reports that are not needed, and exit any programs that are not essential. Then try again.

The summary field could not be created.

This message typically indicates that there is not enough memory available. Close any reports that are not needed, and exit any programs that are not essential. Then try again.

This field cannot be summarized.

You have entered a summary field that does not already exist in your report. Any summary field you enter in a formula must duplicate a summary field already in your report. Either enter the summary field in your report first and then re-enter it in the formula, or do not enter the summary field in the formula at all.

This field cannot be used as a subtotal condition field.

The field you are entering as a condition field causes the subtotal in the formula not to match any subtotal in the report. Any subtotal you enter in a formula must duplicate a subtotal already in your report. Either enter the subtotal in your report first and then re-enter it in the formula, or do not enter the subtotal in the formula at all.

This field has no previous or next value.

You have used a field for which there is no "previous" value as the argument for the Previous or PreviousIsNull function, or you have used a field for which there is no "next" value as the argument for the Next or NextIsNull function. To use either of those functions, replace the argument with a field that contains the appropriate values.

This field must be in the same section as the current formula.

Since the field was put into the formula as an operand, it has been moved to a section where it is no longer a valid operand.

This field name is not known.

You have entered a field name that does not appear in any of the active databases. Correct the spelling of the field name and/or its alias, and then recheck. Or, to enter a field name from a database that is not currently active, activate the database first and then re-enter the field name.

This group section cannot be printed because its condition field is non-existent or invalid.

Your report contains a group section that is based on a condition field that is either no longer in the report or changed so it is invalid for the group section. Review your grouping criteria to identify and correct the source of the problem.

This array must be subscripted. For example: Array [i].

You have entered an array without enclosing it in brackets. Enclose the array in brackets and recheck.

This subtotal condition is not known.

You have entered a subtotal condition that does not appear anywhere in your report. Any subtotal you enter in a formula must duplicate a subtotal already in your report. Change the condition and recheck.

Too many arguments have been given to this function.

You have entered an array as the argument to a non-array function. This kind of problem can occur, for example, if you forget to use brackets (the required syntax items for an array) to enclose an array. The Formula Checker sees the array values as arguments to a non-array function and displays the error message.

Too many items have been given for this array.

The program allows up to 50 values in an array. You have exceeded this limit. Reduce the number of values in the array and recheck.

Too many open files.

You have too many open files (databases, reports) given the number of files you specified in the CONFIG.SYS FILES = statement. To prevent this error from recurring, either use fewer files or increase the number of files specified in the FILES = statement.

Missing or incorrect operand warnings.

The following warnings appear when the Formula Checker expects to find a specific kind of operand (the item on which a formula operation is to be performed), and finds something different. For example, the formula 5>a is comparing a number to text (the old comparing apples to oranges analogy). When the Formula Checker sees that the number five is being compared to something, it expects that something to be another number. If anything other than a number appears, it displays the warning: A number is required here.

A Boolean array is required here.

A Boolean is required here.

A currency amount is required here.

A currency array is required here.

A currency range is required here.

A date array is required here.

A date is required here.

A date range is required here.

A number array is required here.

A number array or currency array is required here.

A number, currency amount, Boolean value, or string is expected here.

A number, currency amount, Boolean, date, or string is required here.

A number, currency amount, date, or string is required here.

A number, currency amount, or date is required here.

A number field or currency amount field is required here.

A number is required here.

A number or currency amount is required here.

A number range is required here.

A string array is required here.

A string is required here.

A string or an array of values is required here.

An array of values is required here.


Formulas In Action

Formulas in Action have been developed to demonstrate the use of multiple functions and operators in coordination with one another. The formulas have been created to illustrate concepts; they do not represent the only way, or necessarily the best way, to achieve the desired effects.

The following is a listing of complex formulas created to illustrate the use of various operators and functions. Each formula topic includes:

  • a report scenario that describes a real-world reporting need
  • a formula using Crystal syntax that fills the need described in the scenario
  • a dissection of the formula so you can understand the role of each function and operator.

The names of the operators and functions used in the formula follow each numbered formula topic.

Click the formula of interest from the following list for further information:

Formula 1 (sales management, determining representatives closest to hitting quota)

Abs(x), Subtract (-), Divide (/), Multiply (*), ToText, Concatenate (+)

Formula 2 (form letter/extracting first purchase date from customer number, use date to calculate # of years as customer, and use result to customize letter)

If-Then-Else, Subscript [], Less Than (<), Concatenate (+), Make range (to), ToNumber, Subtract (-), ToText, Parentheses

Formula 3 (inventory analysis based on extracting inventory data from codes imbedded in item numbers)

Concatenate (+), ToText, ToNumber, Multiply(*), Make Range, Subscript [], Parentheses ()

Formula 4 (sales compensation, calculating commissions, flag commissions that exceed certain amount)

Nested formulas, If-Then-Else, Subtract (-), Multiply (*), Greater than (>), Greater than or equal (>=), Sum, Parentheses ()

Formula 5 (form letter, soliciting orders against available credit line)

Nested formulas, If-Then-Else, Subtract (-), Not equal to (<>), Less than (<), Concatenate (+), ToText, To dollar ($), Negate ( -() ), Parentheses ()

Formula 6 (calculating one value as percent of another, flag percentages outside range, disregard statistically insignificant percentages)

If-Then-Else, Greater than (>), Percentage (%), Greater than or equal (>=), Boolean Operator (And), Boolean Operator (Or), Parentheses ()

Formula 7 (sales compensation, selecting fixed bonus or calculated commission, whichever is higher)

If-Then-Else, Subtract (-), Greater than (>), Maximum, Multiply (*), Parentheses ()

Formula 8 (purchasing, determining quantity to order based on average sales during rolling quarter)

If-Then-Else, Less than (<), Negate (-), Add (+), Round, Average([array]), Parentheses ()

Formula 9 (retail, calculating mail order sales tax based on customer ZIP or Postal code)

Nested If-Then-Else expressions, NumericText, Subscript, Make Range, Equal to (=), ToNumber, In Range, Parentheses ()

Formula 10 (staff scheduling, flagging weekend incoming calls)

If-Then-Else, Not, DayOfWeek, Make range (to), In range (in), Parentheses ()

Formula 11 (calculating a contribution based on face value of invoice, and then selecting calculated value or agreed upon minimum)

If-Then-Else, Subscript [], Not equal to (<>), Maximum([array]), Multiply (*), Parentheses ()

Formula 12 (determining monthly compensation based on percent of dollars saved, and comparing result to negotiated maximum)

If-Then-Else, Average([array]), Subtract (-), Greater than (>), Minimum([array]), Multiply (*), Parentheses ()

Formula 13 (converting one unit of measure to another)

ToText, Truncate, Division (/), Concatenate (+), Remainder

Formula 14 (customer service, determining and identifying warranty plan based on length of product serial number)

If-Then-Else, Length, TrimLeft, Less than or equal (<=), Parentheses ()

Formula 15 (form letter, personalizing salutation based on degree and sex of recipient)

Nested If-Then-Else operators, Not equal (<>), Boolean operator (And), Equal (=), Concatenate (+), Parentheses ()

Formula 16 (shipping, calculating discounted value of shipment and adding calculated freight charge to orders that do not meet "free freight" criteria)

If-Then-Else, Add (+), Less than (<), Multiply (*)

Formula 17 (form letter, splitting a mailing list in half and sending a different offer to each half of the list)

If-Then-Else, Remainder, ToNumber, Equal, Parentheses ()


Formula 1

Functions/Operators Used

Abs(x), Subtract (-), Divide (/), Multiply (*), ToText, Concatenate (+)

Formula Purpose

As a sales manager with a large sales force, you want to identify those sales representatives who are the most consistent performers with regard to quota. You want to find those who come closest to hitting quota, regardless of whether they are slightly over or slightly under. It does not matter whether the variation is over or under quota; all that matters is the percent of variation from the mark.

Formula

ToText(Abs({file.QUOTA}-{file.SALES})/{file.QUOTA} * 100) + "%"

Result

Sales | Quota | Quota - Sales | % Variation
8, 000 | 10, 000 | 2000 | 20%
11, 000 | 10, 000 | 1000- | 10%

Explanation

  • The formula uses the Subtract operator (-) to subtract {file.SALES} from {file.QUOTA}. This gives the dollar variation from {file.QUOTA} (+ or -).
  • The Abs(x) function converts the dollar variation to an absolute number, ignoring any + or - signs.
  • It then uses the Divide operator (/) to divide that result by {file.QUOTA}. This gives the variation expressed as a decimal fraction.
  • The formula then uses the Multiply operator (*) to multiply the result by 100 in order to calculate the final result in the form of a percentage.
  • ToText is used to convert the calculated percent to text that can then be joined with other text.
  • · The Concatenate operator (+) is used to join the percentage, once converted to text, to the percent sign (%) character.
Related topics

Formulas In Action


Formula 2

Operators/Functions Used

If-Then-Else, Subscript [], Less Than (<), Concatenate (+), Make range (to), ToNumber, Subtract (-), ToText, Parentheses ()

Formula Purpose

You have the date of first purchase coded as the fourth and fifth characters of the customer number (for example, 1971 as the 71 in ABC7101234, 1988 coded as the 88 in ABC880544, etc.) and you want to customize a letter to thank customers for the number of years they have done business with you. You want the following sentence to appear in your letter:

"You have been a valued customer for" [x] "years."
«Where x is the number of years.»

Formula

If {file.CUSTOMER NUMBER}[4 to 5] < "90" Then
"You have been a valued customer for " + ToText(91
- ToNumber({file.CUSTOMER NUMBER}[4 to 5]))
+ " years."
Else
"You are one of our newer customers, and we want you to
know how valuable you are to us."

Result

Customer # | Resulting Sentence
ABC7801234 | "You have been a valued customer for 13 years."
ABD890337 | "You have been a valued customer for 2 years."
ABD904331 | "You are one of our newer customers, and we want you to know how valuable you are to us."

Explanation

  • The If-Then-Else expression says, "If the 4th and 5th elements of the customer number, expressed as numbers, are less than 90, print a sentence including the date of first purchase, otherwise print the 'newer customer' sentence."
  • The formula above uses the Subscript [ ] operator to extract the 4th and 5th characters (your date code) from the customer numbers which are stored as text in character fields. The Make Range operator (to) is used to establish the range 4 to 5.
  • In the first example (ABC7801234) the 4th and 5th digits are 78 representing the year of first purchase as 1978.
  • In the second example (ABD8903337), the 4th and 5th digits are 89 representing the year of first purchase as 1989.
  • If the extracted characters are less than "90" (Then), a concatenated text string (a sentence) is printed that is customized to indicate the number of years the individual has been a customer. The text string says, "You have been a valued customer for (calculated number, expressed as text) years."
  • The calculation of the number of years as a customer involves several steps:
      • _ As was done earlier, the Subscript [ ] operator extracts the 4th and 5th characters (your date code) from the customer numbers which are stored as text in character fields. The Make Range operator (to) is used to establish the range 4 to 5.
      • _ ToNumber converts the extracted date code to a number so it can be used in the calculation 91-x, where x = the date code expressed as a number.
      • _ 91-x subtracts the year of first purchase from 91 (the current year) to get the number of years the individual has been a customer.
      • _ ToText then converts the result of that calculation back to text so it can be used in the expression "You have been a valued customer for (x) years."
  • If the characters are "90" or more (Else), the fixed text string "You are one of our newer customers, and we want you to know how valuable you are to us" is printed.
  • The Parentheses () control the order of calculation of the formula.
Related topics

Formulas In Action


Formula 3

Operators/Functions Used

Concatenate (+), ToText, ToNumber, Multiply (*), Make Range (to), Subscript [], Parentheses ()

Formula Purpose

A sail maker, as part of his loan agreement with his bank, has to submit a detailed inventory analysis monthly. The analysis must include the cost of fabric in raw material inventory and the cost of fabric by item number for each item in finished product inventory.

The company uses one fabric for all of the sails it produces, and it uses the 5th and 6th characters in the item number for each product to represent the number of meters of material (rounded to the nearest meter) necessary to make that item.

In the form letter the manager sends to his banker each month, he wants the computer to automatically insert the quantity on hand, the item number, and the dollar value of the fabric for each item number.

Formula

ToText({file.QUANTITY}) + " each, Item " + {file.ITEM} +
", $ " + ToText({file.QUANTITY} * ToNumber({file.ITEM}[5
to 6]) * {file.FABRIC COST})

Result

With a fabric cost of $14.88/meter, the formula delivers the following result:

Quantity | Item | Letter Text
46 | 4423141006 | "46 each, Item 4423141006, $ 9582.72"
27 | 4423081009 | "27 each, Item 4423081009, $ 3214.08"

Explanation

  • This equation uses ToText to convert the value of {file.QUANTITY} (a numeric field) to text so it can be used as part of a concatenated text string.
  • It then uses the Concatenate operator (+) to join the text version of {file.QUANTITY} with the string " each, Item ".
  • It again uses the Concatenate operator (+) to join the resulting string with the item number, stored as the value of the text object {file.ITEM}.
  • It uses the Concatenate operator (+) one final time to join the resulting text string to the calculated fabric cost (expressed as text).
  • To calculate that fabric cost:
      • _ The formula uses the Subscript operator [] to extract the 5th and 6th elements (meters of material used) of {file.ITEM} (a text object).
      • _ The Make Range operator (to) is used to establish the range 5 to 6.
      • _ The ToNumber function converts those elements to a number so it can be used in a numeric calculation.
      • _ It uses the Multiply operator (*) to multiply that number by the value of {file.FABRIC COST} by the number of units in inventory ({file.QUANTITY}) to arrive at the total price.
      • _ Finally, it uses the ToText function to convert the total price (a number) into text that can be used in the concatenated string.
Related topics

Formulas In Action


Formula 4

Operators/Functions Used

Nested formulas, If-Then-Else, Subtract (-), Multiply (*), Greater than (>), Greater than or equal (>=), Sum, Parentheses ()

Formula Purpose

A computer store sells hardware, software, and books. It pays its sales representatives 7% of all hardware sales (monthly) over $5000, 10% of all software sales (monthly) over $10, 000, and 5% of all book sales (monthly) over $1000. The sales manager wants to calculate the commission in each category for each representative, total the commission due each representative, and flag those representatives who are entitled to more than $5000 in total commission for the month. We will do this using nested formulas, that is, using one formula as one of the elements in another formula.

Formula(s)

@HARDWARE

If (({file.HARD SALES}-5000)> 0) Then

    .07 * ({file.HARD SALES}-5000)

Else

    0

@SOFTWARE

If (({file.SOFT SALES}-10000)> 0) Then

    .10 * ({file.SOFT SALES}-10000)

Else

    0

@BOOKS

If (({file.BOOK SALES}-1000)> 0) Then

    .05 * ({file.BOOK SALES}-1000)

Else

    0

@TOTCOMM

Sum([{@HARDWARE}, {@SOFTWARE}, {@BOOKS}])

@FLAG

If {@TOTCOMM} >= 5000 Then

    " **** "

Else

    ""

Result

Given this data:

Salesrep | HardSales | SoftSales | BookSales
Salesrep A | 4500 | 21000 | 985
Salesrep B | 31427 | 41222 | 4470
Salesrep C | 22000 | 4687 | 4250
Salesrep D | 14000 | 15678 | 2200

The formulas return the following results:

Salesrep | Hardware | Software | Books | Total | Flag
SalesrepA | 0.00 | 1100.00 | 0.00 | 1100.00 |
SalesrepB | 3122.20 | 1849.89 | 173.50 | 5145.59 | ****
SalesrepC | 1190.00 | 0.00 | 162.50 | 1352.50 |
SalesrepD | 630.00 | 567.80 | 60.00 | 1257.80 |

Explanation

  • The three formulas (@HARDWARE, @SOFTWARE, and @BOOKS) work in the same manner.
  • They use the If-Then-Else operator to test for a condition, do one thing if the condition is true, do another thing if the condition is false.
  • · They take total sales in the category, use the Subtract operator (-) to subtract the amount of sales on which no commission is to be paid, and test to see if the remaining amount is a positive number (>0).
  • · If it is (>0), they calculate the commissions using the Multiply operator (*) to multiply the appropriate commission percentage (expressed as a decimal: .07, .10, .05) times the commissionable amount ({file.HARD SALES}-5000}, etc.).
  • · If the remaining amount is a negative number (<0), no commission is computed and the formula prints a zero amount (0.00).
  • · @TOTCOMM uses the Sum function to total the commissions due. Instead of including the calculations for each formula (a duplication of time and effort) it substitutes the formula name instead of the calculations. When the program encounters the formula name it knows to use the underlying calculations from the formula(s) referenced.
  • · @FLAG uses the If-Then-Else operator to evaluate the values calculated by @TOTCOM and to flag (****) those values of $5000 or more (>= 5000). @FLAG effectively nests two levels of other formulas: it nests @TOTCOM, which is a formula that itself nests three other formulas, @HARDWARE, @SOFTWARE, and @BOOKS. When the program sees @TOTCOM, it performs all of the underlying calculations referenced by that formula and the formulas that are used in @TOTCOM.
  • · Parentheses () are used throughout the formulas to control the order of calculation.
Related topics

Formulas In Action


Formula 5

Operators/Functions Used

Nested formulas, If-Then-Else, Subtract (-), Not equal to (<>), Less than (<), Concatenate (+), ToText, To dollar ($), Negate (-()), Parentheses ()

Formula Purpose

A company wants to stimulate new credit sales for those customers with open credit limits and to make customers who are over their limits aware of their over-limit balances. To do this the company wants to include a brief "PS" to its already customized (company name, contact name, etc.) sales letter to each customer.

Formula

If {file.CREDIT LIMIT} - {file.BALANCE} <> 0 Then

    If {file.CREDIT LIMIT} - {file.BALANCE} <0 Then

        "Your account is currently $" +

        ToText($ (-{file.CREDIT LIMIT}

        - {file.BALANCE}))

        + " over limit. Please contact us if you would

        like to discuss an increase in your credit limit."

    Else

        "Your account has $" + ToText($({file.CREDIT
LIMIT}

        -{file.BALANCE})) + " available credit.

        You can order today with no additional paperwork!"

Else

    ""

Result

CreditLimit | Balance | Result
$5000 | $2250 | "Your account has $2750.00 available credit. You can order today with no additional paperwork!"
$3000 | $3457 | "Your account is currently $457.00 over limit. Please contact us if you would like to discuss an increase in your credit line."
$7500 | $7500 | «no message»

Explanation

  • The formula uses two If-Then-Else operators, one nested inside the other.
  • The first begins with the first word If and does not end until the Else at the very end of the expression. This expression says, essentially, "If the credit limit less the balance is less than zero, then print the message based on the If-Then-Else expression that follows (the expression inside the parentheses). If the credit limit less the balance equals zero, print nothing. Think of this first If-Then-Else expression in this way: If {file.CREDIT LIMIT} - {file.BALANCE} <> 0 then (do what is in the parentheses ) Else "".
  • The second If-Then-Else expression begins "If {file.CREDIT LIMIT}" and ends after the word "paperwork!". This expression says: "If the credit limit less the balance is less than zero, then print the over limit message, otherwise (in those cases where the result is greater than zero) print the available credit message.
  • The Then expression ToText($(- {file.CREDIT LIMIT} - {file.BALANCE})) means:
      • _ first use the Subtract operator (-) to subtract {file.BALANCE} from {file.CREDIT LIMIT}.
  • Since this part of the expression will only be activated if the result is a negative number (<0), the formula uses the Negate operator (-()) to multiply the result by -1 to return a positive number.
  • The To Dollar operator ($) assures that the result will be printed in a dollar and cents format with two decimal places.
  • The ToText function takes the resulting number and converts it to text characters so it can be used in the over limit message.
  • The Else expression ToText($({file.CREDIT LIMIT}-{file.BALANCE})) differs only slightly from the Then expression above. This expression does not use the Negate operator (-()) because this expression {file.CREDIT LIMIT}-{file.BALANCE} will be used only in those cases where the result is a positive number (>0).
  • The Concatenate operator (+) joins the text strings (enclosed in quotation marks) with the number (converted to text using the ToText function) to produce the appropriate message (the Then message [over limit] or the Else message [available credit]).
  • Many sets of parentheses are used to control the order of calculation of this formula.
  • The characters "" at the very end of the formula are the representation of an empty string. This means print nothing.

Comments

Note the leading space in the string " over limit." Note too, the leading space in the string
" available credit." These spaces are purposely entered into the formula so a space occurs between the dollar figure and the words in each message.

Related topics

Formulas In Action


Formula 6

Operators/Functions Used

If-Then-Else, Greater than (>), Percentage (%), Greater than or equal (>=), Boolean Operator (And), Boolean Operator (Or), Parentheses ()

Formula Purpose

The manager of a minor league baseball team wants a column on the statistics report that flags all batting averages of .300 or better and all averages below .200. The manager does not want the batting average flagged for any player who has batted fewer than 100 times because the manager does not feel that such a batting average is statistically significant.

Formula

If ({file.ATBAT}>=100) And

(({file.HITS} % {file.ATBAT}>=30) Or

({file.HITS} % {file.ATBAT}<20)) Then

    "####"

Else

    ""

Result

Hits | AtBat | Average | Flag | Explanation
31 | 98 | .316 |  | AtBat <100 (not significant)
31 | 101 | .307 | #### | Average > 30 (.300)
43 | 216 | .199 | #### | Average < 20 (.200)
19 | 99 | .192 |  | AtBat < 100 (not significant)

Explanation

  • The formula uses the If-Then-Else operator to test for specific conditions.
  • Condition A ({file.ATBAT} >= 100) uses the Greater than or equal operator (>=) to make certain that the batter has batted at least one hundred times. If he has batted 100 or more times, this condition is true, otherwise it is false.
  • Condition B ({file.HITS} % {file.ATBAT} >30) uses the Percentage operator (%) to calculate {file.HITS} as a percentage of {file.ATBAT}. It then uses the Greater than or equal operator (>=) to test the resulting percentage to see if it is 30% (.300 batting average) or more. If the percentage is greater than or equal to 30, this condition is true, otherwise it is false.
  • Condition C ({file.HITS} % {file.ATBAT} < 20) again uses the Percentage operator (%) to calculate {file.HITS} as a percentage of {file.ATBAT}. It then uses the Less than operator (<) to test the resulting percentage to see if it is less than 20% (.200 batting average). If the percentage is less than 20, this condition is true, otherwise it is false.
  • The formula uses the Boolean operators And, and Or to evaluate conditions A, B, and C. The logical relationship required is Condition A and either Condition B or Condition C. Thus, the If part of the formula is satisfied if Condition A is TRUE, and either Condition B or Condition C is TRUE.
  • If the If part of the formula is satisfied (Then), it flags the batting average by printing four pound signs "####".
  • If those conditions are not true (Else), it prints nothing (as indicated by the empty text string "").
Related topics

Formulas In Action


Formula 7

Operators/Functions Used

If-Then-Else, Subtract (-), Greater than (>), Maximum ([array]), Multiply (*), Parentheses ().

Formula Purpose

A company has the following bonus/commission structure for its sales force: when a sales representative sells at or over quota, the representative earns a $250 bonus or a 15% commission (on the amount over quota), whichever is highest. The company pays no bonus or commission on sales less than quota. The sales manager wants bonus/commission calculated and included on a report.

Formula

If ({file.SALES}-{file.QUOTA})>=0 Then

    Maximum([250,.15*({file.SALES} - {file.QUOTA})])

Else

    0

Result

Sales | Quota | 15% | Amount Paid
10,000 | 8000 | 300 | 540 (calculated commission)
8000 | 8000 | 0 | 250 (guaranteed bonus)
7999 | 8000 | 0 | 0 (sales not >= Quota)

Explanation

  • This formula uses the If-Then-Else operator to test sales to see if they are greater than or equal to quota.
  • If they are (Then) it calculates the commission and pays the higher of commission or guaranteed bonus.
  • If they are not (Else), it does nothing.
  • To test sales to see if they are at least equal to quota, the formula uses the Subtract operator (-) to subtract {file.QUOTA} from {file.SALES}.
  • If {file.SALES} is greater than or equal to {file.QUOTA}, this subtraction will produce the result of zero or a positive number (>=0). This will trigger the Then part of the formula.
  • If {file.SALES} is less than {file.QUOTA}, this subtraction will produce a negative result. This will trigger the Else part of the formula.
  • The Then part of the formula uses the Multiply operator (*) to compute a 15% commission on the amount of sales in excess of quota: .15 * ({file.SALES} - {file.QUOTA}).
  • It then uses the Maximum([array]) function to determine if the calculated commission or the guaranteed bonus of $250 offers the highest payout Maximum([commission, 250]), and it returns this highest value.
  • Calculating this highest payout is the bottom line of the Then part of the formula.
  • The Else part of the formula makes no calculations and returns 0.
Related topics

Formulas In Action


Formula 8

Operators/Functions Used

If-Then-Else, Less than (<), Negate (-), Add (+), Round, Average([array]), Parentheses ().

Formula Purpose

To better control her purchasing and inventory, a store owner wants the inventory report to include a QtyToOrder column. She wants that column to tell her what quantity she needs to order to keep on hand the average quantity sold monthly during the previous three months.

  • If there is stock on hand, she will want to order the average quantity sold less the stock on hand.
  • If there is no stock on hand but no backorders, she will want to order the average quantity sold.
  • If there is no stock on hand and backorders, she will want to order enough to clear the backorders plus the average quantity sold.

Formula

If {file.ONHAND} < 0 Then
((- ({file.ONHAND})) + Round
((Average([{file.MONTH1}{file.MONTH2},
{file.MONTH3}]))))
Else
(Round((Average([{file.MONTH1}{file.MONTH2},
{file.MONTH3}])) - {file.ONHAND}))

Result

OnHand | Month1 | Month2 | Month3 | Avg. | Order
2 | 16 | 6 | 30 | 17 | 15
5- | 7 | 3 | 19 | 10 | 15
0 | 9 | 8 | 18 | 12 | 12

Explanation

  • The formula uses the If-Then-Else operator to set up one set of calculations if there are backorders ({file.ONHAND} < 0), and a different set of calculations if there are no backorders.
  • The If part of the formula uses the Less than operator (<) to see if the quantity on hand is less than zero. This indicates that, not only is all stock gone but there are unfilled orders (a backorder situation).
  • If there is a backorder, the Then part of the formula calculates the amount to order as the average monthly sales over a specified three month period plus the amount backordered (expressed as a positive number).
  • It uses the Negate operator (-) to convert the negative value of {file.ONHAND} to a positive value.
  • It uses the Average([array]) function to average the product sales for {file.MONTH1}, {file.MONTH2}, and {file.MONTH3} (the three months used to determine a typical sales pattern for the product).
  • It uses the Round function to round the average product sales to the nearest whole number.
  • It uses the Add operator (+) to add the quantity on hand (now expressed as a positive) to the rounded average monthly sales figure.
  • The result is the amount to order.
  • If there is no backorder, the Else part of the formula calculates the amount to order as the average monthly sales over the specified three month period less the quantity already on hand.
  • It uses the Average function to average the product sales for {file.MONTH1}, {file.MONTH2}, and {file.MONTH3} (the three months used to determine a typical sales pattern for the product).
  • It uses the Round function to round the average product sales to the nearest whole number.
  • It uses the Subtract operator (-) to subtract the quantity on hand from the rounded, average monthly sales figure.
  • The result is the amount to order.
Related topics

Formulas In Action


Formula 9

Operators/Functions Used

Nested If-Then-Else expressions, NumericText, Subscript, Make Range, Equal to (=), ToNumber, In Range, Parentheses ()

Formula Purpose

A retailer has a customer list that includes both customers living inside the state and customers living in Canada. For customers inside the state, some have 5 digit ZIP codes, others have 9 digit ZIP codes. Canadian customers have Postal Codes beginning with a letter.

The company wants a column on the list that shows the sales tax that needs to be levied on orders from each customer. Local customers (those within the greater metropolitan area) get assigned a 7.5% sales tax (6.5% state and 1% local); customers in the state but outside the metropolitan area are assigned a 6.5% sales tax (state only); and Canadian customers are assigned no sales tax.

Formula

If NumericText({customer.POSTAL CODE}[1 to 5])Then

    If ToNumber({customer.POSTAL CODE}[1 to 5]) in

    92200 to 92399 Then

        "7.5"

    Else

    "6.5"

Else

    "0"

Result

ZIP/Postal | Tax | Explanation
91134 | 6.5 | Inside state/outside metro area
92305 | 7.5 | Inside state/inside metro area
92288-5423 | 7.5 | Inside state/inside metro area (ZIP + 4)
96544-2333 | 6.5 | Inside state, outside metro area (ZIP + 4)
T5A 9S2 | 0.0 | Canadian customer

Explanation

  • This formula uses nested If-Then-Else operators.
  • The first of these If-Then-Else expressions begins with the initial If and ends with the final "0". It says:
  • If the first five characters in the {customer.POSTAL CODE} field are all numbers, then compute and print the sales tax using the methodology specified in the second If-Then-Else expression.
  • If the first five characters are not all numbers, print "0".
  • The second of the If-Then-Else expressions begins immediately after the initial Then and ends immediately before the final words Else "0". It says, now that we have already tested and know that the first five characters of {customer.POSTAL CODE} are numbers:
  • If the first five characters of {customer.POSTAL CODE}, converted to numbers, fall in the range of 92200 to 92399, print "7.5" (the amount of state and local sales taxes combined).
  • If the first five characters of {customer.POSTAL CODE}, converted to numbers, fall outside that range, print "6.5" (the amount of state sales tax only).
  • If NumericText ({customer.POSTAL CODE} [1 to 5]) uses the If-Then-Else operator to test for the condition in parentheses:
  • {customer.POSTAL CODE} [1 to 5]) uses the Subscript operator [] and Make Range operator to extract characters 1 to 5 in the {customer.POSTAL CODE} field.
  • The NumericText function evaluates the extracted characters to determine if they are all numbers or not.
  • If they are all numbers (YES) the first If condition is satisfied and the formula moves to the first Then consequence.
  • · If they are not all numbers, the first If condition is not satisfied, and the formula moves to the final Else consequence.
  • · Then if ToNumber({customer.POSTAL CODE} [1 to 5]) in 92200 to 92399 Then "7.5" Else "6.5" Else "0" shows what is to take place if the original If conditions have been satisfied.
  • · ({customer.POSTAL CODE} [1 to 5]) uses the Subscript operator [ ] and Make Range operator to extract characters 1 to 5 in the {customer.POSTAL CODE} field.
  • · ToNumber converts these extracted characters to a number that can then be used in a numeric expression.
  • · in 92200 to 92399 checks to see if the {customer.POSTAL CODE} (now converted to a number) falls anywhere within the range 92200 to 92399.
  • · If it does, the If condition (inside the parentheses) is satisfied and the Then consequence is performed by printing the text string "7.5".
  • · If it does not, the If condition is not satisfied, and the Else consequence is performed by printing the text string "6.5".

Comments

These tax figures, rules, and Postal codes are for illustration only; they are not meant to accurately represent state and local taxing regulations.

Related topics

Formulas In Action


Formula 10

Operators/Functions Used

If-Then-Else, Not, DayOfWeek, Make Range (to), In Range (in), Parentheses ()

Formula Purpose

A seven day per week customer service department logs all calls and stores the records in a database. As an aid in scheduling weekend staff, management wants to flag the weekend calls so they stand out in the call report.

Formula

If Not(DayOfWeek({file.CALL DATE}) in 2 to 6) Then

    "Weekend"

Else

    ""

Result

Day of Week | # | Flag
Sunday | 1 | Weekend
Monday | 2 |
Tuesday | 3 |
Wednesday | 4 |
Thursday | 5 |
Friday | 6 |
Saturday | 7 | Weekend

Explanation

  • The formula uses the If-Then-Else operator to say, "If the day of the week is not a weekday, then print "Weekend", otherwise (Else) print nothing (as indicated by the empty text string "").
  • The If part of the formula sets up the condition, "If the day of the week is not a weekday".
  • The DayOfWeek function evaluates {file.CALL DATE} and returns a number from 1 to 7 (Sunday being 1, Saturday being 7) to indicate the day of the week on which a call was made.
  • In 2 to 6 uses the In Range function (in) and the Make Range function (to) to determine if the day of the week the call was made was in the range 2 to 6 (Monday to Friday).
  • The Not function negates the expression that follows.
  • Without the Not function preceding the expression, the If expression reads "If the day of the week number indicates the call date was a weekday."
  • With the Not function, the If expression reads, "If the day of the week number indicates the call date was not a weekday."
  • If the call date is not a weekday, the If expression is satisfied, thus triggering the Then consequence.
  • "Weekend" tells the program that when the If condition is satisfied, print the word "Weekend".
  • If the call date is a weekday, the If condition is not satisfied, thus triggering the Else consequence.
  • "" tells the program to print nothing if the If condition is not satisfied.
Related topics

Formulas In Action


Formula 11

Operators/Functions Used

If-Then-Else, Subscript [], Not equal to (<>), Maximum([array]), Multiply (*), Parentheses ().

Formula Purpose

As part of a charity fund raiser, a company agrees to donate 1% of the invoice amount (or $1.00, whichever is larger) for each invoice it cut during the previous quarter. The only invoices that it has exempted are Credit Invoices (identified with the letter "C" as the 6th character in the invoice number) and invoices for non-profit agencies (identified with the letter "N" as the 6th character in the invoice number). Management wants a Contribution column to appear on the quarterly detail sales report.

Formula

If {file.INV#}[6]<> "C" and {file.INV#}[6]<>"N" Then

    $(Maximum([.01 * {file.AMT}), 1])

Else

    0

Result

Invoice # | Amount | Amt. * 1% | To Charity | Reason
21523R | 143.27 | 1.43 | $1.43 |
21524C | 223.46 | N/A | 0 | «credit»
21538R | 47.15 | .47 | $1.00 |
21575N | 1312.49 | N/A | 0 | «nonprofit»

Explanation

  • The If part of the expression tests for two conditions: that the invoice is not a credit invoice and that it is not a non-profit invoice. Both conditions must be true to trigger the Then consequence.
  • Condition A: {file.INV#} [6] <> "C" uses the Subscript operator [] to extract the 6th character of the value stored in {file.INV#}. It then compares that character to "C". If the character is not C (not a credit invoice), Condition A is satisfied.
  • Condition B: {file.INV#} [6] <> "N" uses the Subscript operator [] to extract the 6th character of the value stored in {file.INV#}. It then compares that character to "N". If the character is not N (not a non-profit invoice), Condition B is satisfied.
  • The Boolean operator and indicates that both Condition A and Condition B must be TRUE in order to satisfy the If part of the expression.
  • If Condition A and Condition B are both TRUE, the If part of the expression is satisfied, thus triggering the Then consequence.
  • .01 * {file.AMT} uses the Multiply operator (*) to multiply the amount of the invoice by 1% (.01).
  • Maximum([.01 * {file.AMT}, 1]) returns the highest contribution for a given invoice: either 1% of the invoice amount or $1.00.
  • The To Dollar ($) operator converts the amount to a dollar value.
  • If either Condition A or Condition B is FALSE, or both are FALSE, the If part of the expression is not satisfied, thus triggering the Else consequences.
  • If the If part of the expression is not satisfied, the formula returns the value 0.

Comments

An alternative rendering follows:

If {file.INV#}[6] in ["C", "N"] Then

    0

Else

    Maximum([.01*{file.AMT}, 1])
Related topics

Formulas In Action


Formula 12

Operators/Functions Used

If-Then-Else, Average([array]), Subtract (-), Greater than (>), Minimum([array]), Multiply (*), Parentheses ().

Formula Purpose

A consultant has contracts that pay him a percentage of the amount he saves his clients with a cap or ceiling on the amount he can earn. His contracts pay him 25% of the monthly savings up to a maximum of $10,000 per month. If his percentage amounts to more than $10,000, he collects the $10,000 maximum; if the percentage is less than $10,000, he collects the actual percentage. The base period against which savings are calculated is the average of three typical months in a prior year.

Formula

If (Average([{file.MON1}, {file.MON2}, {file.MON3}]) -
{file.CURRENTMON})> 0 Then
Minimum([.25*((Average([{file.MON1}, {file.MON2},
{file.MON3}) - {file.CURRENTMON}]), 10000])
Else
0

Result

Average | CurMon | Savings | 25% | Amt.Due
90, 000 | 65, 000 | 25, 000 | 6250 | 6250
120, 000 | 60, 000 | 60, 000 | 15, 000 | 10, 000
75, 000 | 77, 000 | N/A | N/A | 0

Explanation

  • The formula uses the If-Then-Else operator to say: if the average outlay during the three months specified was higher than the current month, then return 25% of the difference, up to a maximum of $10,000. If the average outlay was equal to or less than the outlay during the current month, return 0.
  • The formula uses the Average function to calculate the average outlay during {file.MON1}, {file.MON2}, and {file.MON3} - the baseline period.
  • It uses the Subtract operator (-) to subtract the outlay in the current month from the average during the baseline period, thus giving the difference between the current month and the baseline.
  • It uses the Greater than operator (>) to compare that difference to 0.
  • If the difference is greater than 0 (there actually was a savings), the If part of the expression is satisfied, thus triggering the Then consequences.
  • If the Then consequences are triggered:
  • The formula uses the Average function to calculate the average outlay during {file.MON1}, {file.MON2}, and {file.MON3} - the baseline period.
  • · It uses the Subtract operator (-) to subtract the outlay in the current month from the average during the baseline period.
  • · It uses the Multiply operator (*) to calculate 25% of the difference (.25 *...).
  • · It uses the Minimum ([array]) function to return the smaller amount: either 25% of the difference, or $10,000. Using the Minimum function in this way effectively puts a ceiling on the result of the calculation.
  • · If the difference is equal to or less than 0 (there was no savings), the If part of the expression is not satisfied, thus triggering the Else consequence.
  • · The Else consequence (Else 0) simply returns the value 0.
Related topics

Formulas In Action


Formula 13

Operators/Functions Used

ToText, Truncate, Division (/), Concatenate (+), Remainder

Formula Purpose

Bulk grains and nuts are inventoried by the ounce, but management wants to see a breakdown in pounds and ounces on the inventory report.

Formula

ToText((Truncate({file.OZ}/16)),0) + " pounds, " +
ToText((Remainder ({file.OZ}, 16)),0) + " ounces "

Result

Ounces | Resulting Text
433 | "27 pounds, 1 ounces"
278 | "17 pounds, 6 ounces"
1455 | "90 pounds, 15 ounces"

Explanation

  • The formula uses the Divide operator (/) to divide {file.OZ} by 16, thus calculating the number of pounds of the item in inventory. Unless {file.OZ} is perfectly divisible by 16, the quotient will be a whole number with decimal places.
  • The Truncate function returns only the whole number (integer) part of the quotient.
  • The ToText function converts the number to text so it can be used in a string with other text, and formats the number to zero decimal places (the second parameter).
  • The formula uses the Concatenate operator (+) to connect the number of pounds with the text string " pounds" to give the new string " n pounds" (where n is the calculated number of pounds).
  • The Remainder function determines the remainder that results from the division {file.OZ}/16 ({file.OZ} the numerator, 16 the denominator). The remainder is a number of ounces less than 16 (less than a full pound).
  • The ToText function converts the remainder to text so it can be included in the final text string, and formats the number to zero decimal places.
  • The Concatenate operator (+) connects the number of ounces (now converted to text, to the string before ("n pounds,") and to the string after ("ounces") to produce the final text string "n pounds, y ounces" (where y is the remainder).
Related topics

Formulas In Action


Formula 14

Operators/Functions Used

If-Then-Else, Length, TrimLeft, Less than or equal (<+), Parentheses ().

Formula Purpose

Five and a half years earlier, a company had changed from a lifetime warranty for its products to a five year warranty. The first products that had been manufactured with the shorter warranty were now out of warranty, but the repair department was slow to adapt. It continued to repair all products for free, as if they were all covered by the original lifetime warranty.

All products manufactured under the new, shorter warranty had issued eight character serial numbers instead of the five, six, or seven character serial numbers that had been issued to lifetime-warranted products.

To begin controlling the situation, management has called for a column on its repair report that identifies products serviced as either lifetime warranty or five year warranty products.

Formula

If Length(TrimLeft({file.SERIAL#}))<= 7 Then

    "Lifetime Warranty"

Else

    "5 Year Warranty"

Result

Serial Number | # Characters | Flag
BP10001 | 7 | "Lifetime Warranty"
BP1000 | 6 | "Lifetime Warranty"
BP999 | 5 | "Lifetime Warranty"
BP100001 | 8 | "5 Year Warranty"

Explanation

  • The formula uses the If-Then-Else operator to say, "If the serial number is 7 characters long or less (Then), print "Lifetime Warranty", otherwise (Else) print "5 Year Warranty".
  • TrimLeft({file.SERIAL#}) removes all of the blank spaces stored to the left of the actual serial number in the right-justified {file.SERIAL#} field. The formula uses TrimLeft to eliminate spaces because Length counts spaces as characters if they are present.
  • Length counts the characters in the actual serial number.
  • The formula uses the Less than or equal to operator (<=) to make certain that the serial number is 7 characters long (or less).
  • If the serial number is less than or equal to 7 characters, the If part of the expression is satisfied, thus triggering the Then consequence.
  • If the If part of the expression is satisfied, the formula prints the text string "Lifetime Warranty".
  • If the serial number is greater than 7 characters, the If part of the expression is not satisfied, thus triggering the Else consequence.
  • If the If part of the expression is not satisfied, the formula prints the text string "5 Year Warranty".
Related topics

Formulas In Action


Formula 15

Operators/Functions Used

Nested If-Then-Else operators, Not equal (<>), Boolean operator (And), Equal (=), Concatenate (+), Parentheses ().

Formula Purpose

The director of a non-profit health care facility wants to automate the salutation in a letter he is sending to his staff. The staff consists of men and women, and professional and non-professional employees. He wants to be certain that all doctors on staff (M.D., Ph.D., and D.D.S.) are given the form of address "Dr." and all non-doctors are given the form of address appropriate to their gender.

Formula

If {file.DEGREE} <> "Ph.D." And

{file.DEGREE} <>"M.D." And

{file.DEGREE} <>"D.D.S" Then

    If {file.SEX} = "M" Then

        "Dear Mr. " + {file.LNAME}

    Else

        "Dear Ms. " + {file.LNAME}

Else

    "Dear Dr. " + {file.LNAME}

Result

Degree | Gender | Last Name | Salutation
B.A. | F | Jones | "Dear Ms. Jones"
Ph.D. | F | Smith | "Dear Dr. Smith"
M.D. | M | Jackson | "Dear Dr. Jackson"
M.S. | M | Miller | "Dear Mr. Miller"
D.D.S. | F | Johnson | "Dear Dr. Johnson"

Explanation

  • This formula uses nested If-Then-Else operators.
  • The first If-Then-Else expression begins with the first If and continues to Else "Dear Dr. " + {file.LNAME} at the end of the formula. It says, "If the degree listed is not a doctoral degree (Then), follow the Then consequences, which contains another If-Then-Else expression. If the degree listed is a doctoral degree (Else), print a doctoral salutation.
  • The If part of the expression tests for three different conditions.
  • Condition A uses the Not equal operator <> to make certain that the employee's degree is not Ph.D.
  • Condition B uses the Not equal operator <> to make certain that the employee's degree is not M.D.
  • Condition C uses the Not equal operator <> to make certain that the employee's degree is not D.D.S.
  • The two And operators indicate that all three conditions must be met to satisfy the If part of the expression.
  • If all three conditions are met, the If part of the expression is satisfied, thus triggering the Then consequences.
  • If any one of the three conditions is not met (or two or all three), the If part of the expression is not satisfied, thus triggering the Else consequence.
  • The second If-Then-Else statement begins with if {file.GENDER} = and ends with Else "Dear Ms. " + {file.LNAME}. It says, "If the employee is male (then), print a male salutation. If the employee is anything but male (Else), print a female salutation. This If-Then-Else expression determines what actually happens if the If part of the first expression is satisfied.
  • If the gender is male (determined by using the Equal operator =), the If part of the second If-Then-Else expression is satisfied, thus triggering the Then consequence (printing the salutation "Dear Mr. " + {file.LNAME}.
  • If the gender is not male, the If part of the second If-Then-Else expression is not satisfied, thus triggering the Else consequence (printing the salutation "Dear Ms. " + {file.LNAME}.
  • · The Concatenate operator (+) connects the "Dear x" part of the salutation with the last name (as stored in the {file.LNAME} field).
Related topics

Formulas In Action


Formula 16

Operators/Functions Used

If-Then-Else, Add (+), Less than (<), Multiply (*)

Formula Purpose

A manufacturer of lawn and garden products grants a 10-5-5 discount on Category A products and 15-10-5 discount on Category B products. It also pays the freight on all orders of $5,000 or more (before discount). It charges a flat 4% freight on all orders of less than $5,000. Management wants a Total Including Freight figure to appear on the daily sales report.

Formula

If ({file.CAT A} + {file.CAT B}) < 5000 Then

    1.04 * .95 *.95 *.90 *{file.CAT A} + .95 *.90 *.85

    *{file.CAT B}

Else

    .95 *.95 *.90 *{file.CAT A} + .95 *.90 *.85 *{file.CAT
B}

Result

Cat A | Cat B | Cat A+Cat B | TotInclFrt
9524 | 1344 | 10868 | 8712.62
3424 | 1344 | 4768 | 3908.21

Explanation

  • This formula uses the If-Then-Else operator to say, if the sum of {file.CAT A} and {file.CAT B} is lower than $5,000 (Then), multiply the discounted price by 104% (1.04) to arrive at the price plus freight. If the sum of {file.CAT A} and {file.CAT B} is higher than $5,000 (Else), simply calculate the discounted price (no freight, since the order is bigger than $5,000.
  • The If part of the expression uses the Add operator (+) to calculate the undiscounted value of {file.CAT A} and {file.CAT B}.
  • It uses the Less than operator (<) to determine if the sum of {file.CAT A} and {file.CAT B} is less than $5000.
  • If the sum is less than $5000, the If part of the expression is satisfied, thus triggering the Then consequence.
  • The formula uses the Multiply operator (*) several times, first to multiply the value of {file.CAT A} by .90 (10% discount), to multiply that result by .95 (5% discount), and to multiply that result by .95 (5% discount) to arrive at the discounted amount for {file.CAT A}.
  • It performs the same set of calculations on {file.CAT B} to determine the discounted amount for that category.
  • It uses the Add operator (+) to add the discounted amounts of {file.CAT A} and {file.CAT B} to arrive at the discounted total (before freight).
  • Finally, it uses the Multiply operator (*) to multiply the discounted total by 1.04 (100% + 4% freight) to arrive at the invoice total including freight.
  • If the sum is $5,000 or more, the If part of the expression is not satisfied, thus triggering the Else consequence.
  • The formula uses the Multiply operator (*) several times, first to multiply the value of {file.CAT A} by .90 (10% discount), to multiply that result by .95 (5% discount), and to multiply that result by .95 (5% discount) to determine the discounted amount for {file.CAT A} (freight free).
  • It performs the same set of calculations on {file.CAT B} to determine the discounted amount for that category.
  • Finally, it uses the Add operator (+) to add the discounted amounts of {file.CAT A} and {file.CAT B} to arrive at the final invoice total (freight free).
Related topics

Formulas In Action


Formula 17

Operators/Functions Used

If-Then-Else, Remainder, ToNumber, Equal (=), Parentheses ()

Formula Purpose

A retailer wants to test two different direct mail offers to see which one has the best "pulling" power. He wants to send one offer to all customers on his mailing list with even customer numbers and the second offer to all customers with odd customer numbers.

Formula

If Remainder(ToNumber({file.CUSTNUM}), 2 )= 0 Then

    {file.OFFER1}

Else

    {file.OFFER2}

Results

Cust # | Remainder | Result
203104 | 0 | Offer 1 - "You are entitled to a 10% discount."
203105 | 1 | Offer 2 - "You are entitled to a free gift."

Explanation

  • The ToNumber function converts the customer number (stored as text) to a number.
  • The Remainder function takes that number, divides it by 2, and returns a remainder.
  • The Equal operator tests the remainder to see if it is equal to 0.
  • If the remainder is equal to zero, the customer number is divisible by two and thus an even number triggering the printing of {file.OFFER1}.
  • If the remainder is not equal to zero, the customer number is not evenly divisible by two and thus an odd number, triggering the printing of {file.OFFER2}.
Related topics

Formulas In Action


Creating Formulas with Basic Syntax

This section provides you with an overview of various parts of a formula. You learn about Basic syntax and the techniques you can use when creating a formula.


Basic syntax overview

When creating formulas, you have the option of using either Crystal or Basic syntax. Syntax rules are used to create correct formulas. Almost any formula written with one syntax can be written with the other. Reports can contain formulas that use Basic syntax as well as formulas that use Crystal syntax.

If you are familiar with Microsoft Visual Basic or other versions of Basic, then Basic syntax may be more familiar to you. In general, Basic syntax is similar to Visual Basic except that it has specific extensions to handle reporting.

Note: Report processing is not slowed down by using Basic syntax. Reports using Basic syntax formulas can run on any machine that Seagate Crystal Reports runs on. Also, using Basic syntax formulas does not require distributing any additional files with your reports.


Tips on learning Basic syntax

If you have no programming experience

In many cases you may not need to use the formula language. Seagate Crystal Reports includes several Experts that automatically handle situations where formulas could be used. These include the Select, Search, Running Totals and Highlighting Experts, and the Insert Summary and Insert Grand Total dialog boxes. Before creating formulas, check to see if you can use one of these tools.

However, you may need to create formulas without the help of an Expert. Read this section to learn about Basic syntax and the rules you need to follow to create a formula.

If you know Microsoft Visual Basic, VBScript, or another version of Basic

In order to create formulas using Basic syntax, you need to understand the following:

  • How a Basic syntax formula refers to other fields in the report such as database fields, parameter fields, summary fields, running total fields and other formula fields.
  • How to return a value from a formula by setting the special variable named formula.
  • How to use functions specific to report processing such as ReportTitle and OnFirstRecord.
  • How to use the type system. Basic syntax is strongly typed, similar to using Option Explicit in Visual Basic and there is no Variant type. Basic syntax supports separate Date, Time and DateTime types unlike just the Date type in Visual Basic. It also supports range types such as 10 To 20 to allow for ranges of values which are common in many reporting applications.

Read this section to familiarize yourself with the above details.

Familiar features

  • Many Basic syntax functions work in the same way as their counterparts in Visual Basic. This includes string functions such as Len, Mid and Filter, math functions such as Abs, Rnd and Sin, financial functions such as PV, programming shortcut functions such as IIF and date functions such as DateSerial, DateAdd and DateDiff.
  • Most operators supported by Visual Basic are also in Basic syntax. For example, string concatenation (&) and date-time literals (#...#).
  • Most statements and control structures use the same syntax as in Visual Basic. This includes the If, Select, Do While, Do Until, While and For/Next statements.
  • The overall look of the formula will be unmistakably Basic like. For example, Basic style comments and line continuation characters are supported as is the Basic language use of new lines, colons, and the equal sign.

If you already know Crystal syntax

The main adjustment is getting used to the parts of the Basic language that are common to every version of Basic. Read this section for a detailed introduction.


Basic syntax fundamentals

The result of a formula

The result of a formula, or the value that is printed when the formula is placed in a report, is called the value returned by the formula. Every formula in Seagate Crystal Reports must return a value. Basic syntax does this by setting the value of the special variable formula. For example, here is a simple Basic syntax formula that returns the value 10:

formula = 10

The value returned by a formula can be one of the seven simple data types supported: Number, Currency, String, Boolean, Date, Time and DateTime. Seagate Crystal Reports also supports range types and array types, but these cannot be returned by a formula.


Restrictions on changing formula variable data types

The formula variable can be set several times within a single formula. For example, suppose a company has a shipping policy in which orders over $1,000 are insured, but orders below that amount are not insured:

Rem A formula that returns a String value
If {Orders.Order Amount} >= 1000 Then
   formula = "Insured shipping"
Else
   formula = "Regular shipping"
End If

The above formula returns the text string value "Insured shipping" if the value of the database field {Orders.Order Amount} is greater than or equal to 1000; otherwise, it returns the text string value "Regular Shipping." Text strings are usually just referred to as strings. Notice that the formula variable appears twice in the above example.

If the formula variable is set to a value of one type, it cannot be set to a value of another type later in the same formula. For example, replacing the String "Regular shipping" in the above example with the Number 10 would result in an error since the special variable formula was first set to the String value "Insured shipping."

The reason for this restriction is that Seagate Crystal Reports needs to know in advance what the return type of a formula will be so that it can allocate enough storage for the returned values. This is because different types have different storage requirements. Another reason is that the formatting options available for a formula field depend on its type. For example, a Number field has Number formatting options, such as the number of decimals to display, which do not make sense for a String field.

Note: The special variable formula should not be declared, unlike other variables used in a Basic syntax formula. See Variables.


How formulas relate to functions in Microsoft Visual Basic

Consider the following Basic syntax formula:

Rem A formula that returns a String value
Rem The function Rnd returns a random number
Rem between 0 and 1
If Rnd > 0.9 Then
   formula = "You won!"
Else
   formula = "Sorry, try again."
End If

The above formula returns the text string value "You won!" if the random number returned by Rnd is greater than 0.9 and the text string value "Sorry, try again." otherwise.

The use of the formula variable is similar to writing a function named formula in Visual Basic.

For example, the above formula could be written as a Visual Basic function as follows:

Rem The following code is in Visual Basic
Function formula()
    If Rnd > 0.9 Then
       formula = "You won!"
    Else
       formula = "Sorry, try again."
    End If
End Function


The variable formula must be assigned a value

If the variable formula is not assigned a value, it is not a complete Basic syntax formula.

Note: Some examples in this section are not complete Basic syntax formulas but rather just fragments intended to explain a particular feature.

What if I'm not interested in using the value returned by a formula?

Sometimes you may want to write a formula that just declares and initializes some global variables. These formulas are commonly inserted into the report header section of a report. In such cases, assign any value to the special variable formula. Every formula must return a value, even if you are not interested in using that value.

For example:

Rem Some Global variable declarations
Rem Remember to set the value of 'formula'
Global x As String, y As Number, z As DateTime
x = "hello"
y = 10.5
z = #Aug 6, 1976#
formula = 10


Basic syntax is not case-sensitive

What this means is that formula, Formula, and FORMULA are all considered to be the same. This is true of all variable names, functions, and keywords used in a Basic syntax formula.

Note: The only exception to this rule is for strings. The string "Hello" is not the same as the string "hello".

Practice using the Xtreme sample database

Many of the examples in this section refer to the Xtreme sample database. This database is included with Seagate Crystal Reports.

Browse the Samples directory to find the Databases folder that contains the Xtreme database.


Comments

Formula comments are notes included with a formula to explain its design and operation. Comments do not print and they do not affect the formula; they appear only in the Formula Editor. Use comments to explain the purpose of a formula or explain the steps involved in writing it.

Comments work as in Visual Basic. Begin comments with a Rem or an apostrophe.

Note: A comment beginning with a Rem is a separate statement and must either start on a new line or be separated from the previous statement by a colon.

Rem This is a comment
Rem This is another comment
formula = 10 'So is any text after an apostrophe
formula = 20 : Rem This is also a comment
'Comments can occur after the formula text


Fields

Many of the fields you use when creating your report can also be referred to in your formulas. For example, database, parameter, running total, SQL expression, summary, and group name fields can all be used in a formula. You can also refer to other formula fields in your formula.

The easiest way to insert a field into your report is to double-click a field's name in the Report Fields tree. This ensures that the correct syntax for the field is used.

How fields appear in formulas

Database, parameter, formula, running total and SQL expression fields have their names surrounded by braces. Database field names are taken from the database. For example:

  • database field: {Employee.Last Name}

Parameter, formula, running total, and SQL expression field names are specified when the fields are created.

  • parameter fields also includes a question mark: {?my parameter field}
  • formula fields include an at sign: {@another formula }
  • running totals fields include a pound sign: {#my running total}
  • SQL expression fields include a percent sign: {%my SQL expression}

Summary and group name fields look like function calls. However, they are really shorthand notation for a report field.

  • sum summary field: Sum({Orders.Order Amount}, {Orders.Ship Via})
  • group name field: GroupName({Orders.Ship Via})


Sample formulas using fields

The formula in this example uses the Xtreme database. To find out how many days it takes to ship the product from the date when the order was placed, subtract the ship date database field from the order date database field:

Rem A formula that uses database fields
formula = {Orders.Ship Date} - {Orders.Order Date}

To find the total dollar amount of a given product that was ordered, multiply its unit price by the quantity ordered:

formula = {Orders Detail.Unit Price} * _
          {Orders Detail.Quantity}

Note: The example uses the line continuation character " _ " (space underscore). See Statements.

To calculate a sale price of 80 percent of the original unit price:

formula = {Orders Detail.Unit Price} * 0.80


Statements

A Basic syntax formula consists of a sequence of statements. Each statement must be separated from the previous statement by either a new line or a colon. Typically, each statement takes one line, but you can continue a statement onto the next line by using the line continuation character, which is a space followed by an underscore.

For example:

'Declare a variable x to hold a number
Dim x As Number
'Assign the value of 30 to x
x = 10 + 10 + 10
'This also assigns the value of 30 to x
x = 10 + _
    10 + 10
'Line continuation characters _
 can also be used in comments
Dim y as String
'Three statements separated by two colons
y = "Hello" : x = 30 : formula = True


Assignment

Use the equal sign (=) when making assignments. The keyword Let can be optionally included as well. For example:

x = 10
Let y = 20


Simple data types

The simple data types in Seagate Crystal Reports are Number, Currency, String, Boolean, Date, Time and DateTime.

Number

Enter numbers without any comma separators or currency symbols (Generally, you would want to have formatted numbers appearing as the result of a formula and not in the formula itself).

Examples

10000
-20
1.23


Currency

Use the CCur function to create a Currency value. The initial C in CCur stands for convert and it can be used to convert Number values to Currency values.

Examples

CCur (10000)
CCur (-20)
CCur (1.23)


String

Strings are used to hold text. The text must be placed between double quotation marks (") and cannot be split between lines. If you want to include double quotes in a string, use two consecutive double quotation marks.

"This is a string."
"123"
"The word ""hello"" is quoted."

You can extract individual elements or substrings from a string by specifying the character position or a range of character positions. Negative values are allowed; they specify the position starting from the end of the string.

"hello" (2) 'Equal to "e"
"hello" (-5) 'Equal to "h"
"604-555-1234" (1 to 3) 'Equal to "604"
"abcdef" (-3 to -1) 'Equal to "def"

You can also extract substrings from a string using the Left, Right and Mid functions.


Boolean

The Boolean values are:

True
False

Note: Yes can be used instead of True and No instead of False.


Date, Time, and DateTime

The DateTime type can hold date-times, dates only or times only. The Date type holds dates only and the Time type holds times only. The Date and Time types are more efficient than the DateTime type, and so can be used in situations where the added functionality and flexibility of the DateTime type is not needed.

Visual Basic does not support separate types for holding dates only or times only. The Basic syntax DateTime type is similar to Visual Basic's Date type.

You can create DateTime values directly using the date-time literal construction. It is formed by typing in the date-time between 2 pound (#) signs. Many different formats are supported, as in Visual Basic.

Note: Date-time literals cannot be split between lines.

Examples
#8/6/1976 1:20 am#
#August 6, 1976#
#6 Aug 1976 13:20:19#
#6 Aug 1976 1:30:15 pm#
#8/6/1976#
#10:20 am#

Even though #10:20 am# looks like it could have the Time type and
#8/6/1976# looks like it could have the Date type, they do not. They both have the DateTime type, as do all date-time literals. For example, you can think of #10:20 am# as a DateTime value with a null date part. To convert it to the Time type use CTime (#10:20 am#).

Instead of using date-time literals you can use CDateTime to convert a String to a DateTime. For example,

CDateTime ("8/6/1976 1:20 am")
CDateTime ("10:20 am")

However, there is one key difference between using date-time literals and the above usage of CDateTime. Date-time literals always use U.S. English date formats rather than settings from the locale of the particular computer on which Seagate Crystal Reports is running. Thus, the date-time literal examples above would work on all computers. On the other hand, on a French system, you could use constructions like:

CDateTime ("22 aout 1997") 'Same as #Aug 22, 1997#

Date values can be constructed with CDate and Time values with CTime:

CDate ("Aug 6, 1969")
CDate (1969, 8, 6) 'Specify the year, month, day
'Converts the DateTime argument to a Date
CDate (#Aug 6, 1969#)
CTime ("10:30 am")
CTime (10, 30, 0) 'Specify the hour, minute, second
CTime (#10:30 am#)


Range data types

Ranges are designed to handle a spectrum of values. Range types are available for all the simple types except for Boolean. That is: Number Range, Currency Range, String Range, Date Range, Time Range and DateTime Range. You can generate ranges using the To, _To, To_, _To_, Is >, Is >=, Is < and Is <= keywords. In general, To is used for ranges with 2 endpoints, and Is is used for open ended ranges (only one endpoint). The underscores are used to indicate whether or not the endpoints are in the range.

Examples of Number Range values

The range of numbers from 2 to 5 including both 2 and 5

2 To 5

The range of numbers from 2 to 5, not including 2 but including 5

2 _To 5

All numbers less than or equal to 5

Is <= 5

All number less than 5

Is < 5
Examples of DateTime Range values
#Jan 5, 1999# To #Dec 12, 2000#
Is >= #Jan 1, 2000#


Using ranges in formulas

There are twenty-seven functions in Seagate Crystal Reports that specify date ranges. For example, the function LastFullMonth specifies a range of date values that includes all dates from the first to last day of the previous month. So if today's date is September 15, 1999 then LastFullMonth is the same as the range value CDate (#Aug 1, 1999#) To CDate (#Aug 31, 1999#).

Ranges are often used with If or Select statements. The following example computes student letter grades based on their test scores. Scores greater than or equal to 90 receive an "A", scores from 80 to 90, not including 90 receive a "B" and so on.

Rem Compute student letter grades
Select Case {Student.Test Scores}
   Case Is >= 90
      formula = "A"
   Case 80 To_ 90
      formula = "B"
   Case 70 To_ 80
      formula = "C"
   Case 60 To_ 70
      formula = "D"
   Case Else
      formula = "F"
End Select

The above example uses the Select statement which is discussed in more detail in Control structures. You can check if a value is in a range by using the In operator. For example:

formula = 5 In 2 To 10 'True
formula = 5 In 2 To_ 5 'False
formula = 5 In 2 To 5 'True

The Maximum and Minimum functions can be used to find the endpoints of a range:

formula = Maximum (2 To 10) 'Returns 10


Array data types

Arrays in Seagate Crystal Reports are ordered lists of values that are all of the same type. These values are known as the array's elements. The elements of an array can be any simple type or range type. One way to create an array is using the Array function.

Examples

An array of 3 Number values. The first element is 10, the second is 5 and the third is 20.

Array (10, 5, 20)

An array of 7 String values:

Array ("Sun", "Mon", "Tue", "Wed", "Th", "Fri", "Sat")

An array of 2 DateTime Range values (note the line continuation character which is used for readability):

Array (#Jan 1, 1998# To #Jan 31, 1998#, _
       #Feb 1, 1999# To #Feb 28, 1999#)

You can extract individual elements out of an array using parentheses containing the index of the element you want. This is called subscripting the array:

Array (10, 5, 20) (2) 'Equal to 5

Note: Arrays in Basic syntax are indexed from 1 (this means the first element has index 1). This is unlike in Visual Basic where arrays are indexed from 0 by default. However, in Visual Basic, arrays can be indexed from 1 by using the Option Base statement.

Number ranges can also be used to subscript arrays. The result is another array. For example:

Array (10, 5, 20) (2 To 3) 'Equal to Array (5, 20)

Arrays are most useful when used with variables. Using variables, you can change the individual elements of an array and resize the array to accommodate more elements. This capability significantly expands the capabilities of the formula language to do complex calculations.

For example, you can accumulate database field values into a global array variable in a detail level formula, and then use a formula in a group footer to perform a calculation based on those values. This allows you to perform a wide variety of customized summary operations.


Variables

This section describes the key components of variables and shows you how to create variables and assign values to them.

Variable overview

A variable represents a specific data item, or value, and acts as a placeholder for that value. When a formula encounters a variable, the formula searches for the value of the variable and uses it in the formula. Unlike a constant value, which is fixed and unchanging, a variable can be repeatedly assigned different values. You assign a value to a variable and the variable maintains the value until you later assign a new value. Because of this flexibility, it is necessary for you to declare variables before you use them so that Seagate Crystal Reports is aware of them and understands how you intend to use them.

Example of a variable

If you wanted to report on customers by area code, you could create a variable that extracts the area code from a customer fax number. The following is an example of a variable called areaCode:

Dim areaCode As String
areaCode = Left ({Customer.Fax}, 3)
Rem could also use: areaCode = {Customer.Fax} (1 To 3)

The first line of the variable example is the variable declaration; it gives the variable a name and type. The database field {Customer.Fax} is a String field and the Left function extracts the first 3 characters from its current value. The variable areaCode is then assigned this value.


Variable declarations using Dim

Before using a variable in a formula, you must declare it. A variable can hold values of a given type. The allowed types are the seven simple types (Number, Currency, String, Boolean, Date, Time and DateTime), the six range types (Number Range, Currency Range, String Range, Date Range, Time Range and DateTime Range) and variables that hold arrays of the previously mentioned types. This gives a total of 26 different types that a variable can have. When you declare a variable, you also specify its name. A variable cannot have the same name as any function, operator or other keyword that is valid for Basic syntax. For example, your variable cannot be named Sin, Mod or If because Sin is a built in function, Mod is a built in operator and If is a built in keyword. When typing formulas in the formula editor, the names of the built-in functions, operators, and other keywords are highlighted in a different color. This makes it easy to check if the variable name conflicts.

Once a variable is declared, it can be used in the formula. For example, you might want to assign it an initial value:

Dim x As Number 'Declare x to be a Number variable
x = 10 'Assign the value of 10 to x


Variables can only hold values of one type

A variable can only hold values of one type. For example, if a variable holds a Number value you cannot later use it to hold a String.

Example
Dim y As String
y = "hello"
'OK - the Len function expects a String argument
formula = Len (y)
'Error- y can only hold String values
y = #Jan 5, 1993#
'Error- y can only hold String values
y = Array ("a", "bb", "ccc")
'Error- the Sin function expects a Number argument
formula = Sin (y)

You can declare more than one variable per statement by separating their declaration by commas:

Dim x As Number, y as String, z as DateTime Range
x = 10 : y = "hello"
z = #Jan 1, 1999# To #Jan 31, 1999#


Declaring variables without immediately specifying their type

In general, the type of a variable does not need to be explicitly given when declaring it. In such cases, the variable's type is determined by the first assignment that is made to it. This is similar to the special variable formula. This is different from in Visual Basic where a variable whose type is not given at declaration automatically has the Variant type. However, in practice, it means that you can write formulas in a similar style to what you would do if using a Variant in Visual Basic.

Dim p 'The type of p is not known yet
p = "bye" 'The type of p is now set to be String
Dim q 'The type of q is not known yet
q = Array ("hello", p) 'q is a String Array
'Error- p is a String variable and cannot hold a Number
p = 25
Dim r
'r is a Number variable, and holds the value 5
r = (10 + 5) / 3
'The types of a and c are not known yet
Dim a, b As Boolean, c
b = False
'The type of a is now set to Boolean
'and its value is False
a = b
'The type of c is now set to Number and its value is 17
c = 2 + 3 * 5
Examples of declaring and initializing range variables

Dim gradeA, quarter
'The type of gradeA is set to Number Range
gradeA = 90 To 100
'The type of quarter is set to Date Range
quarter = CDate (1999, 10, 1) To CDate (1999, 12, 31)

Variable Scope

Variable scopes are used to define the degree to which variables in one formula are made available to other formulas. There are three levels of scope in Seagate Crystal Reports: local, global and shared. Every variable has a scope, and this scope is specified when the variable is declared.

Local Variables

Variables with local scope, also known as local variables, are declared using either the Dim or Local keywords. For example, all the declarations in the previous section using Dim were declaring local variables. Another example:

Local x As Number 'equivalent to Dim x As Number

Local variables are restricted to a single formula and a single evaluation of that formula. This means that you cannot access the value of a local variable in one formula from a different formula.

Example
Rem Formula A
Local x as Number
x = 10
formula = x
Rem Formula B
EvaluateAfter ({@Formula A})
Local x as Number
formula = x + 1

The function call EvaluateAfter ({@Formula A}) ensures that Formula B will be evaluated after Formula A is evaluated. Formula A returns a value of 10 and Formula B returns a value of 1. Formula B does not have access to Formula A's x and thus cannot use the value of 10 and add 1 to it; instead, it uses the default value for the uninitialized local variable x found in Formula B, which is 0, and adds 1 to it to get 1.

You can also create local variables with the same name but different types in different formulas. For example, the type declarations in formulas A and B do not conflict with:

Rem Formula C
Local x as String
x = "hello"
formula = x

Local variables are the most efficient of the three scopes. In addition, they do not interfere with one another in different formulas. For these reasons, it is best to declare variables to be local whenever possible.


Global variables

Global variables use the same memory block to store a value throughout the main report. This value is then available to all formulas that declare the variable, except for those in subreports. Declare a global variable as in the following example:

Global y As String

Since global variables share their values throughout the main report, you cannot declare a global variable in one formula with one type and then declare a global variable with the same name in a different formula with a different type.

Example
Rem Formula A
Global z As Date
z = CDate (1999, 9, 18)
formula = 10
Rem Formula B
Global z As Number
formula = True

In this case, if you enter and save Formula A first, Seagate Crystal Reports will return an error when you check or try to save Formula B. This is because the declaration of the Global variable z as a Number conflicts with its earlier declaration in Formula A as a Date.

Using Global variables

Global variables are often used to perform complex calculations where the results of a formula depend upon the grouping and page layout of the actual printed report. This is accomplished by creating several formulas, placing them in different sections of the report, and having the different formulas interact via global variables.

Here is an example of the sort of effects that can be produced:

Rem Formula C
Global x as Number
x = 10
formula = x
Rem Formula D
'call the function WhileReadingRecords
WhileReadingRecords
Global x as Number
x = x + 1
formula = x

If Formula C is placed in the Report Header and then Formula D is placed in a detail section, Formula C will be evaluated before Formula D. Formula C will be evaluated once and then Formula D will be evaluated for each record appearing in the detail section. Formula C returns 10. For the first detail record, Formula D returns 11. This is because the value 10 of x is retained from when it was set by Formula C. Formula D then adds 1 to this value, setting x to 11 and then returns 11. For the second detail record, formula D return 12, adding 1 to the previously retained value of x which was 11. This process continues for the remaining detail records.

The call to WhileReadingRecords tells Seagate Crystal Reports to re-evaluate Formula D as it reads in each record of the report. Otherwise, since the formula does not contain any database fields, the program will evaluate it only once before reading the records from the database. The formula will then return the value 11 instead of 11, 12, 13, ... as the successive records are processed.

If the statement x = x + 1 is replaced by x = x + {Orders Detail.Quantity}, you create the effect of a running total based on {Orders Detail.Quantity}, although it is one starting at 10 rather than 0 because of Formula C. In this case, you can omit the call to WhileReadingRecords, since it will automatically occur because the formula contains a database field.


Shared variables

Shared variables use the same memory block to store the value of a variable throughout the main report and all of its subreports. Thus shared variables are even more general than global variables. To use a shared variable, declare it in a formula in the main report as in the following example:

Shared x As Number
x = 1000

and declare it in a formula in the subreport as in the following example:

Shared x as Number

In order to use shared variables the variable must be declared and assigned a value before it can be passed between the main report and the subreport.


Declaring array variables

There are several different ways of declaring array variables. The first way is to use empty parentheses and explicitly specify the type of the array:

'Declare x to be a Global variable
'of Number Array type
Global x () As Number
'Initialize x
x = Array (10, 20, 30)
'Declare y to be a Shared variable
'of String Range Array type
Shared y () As String Range
'Initialize y
y = Array ("A" To "C", "H" To "J")

The second way is to declare the variable without specifying that it is an array and without giving its type and waiting for the first assignment to the variable to completely specify its type:

'Declare y to be a Local variable
'but do not specify its type
Dim y
'The type of y is now set to be a String Array
y = Array ("Sun", "Mon", "Tue", "Wed", "Th", _
           "Fri", "Sat")

The third way is to declare that the variable is an array but not specify its type fully until the first assignment. Assuming the declaration of y above:

'Declare z to be a Local variable that is an Array
Local z()
'z is set to Array ("Mon", "Tue") and is a String Array
z = y(2 to 3)

The fourth way is to explicitly specify the size of the array during the declaration. If you use this technique, the array is automatically created and default values are used to fill the array. For example, for a Number Array, each element is initialized to 0 and for a String array each element is initialized to the empty string "". Since this type of declaration actually creates the array, you must specify its type with the As clause so that Seagate Crystal Reports knows how much storage space to reserve for the array.

Dim a(2) As String
'Assign a value to the first element of the array a
a(1) = "good"
a(2) = "bye"

'The & operator can be used to concatenate strings

'the formula returns the String "goodbye"
formula = a(1) & a(2)
Arrays and For/Next loops

Arrays are commonly used with For/Next loops. The following example creates and then uses the array Array (10, 20, 30, ..., 100) using a For/Next loop. See For/Next loops for more details.

Dim b (10) As Number
Dim i
For i = 1 To 10
   b(i) = 10 * i
Next i
formula = b(2) 'The formula returns the Number 20

Several variables can be declared in a single statement by separating their declarations with commas:


Using array variables

You can assign values to elements of an array and also use the values of the elements for other computations:

Global x() As String
x = Array ("hello", "bye", "again")
'Now x is Array ("hello", "once", "again")
x (2) = "once"
'The statement below would cause an error if not
'commented out since the array has size 3
'x (4) = "zap"
'The formula returns the String "HELLO"
formula = UCase (x (1))

The Redim and Redim Preserve keywords can be used to resize an array, which is useful if you want to add extra information to it. Redim erases the previous contents of the array first before resizing it whereas Redim Preserve preserves the previous contents.

Dim x () As Number
Redim x (2) 'Now x is Array (0, 0)
x (2) = 20 'Now x is Array (0, 20)

Redim x (3) 'Now x is Array (0, 0, 0)

x (3) = 30 'Now x is Array (0, 0, 30)
Redim Preserve x (4) 'Now x is Array (0, 0, 30, 0)
formula = "finished"


Default values for the simple types

An uninitialized variable will have the default value for its type. In general, it is not a good programming practice to rely on the default values of types. For example, initialize all local variables in your formula, initialize all global variables in a formula placed in the Report Header, and initialize all shared variables in a formula placed in the Report Header of the main report.

When an array is resized using the Redim keyword, the entries are filled with default values for the type.

Default values

Number
0
Currency

CCur (0)

String
"" 'The empty string
Date

CDate (0, 0, 0) 'The null Date value

Time

The null Time value. Value held by an uninitialized Time variable.

DateTime

The null DateTime value. Value held by an uninitialized DateTime variable.

Note: It is not recommended that your formulas rely on the values of uninitialized range or array variables.


Automatic type conversions

Generally in Seagate Crystal Reports, values of one type cannot be used where values of another type are expected without explicitly supplying a type conversion function. For example:

Dim postalCode as String
'Error- assigning a Number value to a String variable
postalCode = 10025
'OK- use the type conversion function CStr
'to create "10025"
postalCode = CStr (10025, 0)

However, there are a few conversions that are made automatically:

  • Number to Currency
  • Date to DateTime
  • Simple type to Range value of the same underlying simple type

For example, the following assignments are correct:

Dim cost As Currency
'Same as: cost = CCur (10)
cost = 10
Dim orderDate As DateTime
'Same as: orderDate = CDateTime (1999, 9, 23, 0, 0, 0)
orderDate = CDate (1999, 9, 23)
Dim aRange As Number Range
'Same as: aRange = 20 To 20
aRange = 20
Dim aRangeArray () As Number Range
'Same as :
'aRangeArray = Array (10 To 10, 20 To 25, 2 To 2)
aRangeArray = Array (10, 20 To 25, 2)

Note: The opposite conversions are not allowed. For example:

Dim num As Number
num = 5 + CCur (10) 'Error
'OK- convert to Number type using the CDbl function
num = CDbl (5 + CCur (10))

5 is converted to CCur (5) and added to CCur (10) to make CCur (15). However, this Currency value cannot be automatically assigned to the Number variable num since automatic conversions from Currency to Number are not allowed. Similarly, functions accepting a Currency argument can be supplied a Number argument instead, and the Number argument will be converted to a Currency, whereas functions accepting a Number argument cannot be supplied a Currency argument without first explicitly converting the Currency to a Number using CDbl.


Functions

When using a function in a formula, type the name of the function and supply the arguments required. For example, the Len function requires a String argument and computes the length of the string.

Dim x As String
x = "hello"
formula = Len (x) 'The formula returns the Number 5

Supplying arguments of the incorrect type required by the function produces an error. For example, calling Len (3) would produce an error since Len does not accept a Number argument. Functions sometimes can accept different numbers of arguments or types of arguments. For example, the CDate function could accept a single String argument to form a Date value or 3 Number values holding the year, month and day respectively and form a Date value from them. See Date, Time, and DateTime.

Example with the Mid function
Dim x as String
x = "hello"
'Start at position 2, go to the end of the string
formula = Mid (x, 2) 'formula is now "ello"
'Start at position 2, extract 1 character
formula = Mid (x, 2, 1) 'formula is now "e"

The classes of functions are: Math, Summary, Financial, String, Date/Time, Date Range, Array, Type Conversion, Programming Shortcuts, Evaluation Time, Print State, Document Properties and Additional Functions. There are also some functions specific to conditional formatting formulas.


Functions similar to Visual Basic functions of the same name

The Math, Financial, String, Date/Time, Type Conversion and Programming Shortcuts groups consist mainly of functions that are familiar to Visual Basic users. Most of the functions are intended to work in the same way as the Visual Basic function of the same name.

Note:

  • Sometimes functions will have more overloads than are available in Visual Basic.

    For example, the CDate function supports the Visual Basic overload of creating a Date value from a String value, such as CDate ("Sept 18, 1999") but it also supports an overload of creating a Date value by supplying the year, month and day as Number arguments e.g. CDate (1999, 9, 18). The overloads are indicated in the Functions tree.

  • Some functions that are supported by Basic syntax are not listed in the Basic syntax Functions tree. This is because they are equivalent to Basic syntax functions that are already listed in the tree.

    For example, the Len function is the normal Basic syntax and Visual Basic function for finding the length of a string. However, the Length function is listed in the Functions tree and works the same as the Len function. Length is the traditional Crystal syntax function for this action and it is included for the convenience of Crystal syntax users migrating formulas to Basic syntax.


Summary functions

The Summary function group provides functions for creating summary fields such as:

Sum({Orders.Order Amount}, {Orders.Ship Via})

Summary fields are normally created using the Insert Summary or Insert Grand Total dialogs. They then appear in the Report Fields tree, and can be used in a formula by double clicking there. However, they do not need to be created in this way. You can create a summary field exclusively for use by your formula by filling in the arguments to one of the functions in the Summary functions section. However, any groups that refer to summary fields must already exist in the report.


Date ranges

For additional information refer to Range data types.

Date ranges produced by these functions depend on the current date. For example, if today's date is September 18, 1999, then LastFullMonth is the Date Range value:

CDate(#Aug 1, 1999#) To CDate(#Aug 31, 1999#)

This functionality is often useful, but if you want to determine a date range based on a database field such as {Orders.Order Date}? The Date/Time functions can be used instead.

Example
Dim d As Date
d = CDate ({Orders.Order Date})
Dim dr As Date Range
dr = DateSerial (Year(d), Month(d) - 1, 1) To _
     DateSerial (Year(d), Month(d), 1 - 1)
'At this point dr is the Date Range value holding
'the last full month before {Orders.Order Date}

The DateSerial function makes this easy because you don't have to worry about special cases. It never lets you create an invalid date. For example, DateSerial (1999, 1 - 1, 1) is December 1, 1998. Note that in the above example, {Orders.Order Date} is actually a DateTime field and so the CDate function is used to convert it to a date by truncating the time part.


Array functions

The array functions compute summaries of an array's elements. For example, the Sum function when applied to an array returns the sum of the elements of the array.

Example

The following formula returns 100:

formula = Sum (Array (10, 20, 30, 40))


Evaluation Time functions

These are the report specific functions: BeforeReadingRecords, WhileReadingRecords, WhilePrintingRecords and EvaluateAfter. You can use these functions to guide Seagate Crystal Reports as to when your formula should be evaluated.

Should the formula be evaluated before retrieving the records from the database, while reading the records from the database but before the records have been grouped, sorted and summarized, or while printing the report, when the records are grouped, sorted and summarized? In general, Seagate Crystal Reports sets an appropriate evaluation time for your formula, based on how much information the formula needs. For example, if a formula uses a database field, then it cannot be evaluated before the records are read from the database. However, you sometimes need to force a later evaluation time than normal to get the desired effect. See Using Global variables for an example.

Normally, the returned value of a function is used further in a formula. However, evaluation time functions are called to change the internal behavior of Seagate Crystal Reports and their return value is not used. They can be called by just placing their name in a separate statement, optionally preceded by the keyword Call.

WhilePrintingRecords
Call WhilePrintingRecords


Print State functions

These are once again reporting-specific functions. For example, the notation {Orders.Order Date} refers to the value of the field in the current record where PreviousValue ({Orders.Order Date}) refers to the value in the immediately preceding record. NextValue ({Orders.Order Date}) refers to the value in the next record. IsNull ({Orders.Order Date}) checks if the field's value is null.

Other examples are PageNumber and TotalPageCount. These can be used to access pagination information about your report.


Document Properties functions

These are reporting specific functions that refer to the report document as a whole. For example, PrintDate and ReportTitle.


Additional functions

These are functions that are in User Function Libraries (UFLs). A UFL is a separate dynamic link library or Automation server that you create and Seagate Crystal Reports uses to add your own customized functions to the formula language. Writing a UFL is more involved than writing a formula using Basic or Crystal syntax. See Seagate Crystal Reports Developer's Help for more information.

Note: Using UFLs makes your reports less portable because you must distribute your UFL along with the report.


Conditional formatting functions

When writing a conditional formatting formula, you may want to use the additional functions that appear at the top of the Functions tree.

Example

If you wanted to format the {Customer.Last Year's Sales} field so that sales of more than $100,000 are printed in green and sales of less than $15,000 are printed in red and all else are printed in black.

Rem Conditional formatting example 1
If {Customer.Last Year's Sales} > 100000 Then
   formula = crGreen
ElseIf {Customer.Last Year's Sales} < 15000 Then
   formula = crRed
Else
   formula = crBlack
End If

Since this is a font color formatting function, the list of Color Constants appears in the Functions tree. This example uses three: crGreen, crRed and crBlack. You could have used the actual numeric values of the color constants instead. For example, crRed is 255 and crGreen is 32768. However, the formula is easier to understand using the color constants. All constant functions in Basic syntax have the "cr" prefix.

Note: Some formatting attributes do not use constant functions. For example, if you wanted to not print {Customer.Last Year's Sales} values if the sales were less than $50,000, you could write the following conditional formatting formula for the suppress attribute:

Rem Conditional formatting example 2
If {Customer.Last Year's Sales} < 50000 Then
   formula = True 'suppress the value
Else
   formula = False 'do not suppress the value
End If

Or more simply:

Rem Conditional formatting example 3 -
Rem equivalent to example 2
formula = {Customer.Last Year's Sales} < 50000

If the last year's sales are less than $50,000, then the expression

{Customer.Last Year's Sales} < 50000

is True, and so the formula returns True. On the other hand, if the last year's sales are greater than or equal to $50,000, then

{Customer.Last Year's Sales} < 50000

is False and so the formula returns False.


General purpose conditional formatting functions

There are three general purpose conditional formatting functions:

  • CurrentFieldValue
  • DefaultAttribute
  • GridRowColumnValue.

These functions are displayed at the top of the Functions tree when appropriate. DefaultAttribute can be used for any formatting formula. CurrentFieldValue can be used for any formatting formula where you are formatting a field value. GridRowColumnValue can be used for formatting a formula where you are formatting a field value in a Cross-Tab or OLAP grid.

CurrentFieldValue enables you to conditionally format Cross-Tab or OLAP grid cells based on their value. GridRowColumnValue enables you to conditionally format the cells of a Cross-Tab or OLAP grid based on row or column headings values. These two functions are essential in some situations as there is no other way in the formula language to refer to these fields.

Example

If you wanted Cross-Tab cells to be suppressed if the values are less than 50,000:

Rem Conditional formatting example 4
formula = CurrentFieldValue < 50000


Operators

Arithmetic operators

The arithmetic operators are addition (+), subtraction (-), multiplication (*), division (/), integer division (\), modulus (Mod), negation (-) and exponentiation (^). Arithmetic operators are used to combine numbers, numeric variables, numeric fields and numeric functions to get another number.

Examples
'Outstanding preferred stock as a percent of
'common stock
formula = ({Financials.Preferred Stock} / _
           {Financials.Common Stock}) * 100
'The square root of 9, Sqr(9), is 3.
'The formula returns 17.
formula =  7 + 2 * 3 - 2 + Sqr(6 + 3) * Len("up")


Order of precedence

When you create arithmetic expressions that involve several operators, the order that the program evaluates the various elements of the expression becomes important.

In general, the program evaluates expressions in the following order:

  • from left to right
  • follows the rules of precedence from basic math.
Example

Multiplication and division are performed first from left to right. Then addition and subtraction are performed. For example, 5 + 10 * 3 = 5 + 30 = 35.

You can change this order of precedence by using parentheses. For example, (5 + 10) * 3 = 15 * 3 = 45. If you are unsure of the order of precedence, it is a good idea to clarify your intentions with parentheses.

The arithmetic operators in Seagate Crystal Reports have the same order of precedence as in Visual Basic. Here is the list, from highest precedence to lowest:

  • Exponentiation (^)
  • Negation (-)
  • Multiplication and division (*, /)
  • Integer Division (\)
  • Modulus (Mod)
  • Addition and subtraction (+, -)


Comparison operators

The comparison operators are equal (=), not equal (<>), less than (<), less than or equal to (<=), greater than (>) and greater than or equal to (>=).

Comparison operators are usually used to compare operands for a condition in a control structure such as an If statement. Comparison operators as a group all have lower precedence than the arithmetic operators. For example, expressions like 2 + 3 < 2 * 9 are the same as (2 + 3) < (2*9).

Boolean operators

The Boolean operators are, in order of precedence from greatest to lowest: Not, And, Or, Xor, Eqv and Imp. Boolean operators are typically used with comparison operators to generate conditions for control structures. Boolean operators as a group have lower precedence than the comparison operators. Thus for example, the expression 2 < 3 And 4 >= -1 is the same as (2 < 3) And (4 >= -1).


Null fields and how to use IsNull

The {Product.Color} field contains both basic colors such as "red" and "black" and more descriptive two word colors such as "steel satin" and "jewel green". Here's an example of a formula that writes out "basic" for the basic colors and "fancy" for the others.

If InStr({Product.Color}, " ") = 0 Then
    formula = "basic"
Else
    formula = "fancy"
End If

The function call to InStr searches the {Product.Color} string for a space. If it finds a space, it returns the position of the space, otherwise it returns 0. Since basic colors are only one word with no spaces, InStr will return 0 for them.


Dealing with null values

For some products, such as the Guardian Chain Lock, a color value was not recorded and so the {Product.Color} field has a null value in the database for that record. In general, when Seagate Crystal Reports encounters a null valued field in a formula, it immediately stops evaluating the formula and produces no value. Thus, the Guardian Chain Lock record does not have any word printed beside it. If you want to handle null field values in your formula, you must explicitly do so using one of the special functions designed for handling them: IsNull, PreviousIsNull or NextIsNull. Here is an example of how to fix the above example using IsNull:

If IsNull({Product.Color}) Or _
   InStr({Product.Color}, " ") = 0 Then
   formula = "basic"
Else
   formula = "fancy"
End If

Relating to operators, when Seagate Crystal Reports evaluates the condition:

IsNull({Product.Color}) Or _
InStr({Product.Color}, " ") = 0

It first evaluates IsNull ({Product.Color)), and when it determines that this is True, it knows that the whole condition is True, and does not need to check whether

InStr({Product.Color}, " ") = 0.

In other words, Seagate Crystal Reports will stop evaluating a Boolean expression when it can predict the results of the whole expression. In the following example, the formula guards against attempting to divide by zero in the case that denom is 0:

Dim num As Number, denom As Number
...
If denom <> 0 And num / denom > 5 Then
...

Note: Visual Basic does not support this technique, since all parts of a Boolean expression in Visual Basic are evaluated, even if not necessary.


Control structures

Formulas without control structures execute each statement in the formula only once. When this happens the formula is evaluated. The statements are executed in a sequential fashion, from the first statement in the formula to the last. Control structures enable you to vary this rigid sequence. Depending upon which control structure you choose, you can skip over some of the statements or repeatedly evaluate some statements depending on certain conditions. Control structures are the primary means of expressing business logic and typical report formulas make extensive use of them.

Basic syntax supports many of the main control structures from Visual Basic with the same syntax. One of the advantages of the Basic language is it is easy to read block notation for control structures. This simplifies the writing and debugging of complex formulas.


If statements

The If statement is one of the most useful control structures. It enables you to evaluate a sequence of statements if a condition is true and evaluate a different sequence of statements if it is not true.

Example

A company plans to pay a bonus of 4 percent to its employees except for those who work in Sales who will receive 6 percent. The following formula using an If statement would accomplish this:

Rem Multi-line If example 1
If {Employee.Dept} = "Sales" Then
   formula = {Employee.Salary} * 0.06
Else
   formula = {Employee.Salary} * 0.04
End If

In this example, if the condition {Employee.Dept} = "Sales" evaluates as true, then the

formula = {Employee.Salary} * 0.06

statement is processed. Otherwise the statement following the Else, namely the

formula = {Employee.Salary} * 0.04

is processed.

Suppose another company wants to give employees a 4% bonus, but with a minimum bonus of $1,000. The following example shows how. Notice that the Else clause is not included; it is optional, and not needed in this case.

Rem Multi-line If example 2
formula = {Employee.Salary} * 0.04
If formula < 1000 Then
   formula = 1000
End If

Now suppose that the previous company also wants a maximum bonus of $5,000. You now need to use an ElseIf clause. Notice that ElseIf is all one word. The following example has only one ElseIf clause, but you can add as many as you need.

Note: There is a maximum of one Else clause per If statement.

The Else clause is executed if none of the If or ElseIf conditions are true.

Rem Multi-line If example 3
formula = {Employee.Salary} * 0.04
If formula < 1000 Then
   formula = 1000
ElseIf formula > 5000 Then
   formula = 5000
End If
Example

Suppose that a company wants to compute an estimate of the amount of tax an employee needs to pay and write a suitable message. Income below $8,000 is not taxed, income between $8,000 and $20,000 is taxed at 20%, income between $20,000 and $35,000 is taxed at 29%, and income above $35,000 is taxed at 40%.

Rem Multi-line If example 4
Dim tax As Currency, income As Currency
income = {Employee.Salary}

Dim message As String

If income < 8000 Then
    tax = 0
    message = "no"
ElseIf income >= 8000 And income < 20000 Then
    message = "lowest"
    tax = (income - 8000)*0.20
ElseIf income >= 20000 And income < 35000 Then
    message = "middle"
    tax = (20000 - 8000)*0.20 + (income - 20000)*0.29
Else
    message = "highest"
    tax = (20000 - 8000)*0.20 + (35000 - 20000)*0.29 + _
        (income - 35000)*0.40
End If
Dim taxStr As String
Rem use 2 decimal places
Rem and use the comma as a thousands separator
taxStr = CStr (tax, 2, ",")
formula = "You are in the " & message & _
          " tax bracket. " & _
          "Your estimated tax is " & taxStr & "."

Notice, the use of variables to simplify the logic of the computation. Also, notice that there are two statements that are executed when one of the conditions are met; one assigns the tax variable, and the other assigns the message variable. It is often useful to have multiple statements executed as a result of a condition.


Single-line and multi-line If statements

There are two kinds of If statement, the single-line if statement and the multi-line if statement. Starting on a new line after the first Then turns your If statement into a multi-line If statement. Otherwise it is a single-line If statement. The multi-line If statement always includes an End If whereas the single line If statement does not.

Note: Because of the use of line-continuation characters, single-line If statements do not need to be on a single line. In general, it is preferable to use multi-line If statements since they have a clearer layout. However, for simple situations, the single-line If statement is sometimes used.

Rem Single-line If example 1
Rem Same result as multi-line If example 1
If {Employee.Dept} = "Sales" Then _
   formula = {Employee.Salary} * 0.06 _
Else _
   formula = {Employee.Salary} * 0.04

Here is an example showing various forms of single-line If statements:

Rem Single-line If example 2
Dim per As Number, extra As Boolean
per = 2 : extra = False
'An example with no Else clause
If {Employee.Dept} = "Sales" Then per = 10
'More than 1 statement in the Then or Else part can
'be included by separating them with colons
If {Employee.Dept} = "R&D" Then _
   per = 5 : extra = True _
Else _
   per = 3


Select statements

The Select statement is similar to an If statement. Sometimes however, you can write formulas that are clear and less repetitive using the Select statement. This example evaluates the {Customer.Fax} field to determine if the area code is for Washington state (206, 360, 509) or British Columbia, Canada (604, 250):

Rem Select example 1
Select Case Left ({Customer.Fax}, 3)
   Case "604", "250"
      formula = "BC"
   Case "206", "509", "360"
      formula = "WA"
End Select

The expression right after the Select Case keywords is called the Select condition. In the above example it is Left ({Customer.Fax}[1 To 3]). The Select statement tries to find the first Case that matches the Select condition, and then executes the statements following it, up until the next Case.

Rem Same effect as Select example 1
Dim areaCode As String
areaCode = Left ({Customer.Fax}, 3)
If areaCode In Array ("604", "250") Then
   formula = "BC"
ElseIf areaCode In Array ("206", "509", "360") Then
   formula = "WA"
End If
Example

This formula groups the number of Oscar nominations a movie received into low, medium, high or extreme categories and in the process, shows some of the possibilities for the expression lists following the Case labels. Notice the optional Case Else clause. If none of the Case expression lists are matched by the preceding Case clauses, then the Case Else clause is matched. For example, in the following example, if {movie.NOM} is 11, then the formula returns "extreme".

Rem Select example 2
Select Case {movie.NOM}
   Case 1,2,3, Is < 1
      Rem Can have multiple statements in the
      Rem statement blocks
      formula = "low"
   Case 4 To 6, 7, 8, 9
      formula = "medium"
   Case 10
      formula = "high"
   Case Else
      formula = "extreme"
End Select


For/Next loops

For/Next loops enable you to evaluate a sequence of statements multiple times. This is unlike the If and Select statements where the program passes through each statement at most once during the formula's evaluation. For/Next loops are best when you know the number of times that the statements needs to be evaluated in advance.

The syntax of the For loop through examples

Sample 1

Suppose you want to reverse the {Customer.Customer Name} string. For example, "City Cyclists" becomes "stsilcyC ytiC".

Rem Reverse a string version 1
formula = ""
Dim strLen
strLen = Len ({Customer.Customer Name})
Dim i
For i = 1 To strLen
   Dim charPos
   charPos = strLen - i + 1
   formula = formula & _
             Mid({Customer.Customer Name}, charPos, 1)
Next i

Let us examine how this formula works assuming that the current value of the field {Customer.Customer Name} is "Clean Air". The variable strLen is assigned to be the length of "Clean Air", namely 9. At this time it is also typed to be a Number variable. The variable i is known as a For counter variable since its value changes with each iteration of the For loop. In other words, it is used to count the iterations of the loop. The For loop will iterate 9 times, during the first time, i is 1, then i is 2, then i is 3 and so on until finally i = 9. During the first iteration, the ninth character of {Customer.Customer Name} is appended to the empty special variable formula. As a result formula equals "r" after the first iteration. During the second iteration, the eighth character of {Customer.Customer Name} is appended to formula and so formula equals "ri". This continues until after the ninth iteration, formula equals, "riA naelC" which is the reversed string.

Sample 2

Here is a simpler version of the above formula, that uses a Step clause with a negative Step value of -1. For the "Clean Air" example, i is 9 for the first iteration, 8 for the second, 7 for the third and so on until it is 1 in the final iteration.

Rem Reverse a string version 2
formula = ""
Dim i
For i = Len ({Customer.Customer Name}) To 1 Step -1
   formula = formula + _
             Mid({Customer.Customer Name}, i, 1)
Next i
Sample 3

The simplest version is to use the built in function StrReverse:

Rem Reverse a string version 3
formula = StrReverse ({Customer.Customer Name})

The built in String functions in Seagate Crystal Reports 8 can handle many of the string processing applications which would traditionally be handled using a For/Next loop or some other kind of loop. However, For/Next loops provide the most flexibility and power in processing strings and arrays. This can be essential if the built-in functions do not cover your intended application.


For/Next loop example

Here is a more detailed example of Seagate Crystal Reports' string processing capabilities. The Caesar cipher is a simple code that is traditionally credited to Julius Caesar. In this code, each letter of a word is replaced by a letter five characters further in the alphabet. For example, "Jaws" becomes "Ofbx". Notice that "w" is replaced by "b". Since there are not 5 characters after "w" in the alphabet, it starts again from the beginning.

Here is a formula that implements applying the Caesar cipher to the field {Customer.Customer Name} in the Xtreme database:

Rem The Caesar cipher

Dim inString 'The input string to encrypt
inString = {Customer.Customer Name}
Dim shift
shift = 5

formula = ""

Dim i
For i = 1 To Len(inString)
   Dim inC, outC
   inC = Mid(inString, i, 1)
   Dim isChar, isUCaseChar
   isChar = LCase(inC) In "a" To "z"
   isUCaseChar = isChar And (UCase (inC) = inC)

   inC = LCase(inC)

   If isChar Then
      Dim offset
      offset = (Asc(inC) + shift - Asc("a")) Mod _
               (Asc("z") - Asc("a") + 1)
      outC = Chr(offset + Asc("a"))
      If isUCaseChar Then outC = UCase(outC)
   Else
      outC = inC
   End If
   formula = formula & outC
Next i

In the above example, there is a multi-line If statement nested within the statements block of the For/Next loop. This If statement is responsible for the precise details of shifting a single character. For example, letters are treated differently from punctuation and spaces. In particular, punctuation and spaces are not encoded. Control structures can be nested within other control structures and multiple statements can be included in the statement block of a control structure.


Using the Exit For statement

You can exit from a For/Next loop by using the Exit For statement. The following example searches the Global array names for the name "Fred". If it finds the name, it returns the index of the name in the array. Otherwise it returns -1. For example, if the names array is

Array ("Frank", "Helen", "Fred", "Linda")

Then the formula returns 3.

Global names () As String
'The names array has been initialized and filled
'in other formulas
Dim i
formula = -1
'The UBound function returns the size of its array
'argument
For i = 1 to UBound (names)
   If names (i) = "Fred" Then
      formula = i
      Exit For
   End If
Next i

Do Loops

Another looping mechanism is the Do loop. A Do loop can be used to execute a fixed block of statement an indefinite number of time.

The 4 different types of Do loops
Type of Do Loop Explanation Example

Do While ... Loop

The Do While ... Loop evaluates the condition, and if the condition is true, then it evaluates the statements following the condition.

When it has finished doing this, it evaluates the condition again and if the condition is true, it evaluates the statements again.

It continues repeating this process until the condition is false.

Do While condition
   statements
Loop

Do Until ... Loop

The Do Until ... Loop is similar to the Do While ... Loop except it keeps evaluating the statements until the condition is true rather than while it is true.

Do Until condition
   statements
Loop

Do ... Loop While

The Do ... Loop While evaluates the statements only once.

It then evaluates the condition, and if the condition is true, evaluates the statements again. This process continues until the condition is false.

Do
   statements
Loop While condition

Do ... Loop Until

Similar to Do ... Loop While except that it evaluates the statements until the condition is true.

Do
   statements
Loop Until condition

Note: The Do loops support an Exit Do statement to immediately jump out of the loop. The Exit Do statement is similar to the Exit For in For/Next loops.


Do While ... Loop formula example

The following example searches for the first occurrence of a digit in an input string. If a digit is found, it returns its position, otherwise it returns -1. In this case, the input string is set explicitly to a string constant. If preferred, it could be set to be equal to a String type database field instead.

For example, for the input String, "The 7 Dwarves", the formula returns 5, which is the position of the digit 7.

Dim inString
inString = "The 7 Dwarves"
Dim i, strLen
i = 1
strLen = Len (inString)
formula = -1
Do While i <= strLen And formula = -1
   Dim c As String
   c = Mid (inString, i, 1)
   If IsNumeric (c) Then formula = i
   i = i + 1
Loop


While loops

The While loop is similar to the Do While ... Loop except that it does not support an Exit statement. It uses While ... Wend instead of Do While ... Loop as its syntax.

While condition
   statements
Wend


Safety mechanism for loops

There is a safety mechanism to prevent report processing from hanging due to an infinite loop. Any one evaluation of a formula can have at most 30,000 loop condition evaluations per formula evaluation. For example:

Dim i
i = 1
Do While i <= 100000
   If i > {movie.STARS} Then Exit Do
   i = i + 1
Loop
formula = 20

If {movie.STARS} is greater than 30,000 then the loop condition (i <= 100000) will be evaluated more than the maximum number of times and an error message is displayed. Otherwise the loop is OK.

Note: The safety mechanism applies on a per formula base, not for each individual loop. For example:

Dim i
i = 1
For i = 1 To 10000
   formula = Sin (i)
Next i
Do While i <= 25000
   i = i + 1
Loop

The above formula also triggers the safety mechanism since the 30,000 refers to the total number of loop condition evaluations in the formula and this formula will have 10001 + 25001 such evaluations.


Limitations

For reference purposes, here are the sizing limitations of the formula language:

  • The maximum length of a String constant, a String value held by a String variable, a String value returned by a function or a String element of a String array is 254 bytes.
  • The maximum size of an array is 1000 elements.
  • The maximum number of arguments to a function is 1000. (This applies to functions that can have an indefinite number of arguments such as Choose).
  • The maximum length of the text of a formula is 64K.
  • The maximum number of loop condition evaluations per evaluation of a formula is 30,000. (See safety mechanisms for loops for the precise meaning of this).
  • Date-time functions modeled on Visual Basic accept dates from year 100 to year 9999. Traditional Seagate Crystal Reports functions accept dates from year 1 to year 9999.


Creating Formulas with Crystal Syntax

This section provides you with an overview of various parts of a formula. You learn about Crystal syntax and the techniques you can use when creating a formula.


Crystal syntax overview

When creating formulas, you have the option of using either Crystal or Basic syntax. Syntax rules are used to create a correct formula. Almost any formula written with one syntax can be written with the other. Reports can contain formulas that use Basic syntax as well as formulas that use Crystal syntax. For information on whether to use Crystal or Basic syntax, see Formula syntax.


What's new in Crystal syntax

Many new features have been added to Crystal syntax for Seagate Crystal Reports Version 8.

Note: Equivalent versions of these features are also supported by Basic syntax.

New control structures

Crystal syntax supports three new controls structures: the Select expression, the While loop, and the For loop. Select is a good alternative to the If expression when you want to use the result of a single expression to select from a number of alternatives. The While and For loops introduce looping into Seagate Crystal Reports. Looping is useful when you want to evaluate some expressions in your formula multiple times. A typical application is to extract information from string database fields for custom formatting in a report. In this case, you loop through the characters of the string field.


New functions inspired by Visual Basic

These new functions are intended to work like their counterparts in Visual Basic. However, you do not need to learn Visual Basic or Basic syntax to use them. They provide functionality that could be useful in many Crystal syntax formulas.

Math functions:

Atn, Cos, Exp, Int, Log, Pi, Rnd, Sin, Sgn, Sqr, Tan

Financial functions:

DDB, FV, IPmt, IRR, MIRR, NPer, NPV, Pmt, PPmt, PV, Rate, SLN, SYD

Programming shortcut functions:

Choose, IFF, Switch

Type conversion functions:

CBool, CCur, CDbl, CStr, CDate, CTime, CDateTime

Date and time functions:

DateValue, TimeValue, DateTimeValue, IsDate, IsTime, IsDateTime, MonthName, WeekdayName, DateAdd, DateDiff, DatePart, DateSerial, Timer, TimeSerial

Array and string functions:

Filter, Replace, Join, Split, UBound, InStrRev, StrReverse


New operators

Some new operators have been added to make writing expressions in Crystal syntax easier and more flexible.

Visual Basic style string concatenation: &

Integer division: \

Exponentiation: ^

Logical operators: Eqv, Imp, Xor

Modulus: Mod

Date-time literals: #Jan 3, 1999 10:20 am#


Expanded capabilities for array processing

Crystal syntax now supports the Redim and Redim Preserve keywords to enable you to resize arrays dynamically. It also supports the ability to assign values to an individual element of an array. In addition, Crystal syntax now uses more efficient algorithms to speed up operations with arrays.


More types of record selection formulas can be pushed down to the server

In particular, there is now support for pushing down a record selection formula that involves the IsNull function and the Or operator. For example, the following selection formulas can be pushed down:

{Orders.Order ID} < 1020 Or
{Orders.Order Amount} >= 1000
IsNull ({Customer.Region}) Or {Customer.Region} = "BC"

The formula language now also performs simplification of most constant and parameter expressions in formulas at compile time rather than formula evaluation time. What this means is that record selection formulas such as:

{date field} > CurrentDate - 3

{date field} In CDate ({?year parameter}, 6, 1) To
                CDate ({?year parameter}, 9, 30)

can be pushed down to the server since the expressions in italics are replaced by their values when the formula is compiled, and the resulting formula can then be converted to a SQL query.


Formula language support for new functionality specific to Seagate Crystal Reports

Conditional formatting of a cell value in a Cross-Tab or OLAP grid based on its row or column values is supported with the new GridRowColumnValue function. The new Percentage summaries are supported in the formula language with the PercentOfSum, PercentOfAverage, PercentOfMaximum, PercentOfMinimum, PercentOfCount and PercentOfDistinctCount functions. You can now use the formula language to conditionally format the font, font style, and font size of a field.


Crystal syntax fundamentals

The result of a formula

The result of a formula, or the value that is printed when the formula is placed in a report, is called the value returned by the formula. Every formula in Seagate Crystal Reports must return a value. For example, here is a simple Crystal syntax formula that returns a value of 10:

10

The value returned by a formula can be one of the seven simple data types supported. These are Number, Currency, String, Boolean, Date, Time, and DateTime.

Note: Seagate Crystal Reports also supports range types and array types, but these cannot be returned by a formula.

For example, suppose a company has a shipping policy in which orders over $1,000 are insured, but orders below that amount are not insured:

//A formula that returns a String value
If {Orders.Order Amount} >= 1000 Then
   "Insured shipping"
Else
   "Regular shipping"

The formula returns the text string value "Insured shipping" if the value of the database field {Orders.Order Amount} is greater than or equal to 1000; otherwise, it returns the text string value "Regular Shipping" otherwise.


Crystal syntax is not case-sensitive

For example, the keyword Then could equivalently be typed in as then or THEN. This is true of all variable names, functions, and keywords used in a Crystal syntax formula.

Note: The only exception to this rule is for strings. The string "Hello" is not the same as the string "hello".

Practice using the Xtreme sample database

Many of the examples in this section refer to the Xtreme sample database. This database is included with Seagate Crystal Reports.

Browse the Samples directory to find the Databases folder that contains the Xtreme database.


Comments

Formula comments are notes included with a formula to explain its design and operation. Comments do not print and they do not affect the formula, but they appear in the Formula Editor. You can use comments to explain the purpose of a formula or explain the steps involved in writing it.

Comments begin with two forward slashes (//) and are followed by the text of the comment. Everything that follows the slashes on the same line is treated as being part of the comment:

//This formula returns the string "Hello"
//This is another comment
"Hello" //Comments can be added at the end of a line
//Comments can occur after the formula text


Fields

Many of the fields used in the construction of a report can be referred to in your formulas. For example, database, parameter, running total, SQL expression, summary, and group name fields can all be used in a formula. You can also refer to other formula fields in your formula.

The easiest way to insert a field into your report is to double-click a field's name in the Report Fields tree. This ensures that the correct syntax for the field is used.

How fields appear in formulas

Database, parameter, formula, running total and SQL expression fields have their names surrounded by braces. Database field names are taken from the database. For example:

  • database field: {Employee.Last Name}

Parameter, formula, running total, and SQL expression field names are specified when the fields are created.

  • parameter fields also includes a question mark: {?my parameter field}
  • formula fields include an at sign: {@another formula }
  • running totals fields include a pound sign: {#my running total}
  • SQL expression fields include a percent sign: {%my SQL expression}

Summary and group name fields look like function calls. However, they are really shorthand notation for a report field.

  • sum summary field: Sum({Orders.Order Amount}, {Orders.Ship Via})
  • group name field: GroupName({Orders.Ship Via})


Sample formulas using fields

The formula in this example uses the Xtreme database. To find out how many days it takes to ship the product from the date when the order was placed, you can just subtract the ship date database field from the order date database field:

//A formula that uses database fields
{Orders.Ship Date} - {Orders.Order Date}

To find the total dollar amount of a given product that was ordered, multiply its unit price by the quantity ordered:

{Orders Detail.Unit Price} * {Orders Detail.Quantity}

To calculate a sale price of 80 percent of the original unit price:

{Orders Detail.Unit Price} * 0.80


Expressions

An expression is any combination of keywords, operators, functions, and constant values that result in a value of a given type. For example:

//An expression that evaluates to the Number value 25
10 + 20 - 5
//An expression that evaluates to the String value
//"This is a string."
"This is a string."

A Crystal syntax formula consists of a sequence of expressions. The value of the final expression is the value returned by the formula and what gets printed. Each expression must be separated from the previous expression by a semicolon (;).


Multiple expressions

Typically, each expression takes one line, but you can continue an expression onto the next line if you need more space.

The formula below consists of five expressions. It returns the Number value 25 since that is the value of the last expression in the formula.

Example
//Expressions example
//The first expression. Its value is the Number
//value 30
10 + 20;
//The second expression. Its value is the String
//"Hello World". It takes up two lines.
"Hello " +
"World";
//The third expression. Its value is of Number type
{Orders Detail.Quantity} * 2 - 5;
//The fourth expression. Its value is of String type
If {Orders Detail.Quantity} > 1 Then
   "multiple units"
Else
   "one unit";
//The fifth and final expression. Its value is the
//Number value 25
20 + 5

Placing a semicolon after the last expression in the formula is also allowed, but optional. For example, the above formula could have ended with:

20 + 5;

Some of the sample formulas in the preceding section do not have semicolons. This is because they consist of a single expression, and a semicolon is optional after the last expression. Many formulas in Crystal syntax can be written as a single expression.

Notice that there is no semicolon after the "multiple units" String. In fact, if you put a semicolon there, the program will report an error. This is because a semicolon separates expressions, and the

Else
   "one unit";

is not a separate expression. It does not stand alone apart from the If. In fact, it is an integral part of the If expression since it describes the value that the If expression will return under certain circumstances.

Note: The example is not a practical example because the first four expressions in the formula did not have any effect on the last expression.


How earlier expressions affect later expressions

The fact that a Crystal syntax formula is a sequence of expressions whose result is the value of the final expression is the most important concept in understanding Crystal syntax. This expression-based syntax allows you to write very short formulas with a lot of functionality.

Example
//First expression. It declares the Number variable x
//and then returns the value of an uninitialized
//Number variable, which is 0.
NumberVar x;
//Second expression. It assigns the value of 30 to x,
//and returns 30.
x := 30

The above formula would give an error if the first expression were omitted. This is because the second expression refers to the Number variable x, and the program needs to have x declared before it understands expressions
involving it.

In general, you use variables to get the earlier expressions in a formula to affect the final expression. See Variables for more information.


Using the If expression

The If expression is one of the most widely used features of Crystal syntax. It also provides insight into the nature of expressions. Consider the earlier If expression as a separate formula. Notice that because this formula is a single expression, it does not need a semicolon:

If {Orders Detail.Quantity} > 1 Then
   "multiple units"
Else
   "one unit"

Suppose you wanted to modify this formula so that it either prints "multiple units" or the number 1.

//An erroneous formula
If {Orders Detail.Quantity} > 1 Then
   "multiple units"
Else
   1

This formula will result in an error. This is because the values in this expression are different types: "multiple units" is a String value and 1 is a Number value. Seagate Crystal Reports requires that the value of an expression always be of a single type.

Note: This example can be corrected by using the CStr function to convert the Number 1 to a String value. For example, the Number 1 is converted to the string "1" by calling CStr (1, 0).

//A correct formula
If {Orders Detail.Quantity} > 1 Then
   "multiple units"
Else
   CStr (1, 0) //Use 0 decimals

See Control structures for more information on the If expression.


Assignment

The assignment operator is a colon followed by an equals sign (:=).

Example
//Assign the Number value of 10 to the variable x
x := 10;
//Assign the String value of "hello" to the
//variable named greeting
greeting := "hello";

The equality operator (=) is used to check when two values are equal. A common error is to use the equality operator when the assignment operator is actually intended. This can generate a mysterious error message or no error message at all since it is often syntactically correct to use the equality operator. For example:

greeting = "hello";

The above formula checks if the value held by the variable greeting is equal to the value "hello". If it is, then the expression's value is True, and if is not then the expression's value is False. In any case, it is a perfectly correct Crystal syntax expression (assuming that the greeting is a String variable).


Simple data types

The simple data types in Seagate Crystal Reports are Number, Currency, String, Boolean, Date, Time, and DateTime.

Number

Enter numbers without any comma separators or currency symbols (generally you would want to have formatted numbers appearing as the result of a formula and not in the formula itself).

Example
10000
-20
1.23


Currency

Use the dollar sign ($) to create a Currency value.

Example
$10000
-$20
$1.23

You can also use the CCur function. The initial C in CCur stands for convert and it can be used to convert Number values to Currency values:

CCur (10000)
CCur (-20)
CCur (1.23)


String

Strings are used to hold text. The text must be placed between double quotation marks (") or apostrophes (') and cannot be split between lines. If you want to include double quotation marks in a string delimited by double quotation marks, use two consecutive double quotation marks. Similarly, if you want to include an apostrophe in a string delimited by apostrophes, use two consecutive apostrophes.

Example
"This is a string."
"123"
"The word ""hello"" is quoted."
'This is also a string.'
'123'
'Last Year''s Sales'

If you use double quotes for the left side of the string, you must use double quotes on the right side. Similarly for apostrophes. The following example is incorrect:

'Not a valid string."

You can extract individual elements or substrings from a string by specifying the character position or a range of character positions. Negative values are allowed; they specify the position starting from the end of the string.

"hello" [2] //Equal to "e"
"hello" [-5] //Equal to "h"
"604-555-1234" [1 to 3] //Equal to "604"
"abcdef" [-3 to -1] //Equal to "def"

You can also extract substrings from a string using the Left, Right and Mid functions.


Boolean

The valid Boolean values are:

True
False

Note: Yes can be used instead of True and No instead of False.


Date, Time, and DateTime

The DateTime type can hold date-times, dates only, or times only and thus is rather versatile. The Date type holds dates only and the Time type holds times only. The Date and Time types are more efficient than the DateTime type, and so can be used in situations where the added functionality and flexibility of the DateTime type is not needed.

You can create DateTime values directly using the date-time literal construction, which is formed by typing in the date-time between two pound (#) signs. Many different formats are supported.

Note: Date-time literals cannot be split between lines.

Examples
#8/6/1976 1:20 am#
#August 6, 1976#
#6 Aug 1976 13:20:19#
#6 Aug 1976 1:30:15 pm#
#8/6/1976#
#10:20 am#

Even though #10:20 am# looks like it could have the Time type and
#8/6/1976# looks like it could have the Date type, they do not. They both have the DateTime type, as do all date-time literals. For example, you can think of #10:20 am# as a DateTime value with a null date part. To convert it to the Time type use CTime (#10:20 am#).

Instead of using date-time literals, you can use CDateTime to convert a String to a DateTime. For example,

CDateTime ("8/6/1976 1:20 am")
CDateTime ("10:20 am")

However, there is one key difference between using date-time literals and the above usage of CDateTime. Date-time literals always use U.S. English date formats rather than settings from the locale of the particular computer on which Seagate Crystal Reports is running. Thus, the date-time literal examples above would work on all computers. On the other hand, on a French system, you could use constructions like:

CDateTime ("22 aout 1997") //Same as #Aug 22, 1997#

Date values can be constructed with CDate and Time values with CTime:

CDate ("Aug 6, 1969")
CDate (1969, 8, 6) //Specify the year, month, day
//Converts the DateTime argument to a Date
CDate (#Aug 6, 1969#)
CTime ("10:30 am")
CTime (10, 30, 0) //Specify the hour, minute, second
CTime (#10:30 am#)


Range data types

Ranges are designed to handle a spectrum of values. Range types are available for all the simple types except for Boolean. That is: Number Range, Currency Range, String Range, Date Range, Time Range and DateTime Range. You can generate ranges using the To, _To, To_, _To_, UpTo, UpTo_, UpFrom, and UpFrom_ keywords. In general, To is used for ranges with 2 endpoints, and UpTo and UpFrom are used for open ended ranges (only one endpoint). The underscores are used to indicate whether or not the endpoints are in the range.

Examples of Number Range values

The range of numbers from 2 to 5 including both 2 and 5

2 To 5

The range of numbers from 2 to 5, not including 2 but including 5

2 _To 5

All numbers less than or equal to 5

UpTo 5

All number less than 5

UpTo_ 5
Examples of DateTime Range values:
#Jan 5, 1999# To #Dec 12, 2000#
UpFrom #Jan 1, 2000#


Using ranges in formulas

There are twenty-seven functions in Seagate Crystal Reports that specify date ranges. For example, the function LastFullMonth specifies a range of date values that includes all dates from the first to last day of the previous month. So if today's date is September 15, 1999 then LastFullMonth is the same as the range value CDate (#Aug 1, 1999#) To CDate (#Aug 31, 1999#).

Ranges are often used with If or Select expressions. The following example computes student letter grades based on their test scores. Scores greater than or equal to 90 receive an "A", scores from 80 to 90, not including 90, receive a "B" and so on.

//Compute student letter grades
Select {Student.Test Scores}
   Case UpFrom 90 :
      "A"
   Case 80 To_ 90 :
      "B"
   Case 70 To_ 80 :
      "C"
   Case 60 To_ 70 :
      "D"
   Default :
      "F";

The above example uses the Select expression which is discussed in more detail in the control structures section. You can check if a value is in a range by using the In operator. For example:

5 In 2 To 10; //True
5 In 2 To_ 5; //False
5 In 2 To 5; //True

The Maximum and Minimum functions can be used to find the endpoints of a range:

Maximum (2 To 10) //Returns 10


Array data types

Arrays in Seagate Crystal Reports are ordered lists of values that are all of the same type. These values are known as the array's elements. The elements of an array can be any simple type or range type. Arrays can be created using square brackets ([ ]).

Examples

An array of 3 Number values. The first element is 10, the second is 5 and the third is 20.

[10, 5, 20]

An array of 7 String values:

["Sun", "Mon", "Tue", "Wed", "Th", "Fri", "Sat"]

An array of 2 DateTime Range values:

[#Jan 1, 1998# To #Jan 31, 1998#,
 #Feb 1, 1999# To #Feb 28, 1999#]

You can extract individual elements out of an array using square brackets containing the index of the element you want. This is called subscripting the array:

[10, 5, 20] [2] //Equal to 5

Number ranges can also be used to subscript arrays. The result is another array. For example:

[10, 5, 20] [2 To 3] //Equal to [5, 20]

Arrays are most useful when used with variables and so will be discussed in more detail in the Variables section. Using variables, you can change the individual elements of an array and resize the array to accommodate more elements. For example, you can accumulate database field values into a global array variable in a detail level formula, and then use a formula in a group footer to perform a calculation based on those values. This enables you to perform a wide variety of customized summary operations.


Variables

This section describes the key components of variables and shows you how to create variables and assign values to them.

Variables overview

A variable represents a specific data item, or value, and acts as a placeholder for that value. When a formula encounters a variable, the formula searches for the value of the variable and uses it in the formula. Unlike a constant value, which is fixed and unchanging, a variable can be repeatedly assigned different values. You assign a value to a variable and the variable maintains the value until you later assign a new value. Because of this flexibility, it is necessary for you to declare variables before you use them so that Seagate Crystal Reports is aware of them and understands how you intend to use them.

Example

If you wanted to report on customers by area code, you could create a variable that extracts the area code from a customer fax number. The following is an example of a variable called areaCode:

Local StringVar areaCode;
areaCode := {Customer.Fax} [1 To 3];

The first line of the variable example is the variable declaration; it gives the variable a name and type. The database field {Customer.Fax} is a String field and [1 To 3] extracts the first 3 characters from its current value. The variable areaCode is then assigned this value.


Variable declarations

Before using a variable in a formula, you must declare it.

A variable can hold values of a given type. The allowed types are the seven simple types (Number, Currency, String, Boolean, Date, Time and DateTime), the six range types (Number Range, Currency Range, String Range, Date Range, Time Range and DateTime Range) and variables that hold arrays of the previously mentioned types. This gives a total of 26 different types that a variable can have.

When you declare a variable, you also specify its name. A variable cannot have the same name as any function, operator or other keyword that is valid for Crystal syntax. For example, your variable cannot be named Sin, Mod or If because Sin is a built in function, Mod is a built in operator and If is a built in keyword. When typing formulas in the formula editor, the names of the built in functions, operators and other keywords are highlighted in a different color and so it is easy to check if the variable name conflicts.

Once a variable is declared, it can be used in the formula. For example, you might want to assign it an initial value:

Local NumberVar x; //Declare x to be a Number variable
x := 10; //Assign the value of 10 to x

Note: The keyword for declaring the Number variable has a Var at the end. This is true for all the variable types in Crystal syntax.

A variable can only hold values of one type. For example, if a variable holds a Number value, you cannot later use it to hold a String.

Example
Local StringVar y;
y := "hello";
//OK- the Length function expects a String argument
Length (y);
//Error- y can only hold String values
y := #Jan 5, 1993#;
//Error- y can only hold String values
y := ["a", "bb", "ccc"];
//Error- the Sin function expects a Number argument
Sin (y);

You can combine declaring a variable and assigning it a value in a single expression. For example:

Local NumberVar x := 10 + 20;
Local StringVar y := "Hello" + " " + "World";
Local DateVar z := CDate (#Sept 20, 1999#);
Local NumberVar Range gradeA := 90 To 100;

This is a good practice because it is more efficient and helps prevent the common mistake of having incorrectly initialized variables.

Here are some more examples of declaring and initializing range variables:

Local NumberVar Range gradeA;
Local DateVar Range quarter;
gradeA := 90 To 100;
quarter := CDate (1999, 10, 1) To CDate (1999, 12, 31);


Variable Scope

Variable scopes are used to define the degree to which variables in one formula are made available to other formulas. There are three levels of scope in Seagate Crystal Reports: local, global and shared. Every variable has a scope, and this scope is specified when the variable is declared.

Local Variables

Variables with local scope, also known as local variables, are declared using the Local keyword followed by the type name (with the Var suffix) followed by the variable name as in the above examples.

Local variables are restricted to a single formula and a single evaluation of that formula. This means that you cannot access the value of a local variable in one formula from a different formula.

Example
//Formula A
Local NumberVar x;
x := 10;
//Formula B
EvaluateAfter ({@Formula A})
Local NumberVar x;
x := x + 1;

The function call EvaluateAfter ({@Formula A}) ensures that Formula B will be evaluated after Formula A is evaluated. Formula A returns a value of 10 and Formula B returns a value of 1. Formula B does not have access to Formula A's x and thus cannot use the value of 10 and add 1; instead, it uses the default value for the uninitialized local variable x found in Formula B, which is 0, and adds 1 to it to get 1.

You can also create local variables with the same name but different types in different formulas. For example, the type declarations in formulas A and B do not conflict with:

//Formula C
Local StringVar x := "hello";

Local variables are the most efficient of the three scopes. They also do not interfere with one another in different formulas. For these reasons, it is best to declare variables to be local whenever possible.


Global variables

Global variables use the same memory block to store a value throughout the main report. This value is then available to all formulas that declare the variable, except for those in subreports. You declare a global variable as in the following example:

Global StringVar y;

You can also omit the Global keyword which creates a Global variable by default:

StringVar y; //Same as: Global StringVar y;

However, even though global variables are easy to declare, it is recommended that you use them only when local variables do not suffice.

Since global variables share their values throughout the main report, you cannot declare a global variable in one formula with one type and then declare a global variable with the same name in a different formula with a different type.

Example
//Formula A
Global DateVar z;
z := CDate (1999, 9, 18)
//Formula B
NumberVar z;
z := 20

In this case, if you enter and save Formula A first, Seagate Crystal Reports will return an error when you check or try to save Formula B. This is because the declaration of the Global variable z as a Number conflicts with its earlier declaration in Formula A as a Date.

Using Global variables

Global variables are often used to perform complex calculations where the results of a formula depend upon the grouping and page layout of the actual printed report. This is accomplished by creating several formulas, placing them in different sections of the report, and having the different formulas interact via global variables.

Example
//Formula C
Global NumberVar x;
x := 10;
//Formula D
//Call the function WhileReadingRecords
WhileReadingRecords;
Global NumberVar x;
x := x + 1

If Formula C is placed in the Report Header and then Formula D is placed in a detail section, Formula C will be evaluated before Formula D. Formula C will be evaluated once and then Formula D will be evaluated for each record appearing in the detail section. Formula C returns 10. For the first detail record, Formula D returns 11. This is because the value 10 of x is retained from when it was set by Formula C. Formula D then adds 1 to this value, setting x to 11 and then returns 11. For the second detail record, formula D return 12, adding 1 to the previously retained value of x which was 11. This process continues for the remaining detail records.

The call to WhileReadingRecords tells Seagate Crystal Reports to re-evaluate Formula D as it reads in each record of the report. Otherwise, since the formula does not contain any database fields, the program evaluates it only once before reading the records from the database. The formula will then return the value 11 instead of 11, 12, 13, ... as the successive records are processed.

If the expression x := x + 1 is replaced by x := x + {Orders Detail.Quantity}, you create the effect of a running total based on {Orders Detail.Quantity}, although it is one starting at 10 rather than 0 because of Formula C. In this case, you can omit the call to WhileReadingRecords, since it will automatically occur because the formula contains a database field.


Shared variables

Shared variables use the same memory block to store the value of a variable throughout the main report and all of its subreports. Thus shared variables are even more general than global variables. To use a shared variable, declare it in a formula in the main report as in the following example:

Shared NumberVar x := 1000;

and declare it in a formula in the subreport as in the following example:

Shared NumberVar x;

In order to use shared variables, the variable must be declared and assigned a value before it can be passed between the main report and the subreport.


Declaring array variables

You can declare array variables by following the type name with the keyword Array.

Example
//Declare x to be a Global variable of
//Number Array type
Global NumberVar Array x := [10 , 20, 30];
//cost is a Global variable of Currency Array type
//It is automatically Global since the scope specifier
//(one of Local, Global or Shared) is omitted.
CurrencyVar Array cost := [$19.95, $79.50, $110.00,
                           $44.79, $223.99];
//payDays is a Global variable of Date Array type
Global DateVar Array payDays := [CDate(1999, 5, 15),
CDate(1999, 5, 31)];
//y is a Shared variable of String Range Array type
Shared StringVar Range Array y := ["A" To "C",
                                   "H" To "J"];
//days is a Local variable of String Array type
Local StringVar Array days;
days := ["Sun", "Mon", "Tue", "Wed", "Th",
         "Fri", "Sat"];


Using array variables

You can assign values to elements of an array and also use the values of the elements for other computations.

Example
StringVar Array x := ["hello", "bye", "again"];
x [2] := "once"; //Now x is ["hello", "once", "again"]
//The expression below would cause an error if not
//commented out since the array has size 3
//x [4] := "zap";
//The formula returns the String "HELLO"
UpperCase (x [1])

The Redim and Redim Preserve keywords can be used to resize an array if you want to add extra information to it. Redim erases the previous contents of the array first before resizing it whereas Redim Preserve preserves the previous contents.

Local NumberVar Array x;
Redim x [2]; //Now x is [0, 0]
x [2] := 20; //Now x is [0, 20]
Redim x [3]; //Now x is [0, 0, 0]
x [3] := 30; //Now x is [0, 0, 30]
Redim Preserve x [4]; //Now x is [0, 0, 30, 0]
"finished"
Local StringVar Array a;
Redim a [2];
//Assign a value to the first element of the array a
a[1] := "good";
a[2] := "bye";
//The & operator can be used to concatenate strings
a[1] & a[2] //The formula returns the String "goodbye"


Using Arrays with For loops

Arrays are commonly used with For loops. The following example creates and then uses the Array [10, 20, 30, ..., 100] using a For loop. See For loops for more details.

Local NumberVar Array b;
Redim b[10];
Local NumberVar i;
For i := 1 To 10 Do
(
   b[i] := 10 * i
);
b [2] //The formula returns the Number 20


Default values for the simple types

An uninitialized variable will have the default value for its type. In general, it is not a good programming practice to rely on the default values of types. For example, initialize all local variables in your formula, initialize all global variables in a formula placed in the Report Header and initialize all shared variables in a formula placed in the Report Header of the main report.

When an array is resized using the Redim keyword, the entries are filled with default values for the type. It is useful to know about default values when using If and Select expressions.

Default values

Number

0

Currency

$0

String

"" //The empty string

Date

Date (0, 0, 0) //The null Date value

Time

The null Time value. Value held by an uninitialized Time variable.

DateTime

The null DateTime value. Value held by an uninitialized DateTime variable.

Note: It is not recommended that your formulas rely on the values of uninitialized range or array variables.


Automatic type conversions

Generally in Seagate Crystal Reports, values of one type cannot be used where values of another type are expected without explicitly supplying a type conversion function. For example:

Local StringVar postalCode;
//Error- assigning a Number value to a String
postalCode := 10025;
//OK - use the type conversion function CStr

//to create "10025"

postalCode := CStr (10025, 0);

However, there are a few conversions that are made automatically:

  • Number to Currency
  • Date to DateTime
  • Simple type to Range value of the same underlying simple type

For example, the following assignments are correct:

Local CurrencyVar cost;
//Same as: cost := $10
cost := 10;
Local DateTimeVar orderDate;
//Same as: orderDate := CDateTime (1999, 9, 23, 0, 0, 0)
orderDate := CDate (1999, 9, 23);
Local NumberVar Range aRange;
//Same as: aRange := 20 To 20
aRange := 20;
Local NumberVar Range Array aRangeArray;
//Same as : aRangeArray := [10 To 10, 20 To 25, 2 To 2]
aRangeArray := [10, 20 To 25, 2];

Note: The opposite conversions are not allowed. For example:

Local NumberVar num;
num := 5 + $10; //Error
//OK- convert to Number type using the CDbl function
num := CDbl (5 + $10) //Could also use ToNumber

5 is converted to $5 and added to $10 to make $15. However, this Currency value cannot be automatically assigned to the Number variable num since automatic conversions from Currency to Number are not allowed. Similarly, functions accepting a Currency argument can be supplied a Number argument instead, and the Number argument will be converted to a Currency, whereas functions accepting a Number argument cannot be supplied a Currency argument without first explicitly converting the Currency to a Number using CDbl.


Functions

When using a function in a formula, type the name of the function and supply the arguments required. For example, the Length function requires a String argument and computes the length of the string.

Local StringVar x := "hello";
Length (x) //The formula returns the Number 5

Supplying arguments of the incorrect type required by the function produces an error. For example, calling Length (3) would produce an error since Length does not accept a Number argument. Functions sometimes can accept different numbers of arguments or types of arguments. For example, the CDate function which could accept a single String argument to form a Date value or 3 Number values holding the year, month and day respectively and form a Date value from them. See Date, Time, and DateTime.

Example with the Mid function
Local StringVar x := "hello";
Local StringVar y;
//Start at position 2, go to the end of the string
y := Mid (x, 2); //y is now "ello"
//Start at position 2, extract 1 character
y := Mid (x, 2, 1) //y is now "e"

These classes of functions are: Math, Summary, Financial, String, Date/Time, Date Range, Array, Type Conversion, Programming Shortcuts, Evaluation Time, Print State, Document Properties and Additional Functions. There are also some functions specific to conditional formatting formulas.


Non reporting-specific functions

The Math, Financial, String, Date/Time, Type Conversion, and Programming Shortcuts groups consist mainly of functions that are not specific to reporting, but might be found in any full featured programming environment. Many of the functions are similar in functionality to Visual Basic functions of the same or similar name.

Note: Some functions that are supported by Crystal syntax are not listed in the Crystal syntax Functions tree. This is because they are equivalent to Crystal syntax functions already listed in the tree.

For example, the Length function is the traditional Crystal syntax function for finding the length of a string. Crystal syntax also supports Len as a synonym. Len is the Visual Basic and Basic syntax function for this and its inclusion is for the convenience of Visual Basic and Basic syntax users who want to write or modify Crystal syntax formulas.


Summary functions

The Summary function group provides functions for creating summary fields such as:

Sum({Orders.Order Amount}, {Orders.Ship Via})

Summary fields are normally created using the Insert Summary or Insert Grand Total dialogs. They then appear in the Available Fields tree, and can be used in a formula by double clicking there. However, they do not need to be created in this way. You can create a summary field exclusively for use by your formula by filling in the arguments to one of the functions in the Summary functions section appropriately. However, any groups in the report that the summary field refers to must already exist in the report.


Date Ranges

This category of functions was discussed in the section Range data types. One additional comment is that the Date ranges produced by these functions depend on the current date. For example, if today's date is September 18, 1999, then LastFullMonth is the Date Range value:

CDate(#Aug 1, 1999#) To CDate(#Aug 31, 1999#)

This functionality is often useful, but what if you want to determine a date range based on a database field such as {Orders.Order Date}? The Date/Time functions can be used instead.

For example:

Local DateVar d := CDate ({Orders.Order Date});
Local DateVar Range dr;
dr := DateSerial (Year(d), Month(d) - 1, 1) To
      DateSerial (Year(d), Month(d), 1 - 1);
//At this point dr is the Date Range value holding
//the last full month before {Orders.Order Date}

The DateSerial function makes this easy because you don't have to worry about special cases. It never lets you create an invalid date. For example, DateSerial (1999, 1 - 1, 1) is December 1, 1998.

Note: In the above example, {Orders.Order Date} is actually a DateTime field and so the CDate function is used to convert it to a date by truncating the time part.


Array functions

The array functions compute summaries of an array's elements. For example, the Sum function when applied to an array returns the sum of the elements of the array. For example, the following formula returns 100:

Sum ([10, 20, 30, 40])


Evaluation Time functions

These are the reporting specific functions BeforeReadingRecords, WhileReadingRecords, WhilePrintingRecords and EvaluateAfter. You can use these functions to guide Seagate Crystal Reports as to when your formula should be evaluated.

Should the formula be evaluated before retrieving the records from the database, while reading the records from the database but before the records have been grouped, sorted and summarized, or while printing the report, when the records are grouped, sorted and summarized? In general, Seagate Crystal Reports sets an appropriate evaluation time for your formula, based on how much information the formula needs. For example, if a formula uses a database field, then it cannot be evaluated before the records are read from the database. However, you sometimes need to force a later evaluation time than normal to get the desired effect. See Global variables for an example.


Print State functions

These are once again reporting specific functions. For example, the notation {Orders.Order Date} is used to refers to the value of the field in the current record whereas Previous ({Orders.Order Date}) refers to the value in the immediately preceding record and Next ({Orders.Order Date}) in the next record. IsNull ({Orders.Order Date}) checks if the field's value is null.

Other examples are PageNumber and TotalPageCount that you can use to access pagination information about your report.

Document Properties functions

These are specific functions, such as PrintDate and ReportTitle, that refer to the report document as a whole.


Additional functions

These are functions that are in User Function Libraries or UFLs. A UFL is a separate dynamic link library or Automation server that you create and that Seagate Crystal Reports can use to add your own customized functions to the formula language. Writing a UFL is more involved than writing a formula using Basic syntax or Crystal syntax. See Seagate Crystal Reports Developer's Help for details.

Note: Using UFLs makes your reports less portable because you must distribute your UFL along with the report.


Conditional formatting functions

When writing a conditional formatting formula, certain additional functions appear at the top of the Functions tree to help you with this. For example, you can format the {Customer.Last Year's Sales} field to print sales of more than $100,000 in green, sales of less than $15,000 in red, and all other sales in black.

Example
//Conditional formatting example 1
If {Customer.Last Year's Sales} > 100000 Then
   crGreen
Else If {Customer.Last Year's Sales} < 15000 Then
   crRed
Else
   crBlack

Since this is a font color formatting function, the list of Color Constants appears in the Functions Tree. This example uses three: crGreen, crRed and crBlack. You could have used the actual numeric values of the color constants instead. For example, crRed is 255 and crGreen is 32768. However, the formula is more understandable using the color constants. All constant functions in Crystal syntax can have the "cr" prefix.

Crystal syntax still supports constant functions from previous versions without the "cr" prefix. For example, you can use "Red" instead of "crRed". However, using the "cr" prefix organizes constant functions and is recommended.

Note: Some formatting attributes do not use constant functions. For example, if you wanted to not print {Customer.Last Year's Sales} values if the sales were less than $50,000, you could write the following conditional formatting formula for the suppress attribute:

//Conditional formatting example 2
If {Customer.Last Year's Sales} < 50000 Then
   True //suppress the value
Else
   False //do not suppress the value

Or more simply:

//Conditional formatting example 3 -
//equivalent to example 2
{Customer.Last Year's Sales} < 50000

If the last year's sales are less than $50,000, then the expression

{Customer.Last Year's Sales} < 50000

is True, and so the formula returns True. On the other hand, if the last year's sales are greater than or equal to $50,000, then

{Customer.Last Year's Sales} < 50000

is False and so the formula returns False.


General purpose conditional formatting functions

There are three general purpose conditional formatting functions:

  • CurrentFieldValue
  • DefaultAttribute
  • GridRowColumnValue.

These functions are displayed at the top of the Functions tree whenever appropriate. DefaultAttribute can be used for any formatting formula, CurrentFieldValue for any formatting formula where you are formatting a field value, and GridRowColumnValue for any formatting formula where you are formatting a field value in a Cross-Tab or OLAP grid.

In particular, CurrentFieldValue allows you to conditionally format the cells of a Cross-Tab or OLAP grid based on their value while GridRowColumnValue lets you conditionally format the cells of a Cross-Tab or OLAP grid based on the values of the row or column headings. These two functions are essential in this situation since there is no other way in the formula language to refer to the values of these fields. For example, if you wanted Cross-Tab cells to be suppressed if the values are less than 50,000:

//Conditional formatting example 4
CurrentFieldValue < 50000


Operators

Arithmetic operators

The arithmetic operators are addition (+), subtraction (-), multiplication (*), division (/), integer division (\), percent (%), modulus (Mod), negation (-) and exponentiation (^). Arithmetic operators are used to combine numbers, numeric variables, numeric fields and numeric functions to get another number.

Examples
//Outstanding preferred stock as a percent of
//common stock
{Financials.Preferred Stock} %
{Financials.Common Stock};
//The square root of 9, Sqr(9) is 3
//The formula returns 17
7 + 2 * 3 - 2 + Sqr(6 + 3) * Length("up");


Order of precedence

When you create arithmetic expressions that involve several operators, the order that the program evaluates the various elements of the expression becomes important. In general, the program evaluates expressions from left to right. However, it also follows the rules of precedence from basic math.

Example

Multiplication and division are performed first from left to right and then addition and subtraction are performed.

For example, 5 + 10 * 3 = 5 + 30 = 35. You can change this order of precedence by using parentheses. For example, (5 + 10) * 3 = 15 * 3 = 45. If you are unsure of the order of precedence, it is a good idea to clarify your intentions with parentheses.

List of arithmetic operators, from highest precedence to lowest

  • Exponentiation (^)
  • Negation (-)
  • Multiplication, division, and percent (*, /, %)
  • Integer Division (\)
  • Modulus (Mod)
  • Addition and subtraction (+, -)


Comparison operators

The comparison operators are equal (=), not equal (<>), less than (<), less than or equal (<=), greater than (>) and greater than or equal (>=).

Comparison operators are usually used to compare operands for a condition in a control structure such as an If expression. Comparison operators as a group all have lower precedence than the arithmetic operators. Thus, expressions like 2 + 3 < 2 * 9 are the same as (2 + 3) < (2*9).

Boolean operators

The Boolean operators are, in order of precedence from greatest to lowest: Not, And, Or, Xor, Eqv and Imp. Boolean operators are typically used with comparison operators to generate conditions for control structures. Boolean operators as a group have lower precedence than the comparison operators. Thus for example, the expression 2 < 3 And 4 >= -1 is the same as (2 < 3) And (4 >= -1).


Null fields and how to use IsNull

The {Product.Color} field contains both basic colors such as "red" and "black" and fancy two word colors such as "steel satin" and "jewel green". Suppose that you want to write a formula that writes out "basic" for the basic colors and "fancy" for the others.

If InStr({Product.Color}, " ") = 0 Then
   "basic"
Else
   "fancy"

The function call to InStr searches the {Product.Color} string for a space. If it finds a space, it returns the position of the space, otherwise it returns 0. Since basic colors are only one word with no spaces, InStr will return 0 for them.


Dealing with null values

For some products, such as the Guardian Chain Lock, a color value was not recorded and so the {Product.Color} field has a null value in the database for that record. In general, when Seagate Crystal Reports encounters a null valued field in a formula, it immediately stops evaluating the formula and produces no value. Thus, the Guardian Chain Lock record does not have any word printed beside it. If you want to handle null field values in your formula, you must explicitly do so using one of the special functions designed for handling them: IsNull, PreviousIsNull or NextIsNull. Here is how to fix up the above example using IsNull:

If IsNull({Product.Color}) Or
   InStr({Product.Color}, " ") = 0 Then
   "basic"
Else
   "fancy"

How this relates to operators, is that when Seagate Crystal Reports evaluates the condition:

IsNull({Product.Color}) Or
InStr({Product.Color}, " ") = 0

It first evaluates IsNull ({Product.Color}), and when it determines that this is True, it knows that the whole condition is True, and thus does not need to check whether

InStr({Product.Color}, " ") = 0.

In other words, Seagate Crystal Reports will stop evaluating a Boolean expression when it can deduce the results of the whole expression.
In the following example, the formula guards against attempting to divide by zero in the case that denom is 0:

Local NumberVar num;
Local NumberVar denom;
...
If denom <> 0 And num / denom > 5 Then
...


Control structures

Formulas without control structures execute each expression in the formula exactly once when the formula is evaluated. The expressions are executed in a sequential fashion, from the first expression in the formula to the last. Control structures enable you to vary this rigid sequence. Depending upon which control structure you choose, you can skip over some of the expressions or repeatedly evaluate some expressions depending on if certain conditions hold. Control structures are the primary means of expressing business logic and typical report formulas make extensive use of them.


If expressions

The If expression is one of the most useful control structures. It allows you to evaluate an expression if a condition is true and evaluate a different expression otherwise.

Example

A company plans to pay a bonus of 4 percent to its employees except for those who work in Sales who will receive 6 percent. The following formula using an If expression would accomplish this:

//If example 1
If {Employee.Dept} = "Sales" Then
   {Employee.Salary} * 0.06
Else
   {Employee.Salary} * 0.04

In this example, if the condition {Employee.Dept} = "Sales" evaluates as true, then the

{Employee.Salary} * 0.06

expression is processed. Otherwise the expression following the Else, namely the

{Employee.Salary} * 0.04

is processed.

Suppose another company wants to give employees a 4% bonus, but with a minimum bonus of $1,000. The following example shows how. Notice that the Else clause is not included; it is optional, and not needed in this case.

//If example 2
Local CurrencyVar bonus := {Employee.Salary} * 0.04;
If bonus < 1000 Then
   bonus := 1000;
//The final expression is just the variable 'bonus'.
//This returns the value of the variable and is the
//result of the formula
bonus

Another way of accomplishing example 2 is to use an Else clause:

//If example 3
Local CurrencyVar bonus := {Employee.Salary} * 0.04;
If bonus < 1000 Then
   1000
Else
   bonus

Now suppose that the previous company also wants a maximum bonus of $5,000. You now need to use an Else If clause. The following example has only one Else If clause, but you can add as many as you need. Note, however, that there is a maximum of one Else clause per If expression. The Else clause is executed if none of the If or Else If conditions are true.

//If example 4
Local CurrencyVar bonus := {Employee.Salary} * 0.04;
If bonus < 1000 Then
   1000
Else If bonus > 5000 Then
   5000
Else
   bonus;


If example

Suppose that a company wants to compute an estimate of the amount of tax an employee needs to pay and write a suitable message. Income below $8,000 is not taxed, income from $8,000 to $20,000 is taxed at 20% income from $20,000 to $35,000 is taxed at 29% and income above $35,000 is taxed at 40%.

//If example 5
Local CurrencyVar tax := 0;
Local CurrencyVar income := {Employee.Salary};
Local StringVar message := "";
If income < 8000 Then
(
   message := "no";
   tax := 0
)
Else If income >= 8000 And income < 20000 Then
(
   message := "lowest";
   tax := (income - 8000)*0.20
)
Else If income >= 20000 And income < 35000 Then
(
   message := "middle";
   tax := (20000 - 8000)*0.20 + (income - 20000)*0.29
)
Else
(
   message := "highest";
   tax := (20000 - 8000)*0.20 + (35000 - 20000)*0.29 +
          (income - 35000)*0.40
);
//Use 2 decimal places and the comma as a
//thousands separator
Local StringVar taxStr := CStr (tax, 2, ",");
"You are in the " & message & " tax bracket. " &
"Your estimated tax is " & taxStr & "."

Note: The use of variables is to simplify the logic of the computation. Also, there are 2 expressions that are executed when one of the conditions are met; one assigns the tax variable, and the other assigns the message variable. It is often useful to have multiple expressions executed as a result of a condition.


More details on If expressions

The If expression is an expression. In other words it evaluates to a value of a given type. If there is no Else clause, and the condition is not true, then the value is the default value for the type. For example:

If Length ({Employee.First Name}) < 5 Then
   "short"

The above If expression returns a String value. The string value is "short" if the Employee's first name has fewer than 5 letters and the empty String "" otherwise.

Consider the formula:

If Year({Orders.Order Date}) >= 1995 Then
   {Orders.Order Date}

For order dates before 1995, the above If expression returns the null DateTime value. It is a DateTime value rather than a Date value since {Orders.Order Date} is a DateTime database field. The null DateTime value is not printed by Seagate Crystal Reports so if the above formula is placed in a report, the formula field would be blank for order dates before 1995. Null Time values and null Date values behave similarly.

Here is an example that illustrates the use of parentheses to have more than one expression executed as the outcome of an If condition. A company charges a 5 percent fee for orders shipped within 3 days and a 2 percent fee otherwise. It wants to print messages such as "Rush shipping is $100.00" or "Regular shipping is $20.00" as appropriate.

Local StringVar message;
Local CurrencyVar ship;
If {Orders.Ship Date} - {Orders.Order Date} <= 3 Then
(
   message := "Rush";
   //A semicolon at the end of the next line
   //is optional
   ship := {Orders.Order Amount} * 0.05
) //A semicolon cannot be placed here
Else
(
   message := "Regular";
   ship := {Orders.Order Amount} * 0.02;
);
//The preceding semicolon is required to separate the
//If expression from the final expression below
message & " shipping is " & CStr (ship)

When expressions are grouped together with parentheses, the whole group is considered as a single expression, and its value and type are the value and type of the final expression inside the parentheses.

//The parentheses group expression as a whole has
//Currency type
(
   //The first expression in the parentheses has
   //String type
   message := "Rush";
   //The second and final expression in parentheses
   //has Currency type
   ship := {Orders.Order Amount} * 0.05;
)

Thus, for example, the following formula gives an error. The reason is that the Then part of the If expression returns a Currency value while the Else part returns a String value. This is not allowed, since the If expression is an expression and so must always return a value of a single type.

//An erroneous formula
Local StringVar message;
Local CurrencyVar ship;
If {Orders.Ship Date} - {Orders.Order Date} <= 3 Then
(
   message := "Rush";
   ship := {Orders.Order Amount} * 0.05
)
Else
(
   //The following 2 lines were interchanged
   ship := {Orders.Order Amount} * 0.02;
   message := "Regular";
);
message & " shipping is " & CStr (ship)

One way of fixing up the erroneous formula without being careful about expression order is just to make the If expression return a constant value of the same type in every branch. For example, the If expression now returns the Number value 0:

//Repaired the erroneous formula
Local StringVar message;
Local CurrencyVar ship;
If {Orders.Ship Date} - {Orders.Order Date} <= 3 Then
(
   message := "Rush";
   ship := {Orders.Order Amount} * 0.05;
   0
)
Else
(
   ship := {Orders.Order Amount} * 0.02;
   message := "Regular";
   0
);
message & " shipping is " & CStr (ship)


Select expressions

The Select expression is similar to an If expression. Sometimes however, you can write clearer and less repetitive formulas using the Select expression. For example, to evaluate the {Customer.Fax} field to determine if the area code is for Washington state (206, 360, 509) or British Columbia, Canada (604, 250):

//Select example 1
Select {Customer.Fax}[1 To 3]
   Case "604", "250" :
      "BC"
   Case "206", "509", "360" :
      "WA"
   Default :
      "";

The expression right after the Select keyword is called the Select condition. In the above example it is {Customer.Fax}[1 To 3]. The Select expression tries to find the first Case that matches the Select condition, and then executes the expression following the colon for that Case. The Default case is matched if none of the preceding cases match the Select condition. Notice that there is also a colon after the Default.

//Same effect as Select example 1
Local StringVar areaCode := {Customer.Fax}[1 To 3];
If areaCode In ["604", "250"] Then
   "BC"
Else If areaCode In ["206", "509", "360"] Then
   "WA"
Else
   "";
Example

This formula groups the number of Oscar nominations a movie received into low, medium, high or extreme categories and in the process, shows some of the possibilities for the expression lists following the Case labels:

//Select example 2
Select {movie.NOM}
   Case 1,2,3, Is < 1 :
   (
      //Can have expression lists by using
      //parentheses
      10 + 20;
      "low"
   )
   Case 4 To 6, 7, 8, 9 :
      "medium"
   Case 10 :
      "high"
   Default :
      "extreme"

The Default clause of the Select expression is optional. If the Default clause is missing and none of the cases are matched, then the Select expression returns the default value for its expression type. For example, if in the above example the Default clause were omitted and {movie.NOM} = 11, it would return the empty string "". The Select expression is an expression, and similar comments as in the More details on If expressions section apply to it as well.


For loops

For loops enable you to evaluate a sequence of expressions multiple numbers of times. This is unlike the If and Select expressions where the program passes through each expression at most once during the formula's evaluation. For loops are best when you know the number of times that the expressions needs to be evaluated in advance.

The syntax of the For loop through examples

Example 1

Suppose you want to reverse the {Customer.Customer Name} string. For example, "City Cyclists" becomes "stsilcyC ytiC".

//Reverse a string version 1
Local StringVar str := "";
Local NumberVar strLen :=
   Length ({Customer.Customer Name});
Local NumberVar i;
For i := 1 To strLen Do

(

   Local NumberVar charPos := strLen - i + 1;
   str := str + {Customer.Customer Name}[charPos]
);
str

Examine how this formula works assuming that the current value of the field {Customer.Customer Name} is "Clean Air". The variable strLen is assigned to be the length of "Clean Air", namely 9. The variable i is known as a For counter variable since its value changes with each iteration of the For loop. In other words, it is used to count the iterations of the loop. The For loop will iterate 9 times, during the first time, i is 1, then i is 2, then i is 3 and so on until finally i equals 9. During the first iteration, the ninth character of {Customer.Customer Name} is appended to the empty string variable str. Thus str equals "r" after the first iteration. During the second iteration, the eighth character of {Customer.Customer Name} is appended to str and so str equals "ri". This continues until after the ninth iteration, str equals, "riA naelC" which is the reversed string.

Example 2

Here is a simpler version of the above formula that uses a Step clause with a negative Step value of -1. For the "Clean Air" example, i is 9 for the first iteration, 8 for the second, 7 for the third and so on until it is 1 in the final iteration.

//Reverse a string version 2
Local StringVar str := "";
Local NumberVar strLen :=
   Length ({Customer.Customer Name});
Local NumberVar i;
For i := strLen To 1 Step -1 Do
(
   str := str + {Customer.Customer Name}[i]
);
str
Example 3

The simplest version is to use the built in function StrReverse:

//Reverse a string version 3
StrReverse ({Customer.Customer Name})

The built in String functions in Seagate Crystal Reports 8 can handle many of the string processing applications that would traditionally be handled using a For loop or some other kind of loop. However, For loops provide the most flexibility in processing strings and also power in processing arrays, which can be essential if the built-in functions do not cover your intended application.


For loop example

Here is a more full featured example of Seagate Crystal Reports' string processing capabilities. The Caesar cipher is a simple code that is traditionally credited to Julius Caesar. In this code, each letter of a word is replaced by a letter five characters further in the alphabet. For example, "Jaws" becomes "Ofbx". Notice that "w" is replaced by "b"; since there are not 5 characters after "w" in the alphabet, it starts again from the beginning. Here is a formula that implements applying the Caesar cipher to the field {Customer.Customer Name} in the Xtreme database:

//The Caesar cipher

//The input string to encrypt
Local StringVar inString := {Customer.Customer Name};
Local NumberVar shift := 5;
Local StringVar outString := "";
Local NumberVar i;
For i := 1 To Length(inString) Do
(
   Local StringVar inC := inString [i];
   Local StringVar outC;
   Local BooleanVar isChar :=
   LowerCase(inC) In "a" To "z";
   Local BooleanVar isUCaseChar :=
   isChar And (UpperCase (inC) = inC);

inC := LCase(inC);

   If isChar Then
   (
      Local NumberVar offset :=
         (Asc(inC) + shift - Asc("a")) Mod
         (Asc("z") - Asc("a") + 1);
      outC := Chr(offset + Asc("a"));
      If isUCaseChar Then outC := UpperCase(outC)
   )
   Else
      outC := inC;
   outString := outString + outC
);
outString

In the above example there is an If expression nested within the expression block of the For loop. This If expression is responsible for the precise details of shifting a single character. For example, letters are treated differently from punctuation and spaces. In particular, punctuation and spaces are not encoded. The general points here are that control structures can be nested within other control structures and that multiple expressions can be included in the (parentheses enclosed) expression blocks of other control structures.


Using Exit For

You can exit from a For loop by using Exit For. The following example searches the Global array names for the name "Fred". If it finds the name, it returns the index of the name in the array. Otherwise it returns -1. For example, if the names array is

["Frank", "Helen", "Fred", "Linda"]

Then the formula returns 3.

Global StringVar Array names;

//The names array has been initialized and filled
//in other formulas
Local NumberVar i;
Local NumberVar result := -1;
//The UBound function returns the size of its array
//argument
For i := 1 to UBound (names) Do
(
   If names [i] = "Fred" Then
   (
      result := i;
      Exit For
   )
);
result

When considered as an expression, the For loop always returns the Boolean value True. Thus you will almost never want a For loop to be the last expression in a formula, since then the formula will then just display the value True rather than your intended result.


While Loops

Another looping mechanism is the While loop. A While loop can be used to execute a fixed block of statement an indefinite amount of time.

The 2 different types of While loops
Type of Do Loop Explanation Example

While ... Do

The While ... Do loop evaluates the condition, and if the condition is true, then it evaluates the expression following the Do.

When it has finished doing this, it evaluates the condition again and if the condition is true, it evaluates the expression following the Do again. It continues repeating this process until the condition is false.

While condition Do
   expression

Do ... While

The Do ... While loop evaluates the expression once no matter what.

It then evaluates the condition, and if the condition is true, evaluates the expression again. This process continues until the condition is false.

Do
   expression
While condition

Note:

  • The While loops support an Exit While statement to immediately jump out of the loop. Its use is analogous to the use of Exit For in For loops.
  • As with the For loop, the While loop when considered as an expression always returns the Boolean value True.


While ... Do loop example

The following example searches for the first occurrence of a digit in an input string. If a digit is found, it returns its position, otherwise it returns -1. In this case, the input string is set explicitly to a string constant, but it could be set equal to a String type database field instead. For example, for the input String, "The 7 Dwarves", the formula returns 5, which is the position of the digit 7.

Local StringVar inString := "The 7 Dwarves";
Local NumberVar strLen := Length (inString);
Local NumberVar result := -1;
Local NumberVar i := 1;
While i <= strLen And result = -1 Do
(
   Local StringVar c := inString [i];
   If NumericText (c) Then
      result := i;
   i := i + 1;
);
result


Safety mechanism for loops

There is a safety mechanism to prevent report processing from hanging due to an infinite loop. Any one evaluation of a formula can have at most 30,000 loop condition evaluations per formula evaluation. This will be explained by the example below.

For example:

Local NumberVar i := 1;
While i <= 100000 Do
(
   If i > {movie.STARS} Then
      Exit While;
   i := i + 1
);
20

If {movie.STARS} is greater than 30,000 then the loop condition (i <= 100000) will be evaluated more than the maximum number of times and an error message is displayed. Otherwise the loop is OK.

Note: The safety mechanism applies on a per formula base, not for each individual loop. For example:

Local NumberVar i := 1;
For i := 1 To 10000 Do
(
   Sin (i);
);
While i <= 25000 Do
(
   i := i + 1;
)

The above formula also triggers the safety mechanism since the 30,000 refers to the total number of loop condition evaluations in the formula and this formula will have 10001 + 25001 such evaluations.


Limitations

For reference purposes, here are the sizing limitations of the formula language:

  • The maximum length of a String constant, a String value held by a String variable, a String value returned by a function or a String element of a String array is 254 bytes.
  • The maximum size of an array is 1000 elements.
  • The maximum number of arguments to a function is 1000. (This applies to functions that can have an indefinite number of arguments such as Choose).
  • The maximum length of the text of a formula is 64K.
  • The maximum number of loop condition evaluations per evaluation of a formula is 30,000.

    See Safety mechanism for loops.

  • Date-time functions modeled on Visual Basic accept dates from year 100 to year 9999. Traditional Seagate Crystal Reports functions accept dates from year 1 to year 9999.


Functions

Functions are built-in procedures or subroutines used to evaluate, make calculations on, or transform data.

When you specify a function, the program performs the set of operations built into the function without you having to specify each operation separately. In this way, a function is a kind of shorthand that makes it easier and less time consuming for you to create reports.

Simple, straightforward examples are provided for each function. In addition, for many functions, references are provided to specific formulas. These formulas demonstrate more advanced examples of solving real-world reporting problems.


Mathematical functions

Mathematical functions are used for a variety of mathematics-oriented calculations and operations.

Abs (x)

Sgn (number)

Int (number)

Round (x), Round (x, #places)

Truncate (x), Truncate (x, #places)

Fix

Remainder (num, denom)

Sin (number)

Cos (number)

Tan (number)

Atn (number)

Pi

Sqr (number)

Exp (number)

Log (number)

Rnd


Abs (x)

Basic and Crystal syntax.

Arguments

x is the Number for which you want the Absolute Value returned.

Returns

Absolute value of x.

Action

Abs returns the value of x, ignoring any negative values.

Examples

Abs(1.50)

Returns 1.50.

Abs(-1.50)

Returns 1.50.

Abs(10 - 7)

Returns 3.

Abs(7 - 10)

Returns 3.

Rem Basic syntax
If Abs(37 - {file.FIELD}) > 1 Then
formula = "Maintenance, Temperature Check"
End If

//Crystal syntax
If Abs(37 - {file.FIELD}) > 1 Then
"Maintenance, Temperature Check"
Else
"" ;

This flags instances where a laboratory heat block has a temperature variation greater than +/- 1 degree C.

Comments

This function is designed to work like the Visual Basic function of the same name.

Related topics

Formula 1


Sgn (number)

Basic and Crystal syntax.

Argument

Number value

Returns

Returns 1, 0 or -1

Action

Sgn returns the sign of a given number: 1 if number > 0, 0 if number is 0, and -1 if number < 0.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Sgn (-10)

Returns -1.

Sgn (0)

Returns 0.

Sgn (10)

Returns 1.

Comment

This function is designed to work like the Visual Basic function of the same name.


Int (number)

Basic and Crystal syntax.

Argument

Number value

Returns

Whole number value

Action

Int returns the integer portion of a given number.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Int (123.678)

Returns 123.

Int (-123.678)

Returns -124.

Int (-123.1)

Returns -124.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • Fix (n) (or Truncate (n)) and Int (n) are the same except when n is negative, in which case Fix and Truncate return the first integer greater than or equal to n, and Int returns the first integer smaller than or equal to n. For example,

Fix (-10.2)

Truncate (-10.2)

Both return -10.

Int (-10.2)

Returns -11.

Related topics

Fix

Truncate (x), Truncate (x, #places)


Round (x), Round (x, #places)

Basic and Crystal syntax.

Arguments
  • x is a fractional value to be rounded off.
  • #places is a whole number indicating the number of decimal places x is to be rounded off to.
Returns

Fractional Number

Action

Round rounds to the nearest whole number if the #places argument is excluded. If the value to the right of the decimal point is .499 or below, the program rounds to the next lowest number. If the value to the right of the decimal point is .5 or above, it rounds to the next highest number.

If the #places argument is used, the value in x is rounded to the nearest decimal place indicated by #places. Specifying #places as 0 works identical to leaving the #places argument off. You can also specify a negative number for #places; the number will be rounded to the nearest tenth (.1), hundredth (.01), or thousandth (.001), and so on.

Typical uses

Use Round any time rounding off a value to a particular decimal place is more appropriate than using the original value.

Examples

The following examples are applicable to both Basic and Crystal syntax, although Fix is preferred in the latter:

Round(1.23456)

Returns 1.

Round(1.499)

Returns 1.

Round(1.5000)

Returns 2.

Round(2345.23456,4)

Returns 2345.2346.

Round(2345.23456,3)

Returns 2345.235.

Round(2345.23456,2)

Returns 2345.23.

Round(2345.23456,0)

Returns 2345.

Round(2345.23456,-1)

Returns 2350.

Round(2345.23456,-2)

Returns 2300.

Round(2345.23456,-3)

Returns 2000.

Round(1.234499,3)

Returns 1.234.

Round(1.234500,3)

Returns 1.235.

Round({file.AMOUNT},1)

Returns 1854.5 where Amount = 1854.49.

Round({file.AMOUNT})

Returns 1854.00 where Amount = 1854.49.

Round({file.AMOUNT})

Returns 1855.00 where Amount = 1854.51.

Round({file.WEIGHT} / 100)

Returns 4 where Weight = 424.

Round({file.WEIGHT} / 100)

Returns 5 where Weight = 451.

Round((A * B) / C)

Returns 11 where A = 25, B = 3, and C = 7.

Round(file.AMOUNT,1)

Returns 1854.5 where Amount = 1854.51.

Round({file.WAGE} * {file.HOURS WORKED}, 2)

Returns $146.63 where Wage = $5.75 and Hours worked = 25.5.

Comments

Rounding is also a feature available as a formatting option for numerical values in fields.

Be aware that using field formatting features may affect how values are used in formulas. See ToNumber (numeric), ToNumber (string) and the To currency operator.

Related topics

Truncate (x), Truncate (x, #places)

Fix

Int (number)

Formula 8


Truncate (x), Truncate (x, #places)

Truncate and Fix are equivalent functions. However, Truncate is preferred in Crystal syntax whereas Fix is preferred in Basic syntax.

Arguments
  • x is a fractional Number to be truncated.
  • #places is a whole number indicating how many decimal places are to remain after the value is truncated. (This argument is optional.)
Returns

Fractional Number

Action

Truncate(x) returns a whole number by truncating the number at the decimal point. If the #places argument is specified, the number is truncated to the decimal place indicated and the function returns a fractional Number. If #places is negative, the number is rounded to the first ten, hundred, and so on.

Typical uses

Use this function whenever the characters to the right of the decimal are not needed for a report or calculation.

Examples

The following examples are applicable to both Basic and Crystal syntax, although Fix is preferred in the latter:

Truncate(1.23456)

Returns 1.

Truncate(1.499)

Returns 1.

Truncate(1.599)

Returns 1.

Truncate(1.999)

Returns 1.

Truncate(12346.33, 1)

Returns 12346.3.

Truncate(12345.33, -2)

Returns 12300.00.

If you have 147 golf balls in stock and want to know how many dozen are available for sale, your calculation is 147/12=12.25 12.25 (truncated) = 12 dozen available for sale. If you sell balls only by the dozen, the .25 dozen you truncated is unimportant.

Truncate({file.BALL INVENTORY} / 12)

Returns 12 where Ball inventory = 147 (147 / 12 = 12.25, 12.25 truncated = 12).

Truncate({file.BALL INVENTORY} / 12)

Returns 12 where Ball inventory = 155 (155/12 = 12.92, 12.92 truncated = 12).

Truncate({file.BALL INVENTORY} / 12)

Returns 13 where Ball inventory = 157 (157/12 = 13.08, 13.08 truncated = 13).

Comments
  • This is not a rounding function; Truncate simply deletes all characters to the right of the decimal point.

    See the Round (x), Round (x, #places) for an explanation on rounding.

  • Truncate (n) and Int (number) are synonymous except when n (number) is negative, in which case Truncate returns the first integer greater than or equal to n, and Int returns the first integer smaller than or equal to n. For example,

Truncate (-10.2)

Returns -10.

Int (-10.2)

Returns -11.

  • Truncating is also a feature available as a formatting option for numerical values in fields. Be aware that using field formatting features may affect how values are used in formulas. For more information on converting to Numbers and Currency, see the ToNumber (numeric), ToNumber (string) and To currency operator.
Related topics

Int (number)

Formula 13


Fix

Fix and Truncate (x), Truncate (x, #places) are equivalent functions. However, Fix is preferred in Basic syntax whereas Truncate is preferred in Crystal syntax.

Overloads
  • Fix (number)
  • Fix (number, #places)
Arguments
  • number is the Number value to be truncated; it can be positive, 0 or negative.
  • #places is an optional Number indicating the number of decimal places to be truncated to. If omitted, 0 is assumed.
Returns

Whole number value which can be positive, 0 or negative.

Action

Fix truncates a number to the specified number of decimal places and returns it. If #places is omitted, 0 is assumed.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Fix (123.678)

Returns 123.

Fix (-123.678)

Returns -123.

Fix (123.678,1)

Returns 123.6.

Fix (123.678,2)

Returns 123.67.

Comments
  • This function with a single parameter, Fix (number), is designed to work like the Visual Basic function of the same name.
  • Fix (n) and Int (number) work the same except when n is negative, in which case Fix returns the first integer greater than or equal to n, and Int returns the first integer smaller than or equal to n. For example,

Fix (-10.2)

Returns -10.

Int (-10.2)

Returns -11.


Remainder (num, denom)

Basic and Crystal syntax.

Arguments
  • Numerator is a fractional value.
  • Denominator is a fractional value.
Returns

Fractional Value

Action

Remainder returns the remainder after the numerator (dividend) has been divided by the denominator (divisor). In a typical division situation, the program expresses a quotient as a whole number (if any) and up to six decimal places. When using Remainder, however, the program performs the division internally, determines the whole number quotient and the remainder, and returns only the remainder.

Typical uses

You can use this function in making conversions (feet to miles, units to grosses, etc.) You can also use it to select every nth item out of an array.

Examples

The following examples are applicable to Basic and Crystal syntax:

Remainder(12,5)

Returns 2.

Remainder(16,5)

Returns 1.

Rem Basic syntax
If Remainder ({file.EXAM#}, 7) = 0 Then
formula = "*****"
End If

//Crystal syntax
If Remainder({file.EXAM#}, 7) = 0 Then
"*****"
Else
""

This flags every 7th exam for grading by a second party.

ToText(Truncate({file.DAYS}/7)) + " week(s), " + ToText(Remainder({file.DAYS},7)) + " day(s)"

Returns "9 week(s), 1 day(s)". Converts days to weeks and days. For example, if the field had a value of 64 days, the formula would return the value of "9 week(s), 1 day(s)."

Related topics

Modulus (x Mod y)

Formula 13

Formula 17


Sin (number)

Basic and Crystal syntax.

Argument

Number value that represents an angle in radians

Returns

Number value between -1 and 1

Action

Sin returns a number specifying the sine of an angle given in radians. It takes a right-angle triangle, and returns the length of the side opposite to the specified angle divided by the length of the hypotenuse.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Sin (1)

Returns 0.8415 (rounded to 4 decimals). This is the sine of 1 radian.

Sin (30 * crPi / 180)

Returns 0.5. This is the sine of 30 degrees. Before taking the sine, the angle is converted to radians by multiplying by crPi / 180.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • The range of values returned by Sin is between -1 and 1.


Cos (number)

Basic and Crystal syntax.

Argument

Number value which is an angle in number of radians

Returns

Number value between -1 and 1

Action

Cos returns a Number specifying the cosine of an angle given in radians. It takes a right-angle triangle, and returns the length of the side adjacent to the specified angle divided by the length of the hypotenuse.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Cos (1)

Returns 0.5403 (rounded to 4 decimals). This is the cosine of 1 radian.

Cos (60 * crPi / 180)

Returns 0.5. This is the cosine of 60 degrees. Before taking the cosine, the angle is converted to radians by multiplying by crPi / 180.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • The range of values returned by Cos is between -1 and 1.


Tan (number)

Basic and Crystal syntax.

Argument

Number value that represents an angle in radians.

Returns

Number value

Action

Tan returns a Number specifying the tangent of an angle given in radians. It takes a right-angle triangle, and returns the length of the side opposite the specified angle divided by the length of the side adjacent to the angle.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Tan (1)

Returns 1.5574 (rounded to 4 decimals). This is the tangent of 1 radian.

Tan (45 * crPi / 180)

Returns 1. This is the tangent of 45 degrees. Before taking the tangent, the angle is converted to radians by multiplying by crPi / 180.

Comment

This function is designed to work like the Visual Basic function of the same name.


Atn (number)

Basic and Crystal syntax.

Argument

Number value

Returns

Number value which is an angle specified in number of radians

Action

Atn returns a Number specifying the arctangent of the given Number argument. In other words, it returns the angle whose tangent is the given Number argument.

Example

The following example is applicable to both Basic and Crystal syntax:

Atn (1)

Returns an angle of 0.7854 radians (rounded to 4 radians). To convert this angle to degrees, multiply by 180 / crPi. For instance, Atn (1) * 180 / crPi is 45 degrees.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • The range of values returned by Atn is between -pi/2 and pi/2 radians.


Pi

Basic and Crystal syntax.

Returns the Mathematical value pi, which is 3.14 (if rounded to 2 decimal places).


Sqr (number)

Basic and Crystal syntax.

Argument

Number value greater than or equal to 0.

Returns

Number value

Action

Sqr returns the square root of a given number.

Example

The following examples is applicable to both Basic and Crystal syntax:

Sqr (100)

Returns 10.

Comment

This function is designed to work like the Visual Basic function of the same name.


Exp (number)

Basic and Crystal syntax.

Argument

Number value that specifies a power.

Returns

Number value.

Action

Exp returns a Number specifying e (the base of natural logarithms) raised to a power. The value of e is approximately 2.718282.

Example

The following example is applicable to both Basic and Crystal syntax:

Exp (1.5)

Returns the exponentiation of 1.5, which is approximately 4.48169.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • Numeric overflow occurs if the given number argument is larger than approximately 705.


Log (number)

Basic and Crystal syntax.

Argument

Number value

Returns

Number value

Action

Log returns a Number specifying the natural logarithm of a given number. The natural logarithm is the logarithm to the base e, where e is approximately 2.718282.

Example

The following examples is applicable to both Basic and Crystal syntax:

Log (1.5)

Returns 0.4055 (rounded to 4 decimals).

Comments

This function is designed to work like the Visual Basic function of the same name.


Rnd

Basic and Crystal syntax.

Overloads
  • Rnd ()
  • Rnd (seed)
Argument

seed is an optional Number value argument.

Returns

A Number value.

Action

Rnd returns a random number greater than or equal to 0 and less than 1. If seed is equal to 0, Rnd returns the random number that was returned from the previous call to Rnd. If seed is not supplied or is greater than 0, then Rnd returns the next random number in the internally generated sequence of random numbers. If seed is less than 0, then Rnd uses this value of seed to start a new random number sequence and returns the first value in this sequence.

Typical uses

Used when your formula requires a randomly generated number such as for statistical calculations or for selecting records at random to limit the data in a report.

Comments
  • This function is similar to the Visual Basic function of the same name.
  • You can call Rnd without ever starting a new random number sequence by specifying a negative seed argument. If you do so, an internal seed will be generated using the system clock.
  • The reason to start a new random number sequence by calling Rnd with a negative seed argument, and then making subsequent calls to Rnd without an argument (or with a positive argument) is so that the report will look exactly the same every time it is previewed. In other words, it allows you to make use of random numbers, but get a reproducible result.


Summary functions

The Summary functions are all used to summarize field data in several different ways. Because of their unique summarization features, they have been grouped together as summary functions.The function name SummaryFunction takes the place of an actual function name.

Summary functions can be designed to perform operations on group data.

Sum (fld), Sum (fld, fld), Sum (fld, condFld), Sum (fld, condFld, cond), Sum (x)

SummaryFunction (fld)

SummaryFunction (fld, condFld)

SummaryFunction (fld, condFld, cond)

Average (fld), Average (fld, condFld), Average (fld, condFld, cond), Average (x)

StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x)

PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x)

Variance (fld), Variance (fld, condFld), Variance (fld, condFld, cond), Variance (x)

PopulationVariance (fld), PopulationVariance (fld, condFld), PopulationVariance (fld, condFld, cond), PopulationVariance (x)

Maximum (fld), Maximum (fld, condFld), Maximum (fld, condFld, cond), Maximum (x)

Minimum (fld), Minimum (fld, condFld), Minimum (fld, condFld, cond), Minimum (x)

Count (fld), Count (fld, condFld), Count (fld, condFld, cond), Count (x)

DistinctCount (fld), DistinctCount (fld, condFld), DistinctCount (fld, condFld, cond), DistinctCount (x)

Correlation (fld, fld), Correlation (fld, fld, condFld), Correlation (fld, fld, condFld, cond)

Covariance (fld, fld), Covariance (fld, fld, condFld), Covariance (fld, fld, condFld, cond)

WeightedAverage (fld, fld), WeightedAverage (fld, fld, condFld), WeightedAverage (fld, fld, condFld, cond)

Median (fld), Median (fld, condFld), Median (fld, condFld, cond)

PthPercentile (P, fld), PthPercentile (P, fld, condFld), PthPercentile (P, fld, condFld, cond)

NthSmallest (N, fld), NthSmallest (N, fld, condFld), NthSmallest (N, fld, condFld, cond)

Mode (fld), Mode (fld, condFld), Mode (fld, condFld, cond)

NthMostFrequent (N, fld), NthMostFrequent (N, fld, condFld), NthMostFrequent (N, fld, condFld, cond)

PercentOfSum

PercentOfAverage

PercentOfMaximum

PercentOfMinimum

PercentOfCount

PercentOfDistinctCount

Conditions for summary functions


Conditions for summary functions

Here is a list of the possible condition text strings for the summary functions:

Boolean conditions

  • any change
  • change to Yes
  • change to No
  • every Yes
  • every No
  • next is Yes
  • next is No

Date conditions

  • daily
  • weekly
  • biweekly
  • semimonthly
  • monthly
  • quarterly
  • semiannually
  • annually

Time conditions

  • by second
  • by minute
  • by hour
  • by AMPM


Sum (fld), Sum (fld, fld), Sum (fld, condFld), Sum (fld, condFld, cond), Sum (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to add the values that appear in your report. For example:

  • If a sales report includes a field that shows the amount of each order, you can compute the sum of all the orders that appear on the report (a grand total sum). For information on this kind of summary, see SummaryFunction (fld).
  • If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the sum of the order amounts per group (in this case, per state). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the sum of the order amounts per group based on a specific change in the date or Boolean field (in this case, per month). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can also compute the sum of the values in the set. For information on this kind of summary, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Sum({file.QTY})

Calculates the sum of all values in the QTY field.

Sum({orders.ORDER ID}, {orders.CUSTOMER ID})

Sums (totals) the orders in each group of orders in the Amount field. The orders are separated into groups whenever the value in the Customer ID field changes.

Sum({orders.AMOUNT}, {orders.DATE}, "monthly") % Sum({orders.AMOUNT })

Groups values in the Amount field by month, and calculates the sum of the values for each month group as a percentage of the sum of the values for the entire report.

Sum([{file.AMOUNT}, {file.PRICE}, {file.COST}])

Sum of values in the Amount, Price, and Cost fields.

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the Evaluation Time functions.


SummaryFunction (fld)

Basic and Crystal syntax.

Arguments

fld is any valid database or formula field that can be evaluated by the function.

Returns

Fractional Number.

Action

SummaryFunction (fld) summarizes the values in the specified field for the entire report. It generates, in effect, a "grand total" summary.

Typical uses

Use these functions any time you need to summarize all the values that appear in a given field in a report, or when you need to use a summary in a calculation or comparison.

Examples

The following examples are applicable to Crystal syntax:

SummaryFunction({orders.ORDER AMOUNT})

Summarizes all values in the Amount field.

If {orders.ORDER AMOUNT} > SummaryFunction({orders.ORDER AMOUNT}) Then
"Flag"
Else
""

Compares each value in the Amount field to the summary value of all values in the Amount field. If the value is greater than the summary value, it flags it with the word "Flag"; if it is equal to or less then the summary value, it prints nothing.

Average({orders.ORDER AMOUNT})

Calculates the average of all values in the Amount field.

If Count({orders.ORDER ID}) >= 100 Then
"Congratulations on meeting your quota!"
Else
""

Prints the congratulatory message if the number of orders is 100 or more, and prints nothing if the number of orders is less than 100.

Sum({file.QTY})

Calculates the sum of all values in the QTY field.

Comments

Not all arithmetic group functions are available for use with all data types.


SummaryFunction (fld, condFld)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is any valid database or formula field used to group the values in fld.
Returns

Fractional Number

Action

SummaryFunction (fld, condFld) summarizes each group of values that is generated when the specified summary condition is met.

Typical uses

Use these functions whenever you want to duplicate, in a formula, a summary:

  • that summarizes the values in a group
  • that uses a String, Number, Date, Time, DateTime, or Currency field as the sort and group by (trigger) field.
Examples

The following examples are applicable to both Basic and Crystal syntax:

SummaryFunction({orders.ORDER AMOUNT}, {customer.CUSTOMER ID})

Summarizes the orders in each group of customer orders. The orders are separated into groups whenever the value in the Customer field changes.

Count({orders.AMOUNT}, {orders.CUSTOMER ID})

This formula counts the number of orders in each group of orders in the Amount field (the total orders for each month). The orders are separated into groups whenever the value in the Customer ID field changes.

StdDev({orders.AMOUNT}, {orders.CUSTOMER ID})

Calculates the standard deviation for the orders in each group of orders in the Orders field. The orders are separated into groups whenever the value in the Customer field changes.

Sum({orders.ORDER ID}, {orders.CUSTOMER ID})

Sums (totals) the orders in each group of orders in the Amount field. The orders are separated into groups whenever the value in the Customer ID field changes.

The following example is applicable to Crystal syntax:

SummaryFunction({orders.ORDER AMOUNT}, {customer.REGION}) % SummaryFunction({orders.ORDER AMOUNT})

Groups values in the Amount field by region, summarizes the values for each region group, and shows those values as a percentage of the summary value for the entire report.

Comments

In order to use this function to insert a group field in a formula, you must have already entered a group field in your report with identical parameters: same field, same sort and group by (trigger) field, same action (average, count, etc.).


SummaryFunction (fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is any valid date or Boolean field used to group the values in fld by.
  • cond is a text string indicating the condition of condFld that controls grouping. Valid strings for this argument depend on whether condFld contains date or Boolean values. For information about the available conditions, see Conditions for summary functions.
Returns

Fractional Number

Action

SummaryFunction (fld, condFld, cond) summarizes each group of values that is generated when the specified summary condition is met. These functions work just like SummaryFunction (fld, condFld), but, because they use a date or Boolean field as a sort and group by (trigger) field, they require a condition in addition to the other arguments.

Typical uses

Use these functions whenever you want to duplicate, in a formula, a summary:

  • that summarizes the values in a group
  • that uses a date or Boolean field as the sort and group by field.
Examples

The following examples are applicable to both Basic and Crystal syntax:

SummaryFunction({orders.ORDER ID}, {orders.ORDER DATE}, "monthly")

Summarizes the orders in each group of orders in the Orders field. The orders are separated into groups whenever the value in the Date field changes to a new month.

Count({orders.ORDER AMOUNT}, {orders.ORDER DATE}, "monthly")

Counts the number of orders in each group of orders in the Amount field (the total orders for each month). The orders are separated into groups whenever the value in the Date field changes to a new month.

DistinctCount({orders.CUSTOMER ID}, {orders.ORDER DATE}, "weekly")

Counts the number of different customers contacted, follow up contacts are excluded. Customers are separated into groups whenever the value in the Date field changes to a new week.

The following example is applicable to Crystal syntax:

(SummaryFunction({orders.ORDER AMOUNT}, {orders.ORDER AMOUNT}, "monthly")) % (SummaryFunction({order.ORDER AMOUNT}))

Groups values in the Amount field by month, summarizes the values for each month group, and shows those values as a percentage of the summary value for the entire report.

Comments

In order to use these functions to insert a group field in a formula, you must have already entered a group field in your report with identical parameters: same field, same sort and group by field, same date or Boolean condition, same action (average, count, etc.).


Average (fld), Average (fld, condFld), Average (fld, condFld, cond), Average (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to average the values that appear in your report. For example:

  • If a sales report includes a field that shows the amount of each order, you can compute the average of all the orders that appear on the report (a grand total average). For information on this kind of summary, see SummaryFunction (fld).
  • If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the average order per group (in this case, per state). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the average order per group based on a particular change in the date or Boolean field (in this case, per month). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
  • If you specify an array of individual values, you can also compute the average value in the set. For information on this kind of summary, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Average({orders.ORDER AMOUNT})

Calculates the average of all values in the Amount field.

Average ({orders.ORDER AMOUNT}, {customer.CUSTOMER ID})

Finds the average amount of a sale made to each customer.

The following example is applicable to Crystal syntax:

Average ([10,12,32,48])

Calculates the average of the values in an array of constants.

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to find the standard deviation of a set of values in your report. For example:

  • You can calculate the grand total standard deviation for all values in a field. For information about this kind of summary, see SummaryFunction (fld).
  • You can calculate the standard deviation for all values within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the standard deviation for all values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can compute the standard deviation of the values in the set. For information on this kind of summary, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

StdDev({file.RESULTS})

Calculates the standard deviation of all values in the Result field.

StdDev({orders.AMOUNT}, {orders.CUSTOMER ID})

Calculates the standard deviation for the orders in each group of orders in the Orders field. The orders are separated into groups whenever the value in the Customer field changes.

StdDev({file.RESULTS}, {file.DATE}, "daily")

Calculates the variation for each group of laboratory test results in the Results field. The test results are separated into groups whenever the value in the Date field changes to a new day.

StdDev({file.SCORES}, {file.NATURALIZED}, "any change")

Groups values in the Scores field based on whether or not the test taker is a naturalized citizen, and calculates the standard deviation for each group of scores.

The following example is applicable to Crystal syntax:

StdDev([({file.QTY1} * {file.PRICE1}),({file.QTY2} * {file.PRICE2}),({file.QTY3} * {file.PRICE3}), ({file.QTY4} * {file.PRICE4})])

Returns 36.60 where Qty1 = 2, Price1 = 10.00, Qty2 = 2, Price2 = 2.00, Qty3 = 10, Price3 = 3.00, and Qty4 = 8, Price4 = 11.00.

Comments

Standard deviation is calculated using the following technique:

  • It calculates the average (mean) value for the items in the sample.
  • It subtracts the average value from the value of each item.
  • It squares the difference for each item.
  • It adds the squared differences for all of the items in the sample.
  • It divides the sum by one less than the number of items in the sample (N - 1). The result is the variance. Compare this step to the PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x).
  • It calculates the square root of the variance to arrive at the standard deviation.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field.

    For more information on the valid strings for this argument, see Conditions for summary functions.

  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to find the population standard deviation of a set of values in your report. For example:

  • You can calculate the grand total population standard deviation for all values in a field. For information on this kind of summary, see SummaryFunction (fld).
  • You can calculate the population standard deviation for all values within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the population standard deviation for all values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can compute the population standard deviation of the values in the set. For information on this kind of summary, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

PopulationStdDev({file.SCORES})

Calculates the population standard deviation of all values in the Scores field for the entire report.

PopulationStdDev({orders. AMOUNT}, {orders.CUSTOMER ID})

Calculates the population standard deviation for the orders in each group of orders in the Amount field. The orders are separated into groups whenever the value in the Customer ID field changes.

PopulationStdDev({file.RESULTS}, {file.DATE}, "daily")

Calculates the variation for each group of laboratory test results in the Results field. The test results are separated into groups whenever the value in the Date field changes to a new day.

The following example is applicable to Crystal syntax:

PopulationStdDev([{file.QTY1}, {file.QTY2}, {file.QTY3}, {file.QTY4}])

Returns 3.57 where Qty1 = 2, Qty2 = 2, Qty3 = 10, and Qty4 = 8.

Comments

Population standard deviation is calculated using the following technique:

  • It calculates the average (mean) value for the items in the population.
  • It subtracts the average value from the value of each item.
  • It squares the difference for each item.
  • It adds the squared differences for all of the items in the population.
  • It divides the sum by the number of items in the population (N). The result is the population variance. Compare this step to the StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x).
  • It calculates the square root of the population variance to arrive at the population standard deviation.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see the Evaluation Time functions.


Variance (fld), Variance (fld, condFld), Variance (fld, condFld, cond), Variance (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to find the variance of a set of values in your report. For example:

  • You can calculate the grand total variance for all values in a field. For information about this kind of summary, see SummaryFunction (fld).
  • You can calculate the variance for all values within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the variance for all values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can compute the variance of the values in the set. For information on this kind of summary, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Variance({file.AMOUNT})

Calculates the variance of all values in the Amount field.

Variance({file.RESULTS}, {file.DATE},"daily")

Calculates the variation for each group of laboratory test results in the Results field. The test results are separated into groups whenever the value in the Date field changes to a new day.

The following examples are applicable to Crystal syntax:

Variance({file.SCORES}, {file.TEACHERS}) % Variance({file.TEACHERS})

Groups values in the Scores field by teacher, and calculates the variance for each teacher group as a percentage of the variance of the values for the entire report (for all teachers listed).

Variance([{file.QTY1}, {file.QTY2}, {file.QTY3}, {file.QTY4}])

Returns 17.00 where Qty1 = 2, Qty2 = 2, Qty3 = 10, and Qty4 = 8.

Comments

Variance is calculated using the following technique:

  • It calculates the average (mean) value for the items in the sample.
  • It subtracts the average value from the value of each item.
  • It squares the difference for each item.
  • It adds the squared differences for all of the items in the sample.
  • It divides the sum by one less than the number of items in the sample (N - 1). The result is the variance. Compare this final step to the PopulationVariance (fld), PopulationVariance (fld, condFld), PopulationVariance (fld, condFld, cond), PopulationVariance (x).

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


PopulationVariance (fld), PopulationVariance (fld, condFld), PopulationVariance (fld, condFld, cond), PopulationVariance (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to find the population variance of a set of values in your report. For example:

  • You can calculate the grand total population variance for all values in a field. For information on this kind of summary, see SummaryFunction (fld).
  • You can calculate the population variance for all values within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the population variance for all values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, seeSummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can compute the population variance of the values in the set. For information on this kind of summary, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

For examples of each PopulationVariance function, click on the corresponding summary function.

PopulationVariance({file.CENSUS})

Calculates the variance of all values in the Census field.

PopulationVariance({file.RESULTS}, {file.PROCEDURE})

Calculates the population variation for each group of laboratory test results in the Results field. The test results are separated into groups whenever the value in the Procedure field changes.

PopulationVariance({file.SCORES}, {file.NATURALIZED}, "any change")

Groups values in the Scores field based on whether or not the test taker is a naturalized citizen, and calculates the population variance for each group of scores.

The following examples are applicable to Crystal syntax:

PopulationVariance({file.SCORES}, {file.TEACHERS}) % PopulationVariance({file.TEACHERS})

Groups values in the Scores field by teacher, and calculates the population variance for each teacher group as a percentage of the population variance of the values for the entire report (for all teachers listed).

PopulationVariance([2,4,6,8,10])

Returns 8.

Comments

Population variance is calculated using the following technique:

  • It calculates the average (mean) value for the items in the population.
  • It subtracts the average value from the value of each item.
  • It squares the difference for each item.
  • It adds the squared differences for all of the items in the population.
  • It divides the sum by the number of items in the population (N). The result is the population variance. Compare this final step to the Variance (fld), Variance (fld, condFld), Variance (fld, condFld, cond), Variance (x).

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


Maximum (fld), Maximum (fld, condFld), Maximum (fld, condFld, cond), Maximum (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to find the maximum value that appears in a set of values. For example:

  • If a sales report includes a field that shows the amount of each order, you can find the highest order amount of all the orders that appear on the report (a grand total maximum amount). For information on finding this kind of maximum, see SummaryFunction (fld).
  • If you break orders into groups (for example, orders grouped by the state that they come from), you can find the highest order amount per group (in this case, per state). For information on finding this kind of maximum, see SummaryFunction (fld, condFld).
  • If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can find the highest order amount per group based on a specific change in the date or Boolean field (in this case, per month). For information on finding this kind of maximum, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can find the highest value in the set. For information on finding this kind of maximum, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Maximum({orders.ORDER AMOUNT})

Returns the highest value in the Amount field.

Maximum({orders.AMOUNT}, {orders.CUSTOMER ID})

Identifies the largest order in each group of orders in the Amount field (the largest order for each month). The orders are separated into groups whenever the value in the Customer ID field changes.

Maximum({orders.AMOUNT}, {orders.ORDER DATE}, "monthly")

Identifies the largest order in each group of orders in the Amount field (the largest order for each month). The orders are separated into groups whenever the value in the Date field changes to a new month.

The following example is applicable to Crystal syntax:

Maximum also allows you to set a floor on a calculation. For example: Maximum([{file.BALANCE}, 500]) sets a floor of 500 on the calculation. The expression will always return the balance unless the balance drops below 500. Then it will return the floor amount of 500. Thus:

Maximum([{file.PROFITS}, 500]) = {file.PROFITS}

Where Profits > 500.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


Minimum (fld), Minimum (fld, condFld), Minimum (fld, condFld, cond), Minimum (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to find the minimum value that appears in a set of values. For example:

  • If a sales report includes a field that shows the amount of each order, you can find the lowest order amount of all the orders that appear on the report (a grand total minimum amount). For information on finding this kind of minimum, see SummaryFunction (fld).
  • If you break orders into groups (for example, orders grouped by the state that they come from), you can find the lowest order amount per group (in this case, per state). For information on finding this kind of minimum, see SummaryFunction (fld, condFld).
  • If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can find the lowest order amount per group based on a specific change in the date or Boolean field (in this case, per month). For information on finding this kind of minimum, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can find the lowest value in the set. For information on finding this kind of minimum, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Minimum({file.QTY})

Returns the lowest value in the QTY field.

Minimum({orders.AMOUNT}, {orders.CUSTOMER ID})

Identifies the smallest order in each group of orders in the Amount field (the smallest order for each month). The orders are separated into groups whenever the value in the Customer ID field changes.

Minimum({orders.AMOUNT}, {orders.ORDER DATE}, "monthly")

Identifies the smallest order in each group of orders in the Amount field (the smallest order for each month). The orders are separated into groups whenever the value in the Date field changes to a new month.

The following example is applicable to Crystal syntax:

Minimum also allows you to set a ceiling on a calculation. For example: Minimum([{file.COMMISSION}, 2500]) returns the commission accrued up to a cap or ceiling of 2500. Once accrued commission passes the $2500 mark, this expression returns 2500. Thus:

Minimum([{file.COMMISSION}, 2500])

Returns 1575 where commission = 1575.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


Count (fld), Count (fld, condFld), Count (fld, condFld, cond), Count (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to count the values that appear in your report (for a specified field). For example:

  • If a sales report includes all orders made and the amount of each order, you can compute the total number of orders that appear on the report (a grand total count). For information on this kind of counting, see SummaryFunction (fld).
  • If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the number of orders per group (in this case, per state). For information on this kind of counting, see SummaryFunction (fld, condFld).
  • If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the number of orders per group based on a particular change in the date or Boolean field (in this case, per month). For information on this kind of counting, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can compute the number of values in the set. For information on this kind of counting, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Count({orders.AMOUNT}, {orders.CUSTOMER ID})

This formula counts the number of orders in each group of orders in the Amount field (the total orders for each month). The orders are separated into groups whenever the value in the Customer ID field changes.

Count({orders.ORDER AMOUNT}, {orders.ORDER DATE}, "monthly")

Counts the number of orders in each group of orders in the Amount field (the total orders for each month). The orders are separated into groups whenever the value in the Date field changes to a new month.

The following examples are applicable to Crystal syntax:

If Count({orders.ORDER ID}) >= 100 Then
"Congratulations on meeting your quota!"
Else
""

Prints the congratulatory message if the number of orders is 100 or more, and prints nothing if the number of orders is less than 100.

Count([1,2,3,4,5])

Returns 5. Counts the total number of values in the array.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


DistinctCount (fld), DistinctCount (fld, condFld), DistinctCount (fld, condFld, cond), DistinctCount (x)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • x is an array of values that can be evaluated by the function being used.
Returns

Fractional Number

Action

Enables you to get a distinct count of the values that appear in your report. For example:

  • If a sales report includes all orders made by customers, you can compute the total number of distinct customers that appear in the report (a grand total distinct count), excluding any duplicate records. If a customer made more than one order, the duplicate occurrences of that customer are ignored. For information on this kind of distinct count, see SummaryFunction (fld).
  • If you break orders into groups (for example, orders grouped by the state that they come from), you can compute the number of distinct customers per group (in this case, per state). Any customers that made more than one order and appear more than once in a group are only counted once. For information on this kind of distinct count, see SummaryFunction (fld, condFld).
  • If you break orders into date or Boolean groups (for example, orders grouped by the month in which they were placed), you can compute the number of distinct customers in each group based on a particular change in the date or Boolean field (in this case, the number of customers that placed orders each month). If a customer placed more than one order within the month, duplicate instances of that customer are ignored. For information on this kind of distinct count, see SummaryFunction (fld, condFld, cond).
  • If you specify a set of individual values, you can compute the number of distinct values in the set. Duplicate values in the set are only counted once. For information on this kind of distinct count, see Array summary functions (x).
Examples

The following examples are applicable to both Basic and Crystal syntax:

DistinctCount({customer.REGION})

Counts the number of different States represented in the Region field, ignores any repetitions.

DistinctCount({customer.CITY}, {customer.REGION})

Calculates the number of different cities in each State group.

DistinctCount({orders.CUSTOMER ID}, {orders.ORDER DATE}, "weekly")

Counts the number of different customers contacted, follow up contacts are excluded. Customers are separated into groups whenever the value in the Date field changes to a new week.

The following example is applicable to Crystal syntax:

DistinctCount([1,3,5,3,2,5])

Returns 4. Counts the number of distinct values in the array. Duplicate values are ignored.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.

Comments

DistinctCount counts the number of distinct values in a field. Duplicate values are ignored.


Correlation (fld, fld), Correlation (fld, fld, condFld), Correlation (fld, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • fld is any numeric field.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Fractional Number

Action

Enables you to calculate the correlation of the specified fields (that is, the degree to which the fields vary in the same manner). For example:

  • You can calculate the correlation of two fields, for all the records in the report.
  • You can calculate the correlation of two fields for all values within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the correlation of two fields for all the values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Correlation({Customer.CUSTOMER ID}, {Customer.CREDIT ID})

Calculates the correlation between the Customer ID and Credit ID fields.

Correlation({orders.CUSTOMER ID}, {orders.CREDIT ID}, {Customer.REGION})

Calculates the correlation between the Customer ID and Credit ID fields, for each region.

Correlation({orders.CUSTOMER ID}, {orders.CREDIT ID}, {Customer.REGION}, "monthly")

Calculates the correlation between the Customer ID and Credit ID fields for all the values within each Region group, for each month.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.

Comments

The correlation will always be a number between -1 and 1, unless the correlation is undefined, in which case the function is assigned a null value (0). If the correlation is 0, the fields are uncorrelated.


Covariance (fld, fld), Covariance (fld, fld, condFld), Covariance (fld, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • fld is any numeric field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Fractional Number

Action

Covariance is the measure of the linear relation between paired variables (that is, the tendency of two fields to vary together). Fields are covariant when they vary according to a specific mathematical relationship. The circumference of a circle and the radius of a circle are covariant.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Covariance({table.FIELD1}, {table.FIELD2})

Calculates the covariance of the two fields and returns the covariance as a fractional number.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.

Comments

Covariance is calculated using the following technique:

  • It calculates the average (mean) value for the items in each sample.
  • It subtracts the average value from the value of each item, in both samples.
  • It multiplies the differences for each pair of items.
  • It calculates the average (mean) value for all the products of that multiplication. The result is the covariance.


WeightedAverage (fld, fld), WeightedAverage (fld, fld, condFld), WeightedAverage (fld, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • fld is any valid numeric database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Fractional Number

Action

Enables you to calculate the weighted average of the specified fields. When you calculate a weighted average, you are actually calculating the average of one field and then using the values in another field to "weigh" the contribution of each value in the first field to the average. In a normal average, all the weights are equal to 1.

For example:

  • You can calculate the weighted average of two fields. For information about this kind of summary, see SummaryFunction (fld).
  • You can calculate the weighted average of two fields, for all the values within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the weighted average of two fields, for all the values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
Examples

The following examples are applicable to both Basic and Crystal syntax:

WeightedAverage({table.FIELD1}, {table.FIELD2})

Returns 1.75, where the two fields have four values each. Field1 has values of 3, 2, 5, and 1. Table2 has values of 0, 1, 1, and 0. WeightedAverage calculates as follows: (3*0 + 2*1 + 5*1 + 1*0)/4 = 1.75.

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the Evaluation Time functions.


Median (fld), Median (fld, condFld), Median (fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Fractional Number

Action

Calculates the median of the given numeric fields. The median is the middle value in a sequence of numeric values (or the average of the two middle values in an even-numbered sequence of values).

For example:

  • You can calculate the median of all the values in a field. For information on this kind of summary, see SummaryFunction (fld).
  • You can calculate the median of all the values in the field, within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the median of all the values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Median({Customer.LAST YEAR'S SALES})

Returns $29087, where the values of the Last Year's Sales field are $27014, $28000, $29087, $34500, and $48260.

Median({Customer.LAST YEAR'S SALES}, {Customer.REGION)

Groups the Last Year's Sales field by region and returns the median of the Last Year's Sales field per region.

Median({orders.ORDER AMOUNT}, {Customer.REGION}, "monthly")

Groups values in the Amount field by region, then returns the median of the order amount for each region per month.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


PthPercentile (P, fld), PthPercentile (P, fld, condFld), PthPercentile (P, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • P is any integer between 0 and 100.
  • fld is any Number or Currency field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field.

    For more information on the valid strings for this argument, see Conditions for summary functions.

Returns

Number or Currency value.

Action

Calculates the value for a specified percentile (P) in a Number or Currency field.

Examples

The following examples are applicable to both Basic and Crystal syntax:

PthPercentile(20, {Customer.LAST YEAR'S SALES})

Returns $2302 as the value at the 20th percentile (if 20% of {Customer.LAST YEAR'S SALES are less than $2302

PthPercentile(P, {Customer.LAST YEAR'S SALES}, {Customer.REGION})

Groups the Last Year's Sales field by region and returns the value at percentile P in the Last Year's Sales field per region.

PthPercentile(P,{orders.ORDER AMOUNT}, {Customer.REGION}, "monthly")

Groups values in the Amount field by region, then returns the value at percentile P in the Amount field for each region, per month.

Comments

P = 50 (the 50th Percentile) is the same value returned by the Median (fld), Median (fld, condFld), Median (fld, condFld, cond) function (the median value).

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


NthLargest (N, fld), NthLargest (N, fld, condFld), NthLargest (N, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • N is any integer.
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Fractional Number

Action

Determines the Nth largest value in a given field, either for the entire report or for each instance of the (condFld) group.

Examples

The following examples are applicable to both Basic and Crystal syntax:

NthLargest(1, {Customer.CUSTOMER ID}

Returns 50, where the Customer ID field contains numerical values ranging from 12 to 50.

NthLargest(5, {Customer.CUSTOMER NAME}, {Customer.REGION})

Returns the fifth largest value in the Customer Name field, per region.

NthLargest(1, {orders.ORDER AMOUNT}, {Customer.REGION}, "monthly")

Groups values in the Amount field by region, then returns the largest value in the Amount field for each region, per month.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


NthSmallest (N, fld), NthSmallest (N, fld, condFld), NthSmallest (N, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • N is any integer.
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Fractional Number

Action

Determines the Nth smallest value in a given field, either for the entire report or for each instance of the (condFld) group.

Examples

The following examples are applicable to both Basic and Crystal syntax:

NthSmallest (1, {Customer.CUSTOMER ID}

Returns 12, where the Customer ID field contains numerical values ranging from 12 to 50.

NthSmallest(1, {Customer.CUSTOMER NAME}, {Customer.REGION})

Returns the least value in the Customer Name field, per region.

NthSmallest({orders.ORDER AMOUNT}, {Customer.REGION}, "monthly")

Groups values in the Amount field by region, then returns the least value in the Amount field for each region, per month.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


Mode (fld), Mode (fld, condFld), Mode (fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Fractional Number

Action

Identifies the most frequently occurring value.

For example:

  • You can calculate the mode of all the values in a field. For information on this kind of summary, see SummaryFunction (fld).
  • You can calculate the mode of all the values in the field, within a group (for example, sales grouped by the state that they come from). For information on this kind of summary, see SummaryFunction (fld, condFld).
  • You can calculate the mode of all the values within a group in which grouping is controlled by changes in a date or Boolean field (for example, sales grouped by the month in which they were made). For information on this kind of summary, see SummaryFunction (fld, condFld, cond).
Examples

The following examples are applicable to both Basic and Crystal syntax:

Mode({Customer.CUSTOMER NAME})

Returns the mode (the most frequently occurring value) for the Customer Name field.

Mode({Customer.CUSTOMER NAME}, {Customer.REGION})

Groups values in the Customer Name field by region, and then returns the mode for the Customer Name field, per region.

Mode({Customer.CUSTOMER NAME}, {Customer.REGION}, "monthly")

Groups values in the Customer Name field by region, then returns the mode of the Customer Name field for each region, per month.

Comments

Mode works like NthMost Frequent when N = 1.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


NthMostFrequent (N, fld), NthMostFrequent (N, fld, condFld), NthMostFrequent (N, fld, condFld, cond)

Basic and Crystal syntax.

Arguments
  • N is any integer.
  • fld is any valid database or formula field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • Returns Fractional Number
Action

Determines the Nth most frequent value in a given field, either for the entire report or for each instance of the (condFld) group. If no values in the field appear more than once, the function will return the minimum value, by default.

Typical Uses

You can use this function to spotlight exceptionally high or exceptionally low values in a particular field.

Examples

The following examples are applicable to both Basic and Crystal syntax:

NthMostFrequent(1, {Customer.LAST YEAR'S SALES})

Returns $29087, where the value of $29087 appears most frequently in the Last Year's Sales field.

NthMostFrequent(2, {Customer.LAST YEAR'S SALES})

Returns $34700, where $34700 is the value that appears with the second highest frequency in the Last Year's Sales field.

NthMostFrequent(1, {Customer.LAST YEAR'S SALES}, {Customer.REGION})

Returns $48000 for one instance of the Customer.Region group, where $48000 is the value that appears most frequently in that group; returns $34000 for another instance of the group, where $34000 is the most frequent value for that occurrence of the group; and returns $9000 for a third instance of the group, where none of the values in this occurrence of the group are repeated, and $9000 is the lowest value.

Comments

When more than one value appears with the same frequency, the least value is considered the most frequent. For example, if

NthMostFrequent(1, {Customer.LAST YEAR'S SALES})

returns a value of $29087, and a value greater than $29087 (for example, $3500) appears with the same frequency, NthMostFrequent with N = 1 will still return $29087, since $29087 is the lesser value.

Note: Using this function in a formula forces the formula to be evaluated at print time.

For more information on evaluation time considerations, see Evaluation Time functions.


PercentOfSum

Basic and Crystal syntax.

Overloads
  • PercentOfSum (fld, condFld)
  • PercentOfSum (fld, condFld, cond)
  • PercentOfSum (fld, innerCondFld, outerCondFld)
  • PercentOfSum (fld, innerCondFld, innerCond, outerCondFld)
  • PercentOfSum (fld, innerCondFld, outerCondFld, outerCond)
  • PercentOfSum (fld, innerCondFld, innerCond, outerCondFld, outerCond)
Arguments
  • fld is a Number or Currency field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field.

    For more information on the valid strings for this argument, see Conditions for summary functions.

  • innerCondFld is a field used to group the values in fld by.
  • innerCond is a String indicating the type of grouping for innerCondFld. You only specify this argument when innerCondFld is a Date, Time, DateTime or Boolean field.
  • outerCondFld is a field used to group the values in fld by.
  • outerCond is a String indicating the type of grouping for outerCondFld. You only specify this argument when outerCondFld is a Date, Time, DateTime or Boolean field.

    For more information on the valid strings for this argument, see Conditions for summary functions.

Returns

Number value.

Action

PercentOfSum (fld, condFld) has the same effect as: 100 * Sum (fld, condFld) / Sum (fld). It expresses the sum of the values of the field fld for the group determined by condFld as a percentage of the grand total sum.

PercentOfSum (fld, condFld, cond) has the same effect as: 100 * Sum (fld, condFld, cond) / Sum (fld). The String argument cond expresses some additional information to precisely specify the grouping. For example, if condFld is a Date field, is the grouping "daily" or "weekly" or "monthly" etc.

PercentOfSum (fld, innerCondFld, outerCondFld) has the same effect as: 100 * Sum (fld, innerCondFld) / Sum (fld, outerCondFld). It expresses the sum of the values of the field fld for the group determined by innerCondFld as a percentage of the sum for the group determined by outerCondFld.

PercentOfSum (fld, innerCondFld, innerCond, outerCondFld) has the same effect as: 100 * Sum (fld, innerCondFld, innerCond) / Sum (fld, outerCondFld).

PercentOfSum (fld, innerCondFld, outerCondFld, outerCond) has the same effect as: 100 * Sum (fld, innerCondFld) / Sum (fld, outerCondFld, outerCond).

PercentOfSum (fld, innerCondFld, innerCond, outerCondFld, outerCond) has the same effect as: 100 * Sum (fld, innerCondFld, innerCond) / Sum (fld, outerCondFld, outerCond).

Examples

The following examples are applicable to both Basic and Crystal syntax:

PercentOfSum ({Orders.Order Amount}, {Orders.Order Date}, "annually")

Returns the total value of the orders that were ordered in a given year expressed as a percent of the total value of all orders.

PercentOfSum ({Orders.Order Amount}, {Orders.Ship Via})

Returns the total value of the orders shipped via a given shipping company expressed as a percent of the total value of all orders.

PercentOfSum ({Product.Price (SRP)}, {Product.Size}, {Product.Product Class})

Returns the total price of the products of a given size and class expressed as a percent of the total price of the products of the same given class.

Comment

This function and other percentage functions are intended to support Percentage Summary fields. The groupings supplied as arguments must actually exist in the report for the summary function call to succeed.


PercentOfAverage

Basic and Crystal syntax.

Overloads
    • PercentOfAverage (fld, condFld)
    • PercentOfAverage (fld, condFld, cond)
    • PercentOfAverage (fld, innerCondFld, outerCondFld)
    • PercentOfAverage (fld, innerCondFld, innerCond, outerCondFld)
    • PercentOfAverage (fld, innerCondFld, outerCondFld, outerCond)
    • PercentOfAverage (fld, innerCondFld, innerCond, outerCondFld, outerCond)
Arguments
  • fld is a Number or Currency field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field.
  • innerCondFld is a field used to group the values in fld by.
  • innerCond is a String indicating the type of grouping for innerCondFld. You only specify this argument when innerCondFld is a Date, Time, DateTime or Boolean field.
  • outerCondFld is a field used to group the values in fld by.
  • outerCond is a String indicating the type of grouping for outerCondFld. You only specify this argument when outerCondFld is a Date, Time, DateTime or Boolean field.

For more information on the valid strings for these arguments, see Conditions for summary functions.

Returns

Number value.

Action

PercentOfAverage (fld, condFld) has the same effect as: 100 * Average (fld, condFld) / Average (fld). It expresses the average of the values of the field fld for the group determined by condFld as a percentage of the average of all the values of fld.

PercentOfAverage (fld, condFld, cond) has the same effect as: 100 * Average (fld, condFld, cond) / Average (fld). The String argument cond expresses some additional information to precisely specify the grouping. For example, if condFld is a Date field, is the grouping "daily" or "weekly" or "monthly" etc.

PercentOfAverage (fld, innerCondFld, outerCondFld) has the same effect as: 100 * Average (fld, innerCondFld) / Average (fld, outerCondFld). It expresses the average of the values of the field fld for the group determined by innerCondFld as a percentage of the average for the group determined by outerCondFld.

PercentOfAverage (fld, innerCondFld, innerCond, outerCondFld) has the same effect as: 100 * Average (fld, innerCondFld, innerCond) / Average (fld, outerCondFld).

PercentOfAverage (fld, innerCondFld, outerCondFld, outerCond) has the same effect as: 100 * Average (fld, innerCondFld) / Average (fld, outerCondFld, outerCond).

PercentOfAverage (fld, innerCondFld, innerCond, outerCondFld, outerCond) has the same effect as: 100 * Average (fld, innerCondFld, innerCond) / Average (fld, outerCondFld, outerCond)

Comment

This function and other percentage functions are intended to support Percentage Summary fields. The groupings supplied as arguments must actually exist in the report for the summary function call to succeed.


PercentOfMaximum

Basic and Crystal syntax

Overloads
  • PercentOfMaximum (fld, condFld)
  • PercentOfMaximum (fld, condFld, cond)
  • PercentOfMaximum (fld, innerCondFld, outerCondFld)
  • PercentOfMaximum (fld, innerCondFld, innerCond, outerCondFld)
  • PercentOfMaximum (fld, innerCondFld, outerCondFld, outerCond)
  • PercentOfMaximum (fld, innerCondFld, innerCond, outerCondFld, outerCond)
Arguments
  • fld is a Number or Currency field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • innerCondFld is a field used to group the values in fld by.
  • innerCond is a String indicating the type of grouping for innerCondFld. You only specify this argument when innerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • outerCondFld is a field used to group the values in fld by.
  • outerCond is a String indicating the type of grouping for outerCondFld. You only specify this argument when outerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Number value.

Action

PercentOfMaximum (fld, condFld) has the same effect as: 100 * Maximum (fld, condFld) / Maximum (fld). It expresses the maximum of the values of the field fld for the group determined by condFld as a percentage of the maximum of all the values of fld.

PercentOfMaximum (fld, condFld, cond) has the same effect as: 100 * Maximum (fld, condFld, cond) / Maximum (fld). The String argument cond expresses some additional information to precisely specify the grouping. For example, if condFld is a Date field, is the grouping "daily" or "weekly" or "monthly" etc.

PercentOfMaximum (fld, innerCondFld, outerCondFld) has the same effect as: 100 * Maximum (fld, innerCondFld) / Maximum (fld, outerCondFld). It expresses the maximum of the values of the field fld for the group determined by innerCondFld as a percentage of the maximum for the group determined by outerCondFld.

PercentOfMaximum (fld, innerCondFld, innerCond, outerCondFld) has the same effect as: 100 * Maximum (fld, innerCondFld, innerCond) / Maximum (fld, outerCondFld)

PercentOfMaximum (fld, innerCondFld, outerCondFld, outerCond) has the same effect as: 100 * Maximum (fld, innerCondFld) / Maximum (fld, outerCondFld, outerCond).

PercentOfMaximum (fld, innerCondFld, innerCond, outerCondFld, outerCond) has the same effect as: 100 * Maximum (fld, innerCondFld, innerCond) / Maximum (fld, outerCondFld, outerCond).

Comment

This function and other percentage functions are intended to support Percentage Summary fields. The groupings supplied as arguments must actually exist in the report for the summary function call to succeed.


PercentOfMinimum

Basic and Crystal syntax.

Overloads
  • PercentOfMinimum (fld, condFld)
  • PercentOfMinimum (fld, condFld, cond)
  • PercentOfMinimum (fld, innerCondFld, outerCondFld)
  • PercentOfMinimum (fld, innerCondFld, innerCond, outerCondFld)
  • PercentOfMinimum (fld, innerCondFld, outerCondFld, outerCond)
  • PercentOfMinimum (fld, innerCondFld, innerCond, outerCondFld, outerCond)
Arguments
  • fld is a Number or Currency field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • innerCondFld is a field used to group the values in fld by.
  • innerCond is a String indicating the type of grouping for innerCondFld. You only specify this argument when innerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, seeConditions for summary functions.
  • outerCondFld is a field used to group the values in fld by.
  • outerCond is a String indicating the type of grouping for outerCondFld. You only specify this argument when outerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Number value.

Action

PercentOfMinimum (fld, condFld) has the same effect as: 100 * Minimum (fld, condFld) / Minimum (fld). It expresses the minimum of the values of the field fld for the group determined by condFld as a percentage of the minimum of all the values of fld.

PercentOfMinimum (fld, condFld, cond) has the same effect as: 100 * Minimum (fld, condFld, cond) / Minimum (fld). The String argument cond expresses some additional information to precisely specify the grouping. For example, if condFld is a Date field, is the grouping "daily" or "weekly" or "monthly" etc.

PercentOfMinimum (fld, innerCondFld, outerCondFld) has the same effect as: 100 * Minimum (fld, innerCondFld) / Minimum (fld, outerCondFld). It expresses the minimum of the values of the field fld for the group determined by innerCondFld as a percentage of the minimum for the group determined by outerCondFld.

PercentOfMinimum (fld, innerCondFld, innerCond, outerCondFld) has the same effect as: 100 * Minimum (fld, innerCondFld, innerCond) / Minimum (fld, outerCondFld).

PercentOfMinimum (fld, innerCondFld, outerCondFld, outerCond) has the same effect as: 100 * Minimum (fld, innerCondFld) / Minimum (fld, outerCondFld, outerCond).

PercentOfMinimum (fld, innerCondFld, innerCond, outerCondFld, outerCond) has the same effect as: 100 * Minimum (fld, innerCondFld, innerCond) / Minimum (fld, outerCondFld, outerCond).

Comment

This function and other percentage functions are intended to support Percentage Summary fields. The groupings supplied as arguments must actually exist in the report for the summary function call to succeed.


PercentOfCount

Basic and Crystal syntax.

Overloads
  • PercentOfCount (fld, condFld)
  • PercentOfCount (fld, condFld, cond)
  • PercentOfCount (fld, innerCondFld, outerCondFld)
  • PercentOfCount (fld, innerCondFld, innerCond, outerCondFld)
  • PercentOfCount (fld, innerCondFld, outerCondFld, outerCond)
  • PercentOfCount (fld, innerCondFld, innerCond, outerCondFld, outerCond)
Arguments
  • fld is a Number, Currency, String, Boolean, Date, Time or DateTime field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • innerCondFld is a field used to group the values in fld by.
  • innerCond is a String indicating the type of grouping for innerCondFld. You only specify this argument when innerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • outerCondFld is a field used to group the values in fld by.
  • outerCond is a String indicating the type of grouping for outerCondFld. You only specify this argument when outerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Number value.

Action

PercentOfCount (fld, condFld) has the same effect as: 100 * Count (fld, condFld) / Count (fld). It expresses the count of the values of the field fld for the group determined by condFld as a percentage of the count of all the values of fld.

PercentOfCount (fld, condFld, cond) has the same effect as: 100 * Count (fld, condFld, cond) / Count (fld). The String argument cond expresses some additional information to precisely specify the grouping. For example, if condFld is a Date field, is the grouping "daily" or "weekly" or "monthly" etc.

PercentOfCount (fld, innerCondFld, outerCondFld) has the same effect as: 100 * Count (fld, innerCondFld) / Count (fld, outerCondFld). It expresses the count of the values of the field fld for the group determined by innerCondFld as a percentage of the count for the group determined by outerCondFld.

PercentOfCount (fld, innerCondFld, innerCond, outerCondFld) has the same effect as: 100 * Count (fld, innerCondFld, innerCond) / Count (fld, outerCondFld).

PercentOfCount (fld, innerCondFld, outerCondFld, outerCond) has the same effect as: 100 * Count (fld, innerCondFld) / Count (fld, outerCondFld, outerCond).

PercentOfCount (fld, innerCondFld, innerCond, outerCondFld, outerCond) has the same effect as: 100 * Count (fld, innerCondFld, innerCond) / Count (fld, outerCondFld, outerCond).

Examples

The following examples are applicable to both Basic and Crystal syntax:

PercentOfCount ({Orders.Order ID}, {Orders.Order Date}, "annually")

Returns the total number of orders that were ordered in a given year expressed as a percent of the total number of all orders.

PercentOfCount ({Orders.Order ID}, {Orders.Ship Via})

Returns the total number of orders shipped via a given shipping company expressed as a percent of the total number of all orders.

PercentOfCount ({Product.Product ID}, {Product.Size}, {Product.Product Class})

Returns the total number of products of a given size and class expressed as a percent of the total number of products of the same given class.

Comment

This function and other percentage functions are intended to support Percentage Summary fields. The groupings supplied as arguments must actually exist in the report for the summary function call to succeed.


PercentOfDistinctCount

Basic and Crystal syntax.

Overloads
  • PercentOfDistinctCount (fld, condFld)
  • PercentOfDistinctCount (fld, condFld, cond)
  • PercentOfDistinctCount (fld, innerCondFld, outerCondFld)
  • PercentOfDistinctCount (fld, innerCondFld, innerCond, outerCondFld)
  • PercentOfDistinctCount (fld, innerCondFld, outerCondFld, outerCond)
  • PercentOfDistinctCount (fld, innerCondFld, innerCond, outerCondFld, outerCond)
Arguments
  • fld is a Number, Currency, String, Boolean, Date, Time or DateTime field that can be evaluated by the function.
  • condFld is a field used to group the values in fld by.
  • cond is a String indicating the type of grouping for condFld. You only specify this argument when condFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • innerCondFld is a field used to group the values in fld by.
  • innerCond is a String indicating the type of grouping for innerCondFld. You only specify this argument when innerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
  • outerCondFld is a field used to group the values in fld by.
  • outerCond is a String indicating the type of grouping for outerCondFld. You only specify this argument when outerCondFld is a Date, Time, DateTime or Boolean field. For more information on the valid strings for this argument, see Conditions for summary functions.
Returns

Number value.

Action

PercentOfDistinctCount (fld, condFld) has the same effect as: 100 * DistinctCount (fld, condFld) / DistinctCount (fld). It expresses the distinct count of the values of the field fld for the group determined by condFld as a percentage of the distinct count of all the values of fld.

PercentOfDistinctCount (fld, condFld, cond) has the same effect as: 100 * DistinctCount (fld, condFld, cond) / DistinctCount (fld). The String argument cond expresses some additional information to precisely specify the grouping example: if condFld is a Date field, is the grouping "daily" or "weekly" or "monthly" etc.

PercentOfDistinctCount (fld, innerCondFld, outerCondFld) has the same effect as: 100 * DistinctCount (fld, innerCondFld) / DistinctCount (fld, outerCondFld). It expresses the distinct count of the values of the field fld for the group determined by innerCondFld as a percentage of the distinct count for the group determined by outerCondFld.

PercentOfDistinctCount (fld, innerCondFld, innerCond, outerCondFld) has the same effect as: 100 * DistinctCount (fld, innerCondFld, innerCond) / DistinctCount (fld, outerCondFld).

PercentOfDistinctCount (fld, innerCondFld, outerCondFld, outerCond) has the same effect as: 100 * DistinctCount (fld, innerCondFld) / DistinctCount (fld, outerCondFld, outerCond)

PercentOfDistinctCount (fld, innerCondFld, innerCond, outerCondFld, outerCond) has the same effect as: 100 * DistinctCount (fld, innerCondFld, innerCond) / DistinctCount (fld, outerCondFld, outerCond).

Comment

This function and other percentage functions are intended to support Percentage Summary fields. The groupings supplied as arguments must actually exist in the report for the summary function call to succeed.


Financial functions

Click the function of interest from the following list for further information:

DDB

FV

IPmt

IRR

MIRR (values, financeRate, reinvestRate)

NPer

NPV (rate, values)

Pmt

PPmt

PV

Rate

SLN (cost, salvage, life)

SYD (cost, salvage, life, period)


DDB

Basic and Crystal syntax.

Overloads
  • DDB (cost, salvage, life, period)
  • DDB (cost, salvage, life, period, factor)
Arguments
  • cost is a Number or Currency that specifies the initial cost of the asset. The value is nonnegative and greater than or equal to salvage.
  • salvage is a Number or Currency that specifies the value of the asset at the end of its useful life. The value is nonnegative.
  • life is a positive Number that specifies the length of the useful life of the asset.
  • period is a Number that specifies the period for which asset depreciation is calculated. The value is positive and less than or equal to life. The arguments life and period must have the same units.
  • factor is an optional positive Number that specifies the rate at which the balance declines. If omitted, 2 (double-declining method) is assumed.
Returns

Number value

Action

DDB returns a Number specifying the depreciation of an asset for a specific time period, using the double-declining balance method or some other method as specified by the factor argument.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Suppose a company purchases a fleet of cars for $500,000. The cars have a lifetime of 10 years and a salvage value of $60,000. They are depreciated using the double-declining method.

DDB (500000, 60000, 10, 1)

Returns 100000. The first year's depreciation is $100,000.

DDB (500000, 60000, 10, 4)

Returns 51200. The fourth year's depreciation is $51,200.

DDB (500000, 60000, 10, 10)

Returns 7108.864. The final year's depreciation is $7,108.86.

Comment

This function is designed to work like the Visual Basic function of the same name.


FV

Basic and Crystal syntax.

Overloads
  • FV (rate, nPeriods, payment)
  • FV (rate, nPeriods, payment, presentValue)
  • FV (rate, nPeriods, payment, presentValue, type)
Arguments
  • rate is a Number that specifies the interest rate per period.
  • nPeriods is a positive Number that specifies the total number of payment periods in the annuity. The units used for specifying rate and nPeriods must consistent. For example, if nPeriods is the number of periods in months, then rate is a monthly interest rate.
  • payment is a Number or Currency that specifies the payment to be made each period.
  • presentValue is an optional Number or Currency that specifies the present value of a series of future payments.
  • Type is an optional Number that specifies when payments are due. Specify 0 if payments are due at the end of the payment period, and 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Returns

Number value

Action

FV returns a Number specifying the future value of an annuity based on periodic, fixed payments and a fixed interest rate.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Suppose that you put $1000 per month into a retirement savings plan that pays 6 percent annual interest, compounded monthly. How much will the account be worth after 20 years?

FV (0.06 / 12, 20 * 12, -1000)

Returns 462041 (rounded to the nearest integer). So your account will have $462,041. The payment (-1000) is negative since you are paying out the money to the plan.

The above example assumes that you made your payments into the plan at the end of the month. Thus after the first month, your plan would have only $1000 in it, since there was no time for interest to accrue. Suppose that instead you make your payments at the start of the month:

FV (0.06 / 12, 20 * 12, -1000, 0, 1)

Returns 464351 (rounded to the nearest integer). So your account will have $464,351. You will save $2,310 more by depositing at the beginning of the month.

Now suppose that in addition to making payments at the start of the month, you start your plan with an initial deposit of $20,000.

FV (0.06 / 12, 20 * 12, -1000, -20000, 1)

Returns 530555 (rounded to the nearest integer). Your account will have $530,555 after 20 years.

You can also use the FV function to calculate the future value of a lump sum deposit. For example, if you deposit $20,000 in to a plan that pays 6 percent annual interest compounded monthly for 20 years:

FV (0.06 / 12, 20 * 12, 0, -20000)

Returns 66204 (rounded to the nearest integer). Thus you would have $66,204 in your account. This is also equal to the difference of the previous 2 examples ($530,555 - $464,351).

Comment

This function is designed to work like the Visual Basic function of the same name.


IPmt

Basic and Crystal syntax.

Overloads
  • IPmt (rate, period, nPeriods, presentValue)
  • IPmt (rate, period, nPeriods, presentValue, futureValue)
  • IPmt (rate, period, nPeriods, presentValue, futureValue, type)
Arguments
  • rate is a Number that specifies the interest rate per period.
  • period is a Number that specifies the payment period in the range 1 through nPeriods.
  • nPeriods is a positive Number that specifies the total number of payment periods in the annuity. The units used for specifying rate, period and nPeriods must be consistent. For example, if nPeriods is the number of periods in months, then rate is a monthly interest rate and period specifies a month.
  • presentValue is a Number or Currency that specifies the present value, or value today, of a series of future payments or receipts.
  • futureValue is an optional Number or Currency that specifies the future value or cash balance you want after you've made the final payment. If omitted, 0 is assumed.
  • type is an optional Number that specifies when payments are due. Specify 0 if payments are due at the end of the payment period, and 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Returns

Number value

Action

IPmt returns a Number specifying the interest payment for a given period of an annuity based on periodic, fixed payments and a fixed interest rate.

Examples

The following example is applicable to both Basic and Crystal syntax:

Suppose that you want to take out a $250,000 loan payable monthly over 15 years at an annual interest rate of 7 percent. The following formula returns the amount of interest that you pay in your first loan payment. Note that the monthly interest rate is 0.07 / 12 and the number of months of the loan is 15 * 12.

IPmt (0.07 / 12, 1, 15 * 12, 250000)

Returns the Number value -1458.33 (rounded to 2 decimals). The value is negative because it represents a payment out from you whereas the loan amount of $250,000 is positive because it represents a payment in to you.

The following formula returns the amount of interest that you pay in your 121st payment (after 10 years of payments):

IPmt (0.07 / 12, 10*12 + 1, 15 * 12, 250000)

Returns -661.98 (rounded to 2 decimals). You've made progress on the loan and so less of your monthly payment is for paying interest.

Comment

This function is designed to work like the Visual Basic function of the same name.


IRR

Basic and Crystal syntax.

Overloads
  • IRR (values)
  • IRR (values, guess)
Arguments
  • values is a Number or Currency type array that specifies cash flow values. The array must contain at least one negative value (a payment) and one positive value (a receipt). The cash flows must occur at regular intervals such as monthly or yearly.
  • guess is an optional Number value that is estimated to be returned by IRR. If omitted, guess is 0.1 (10 percent).
Returns

Number value

Action

IRR returns a Number specifying the internal rate of return for a series of periodic cash flows (payments and receipts).

Example

The following example is applicable to both Basic and Crystal syntax:

Suppose that you can choose one of two offers: $20,000 now or guaranteed payments of $5,000 after 1 year, $10,000 after 2 years and $15,000 after 3 years. What is the better offer? One way to quantify this is to calculate the internal rate of return. If you take the second offer, you can't take the first so that is like experiencing an initial payment of $20,000 followed by the receipts:

Rem Basic syntax
formula = IRR (Array(-20000, 5000, 10000, 15000))

//Crystal syntax
IRR ([-20000, 5000, 10000, 15000])

Returns 0.194 (rounded to 3 decimals) or 19.4 percent interest. So all other things being equal, if you think that 19.4 percent is a good rate of return, you would prefer the second offer.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • The NPV and IRR functions are related since NPV (IRR (values), values) = 0. That is, the internal rate of return of a sequence of cash flows is the interest rate for which that sequence of cash flows has a net present value of 0.
  • There is no direct formula for the IRR function and so Seagate Crystal Reports calculates the value by iteration. The process depends on the initial guess for the internal rate of return. If the program reports an error, try changing the value of the guess argument to be closer to what you expect the internal rate of return should be.


MIRR (values, financeRate, reinvestRate)

Basic and Crystal syntax.

Arguments
  • values is a Number or Currency type array that specifies cash flow values. The array must contain at least one negative value (a payment) and one positive value (a receipt). The cash flows must occur at regular intervals such as monthly or yearly.
  • financeRate is a Number that specifies the interest rate paid as the cost of financing.
  • reinvestRate is a Number that specifies the interest rate received on gains from cash reinvestment.
Returns

Number value

Action

MIRR returns a Number specifying the modified internal rate of return for a series of periodic cash flows (payments and receipts).

Example

The following example is applicable to both Basic and Crystal syntax:

Suppose that you run a business that makes equipment investments, which result in a loss in your first and fourth years. Your expected annual returns are: -$50,000, $40,000, $65,000, -$60,000, $50,000, $70,000. Your losses are financed at 10 percent while you reinvest your earnings in an account at 6 percent. The modified internal rate of return is:

Rem Basic syntax
formula = MIRR(Array(-50000, 40000, 65000, -60000, 50000, 70000), 0.10, 0.06)

//Crystal syntax
MIRR([-50000, 40000, 65000, -60000, 50000, 70000], 0.10, 0.06)

Returns 0.214 (rounded to 3 decimals) or 21.4 percent.

Comment

This function is designed to work like the Visual Basic function of the same name.


NPer

Basic and Crystal syntax.

Overloads
  • NPer (rate, payment, presentValue)
  • NPer (rate, payment, presentValue, futureValue)
  • NPer (rate, payment, presentValue, futureValue, type)
Arguments
  • rate is a Number that specifies the interest rate per period.
  • payment is a Number or Currency that specifies the payment to be made each period. Payments usually contain principal and interest that doesn't change over the life of the annuity.
  • presentValue is a Number or Currency that specifies the present value, or value today, of a series of future payments or receipts.
  • futureValue is an optional Number or Currency that specifies the future value or cash balance you want after you've made the final payment. If omitted, 0 is assumed.
  • type is an optional Number that specifies when payments are due. Specify 0 if payments are due at the end of the payment period, and 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Returns

Number value

Action

NPer returns a Number specifying the number of periods for an annuity based on periodic, fixed payments and a fixed interest rate.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Suppose that you want a $200,000 loan to buy a house. The interest rate is 7 percent and you can afford to pay $2500 per month. How long of a mortgage do you need?

NPer (0.07/12, -2500, 200000)

Returns 108.08 (rounded to 2 decimals) months. That is 108.08 / 12 = 9 years.

Rather than seeking a loan, suppose that you want to save up $200,000 and then buy the house. You can get a 7 percent interest rate compounded monthly from your savings plan and want to save $2500 per month. How long will you need to save to have the money?

NPer (0.07/12, -2500, 0, 200000)

Returns 65.85 (rounded to 2 decimals) months. That is about 5.5 years.

Comment

This function is designed to work like the Visual Basic function of the same name.


NPV (rate, values)

Basic and Crystal syntax.

Arguments
  • rate is a Number that specifies the discount rate over the length of the period, expressed as a decimal.
  • values is a Number or Currency type array that specifies cash flow values. Negative values represent payments and positive values receipts. The cash flows must occur at regular intervals such as monthly or yearly.
Returns

Number value

Action

NPV returns a Number specifying the net present value of an investment based on a series of periodic cash flows (payments and receipts) and a discount rate.

Example

The following example is applicable to both Basic and Crystal syntax:

Suppose that someone offers to pays you $1000 after 1 year, $2000 after 2 years, $1500 after 3 years and $1200 after 4 years. If the discount rate (the time value of money) is 5 percent, the value of this offer to you today is:

Rem Basic syntax
formula = NPV (0.05, Array (1000, 2000, 1500, 1200))

//Crystal syntax
NPV (0.05, [1000, 2000, 1500, 1200])

The formula returns 5049.44 (rounded to 2 decimals). So this scheme is worth $5,049.44 to you today. This is less than the sum of the payments, which is $5700, since you have to wait for this money.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • The NPV and IRR functions are related since NPV (IRR (values), values) = 0. That is, the internal rate of return of a sequence of cash flows is the discount rate for which that sequence of cash flows has a net present value of 0.


Pmt

Basic and Crystal syntax.

Overloads
  • Pmt (rate, nPeriods, presentValue)
  • Pmt (rate, nPeriods, presentValue, futureValue)
  • Pmt (rate, nPeriods, presentValue, futureValue, type)
Arguments
  • rate is a Number that specifies the interest rate per period.
  • nPeriods is a positive Number that specifies the total number of payment periods in the annuity. The units used for specifying rate and nPeriods must consistent. For example, if nPeriods is the number of periods in months, then rate is a monthly interest rate.
  • presentValue is a Number or Currency that specifies the present value or principal. That is, the amount that a series of payments in the future is worth now.
  • futureValue is an optional Number or Currency that specifies the future value or cash balance you want after you've made the final payment. If omitted, 0 is assumed.
  • type is an optional Number that specifies when payments are due. Specify 0 if payments are due at the end of the payment period, and 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Returns

Number value

Action

Pmt returns a Number specifying the payment for an annuity based on periodic, fixed payments and a fixed interest rate.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Suppose that you want to take out a $250,000 loan payable monthly over 15 years at an annual interest rate of 7 percent. The following formula returns your monthly loan payment. Note that the monthly interest rate is 0.07 / 12 and the number of months of the loan is 15 * 12.

Pmt (0.07 / 12, 15 * 12, 250000)

Returns the Number value -2247.07 (rounded to 2 decimals). The value is negative because it represents a payment out from you whereas the loan amount of $250,000 is positive because it represents a payment in to you.

Now suppose that the payments are made at the beginning of the month instead of the end (as is the default). Your monthly loan payment is calculated as:

Pmt (0.07 / 12, 15 * 12, 250000, 0, 1)

Returns -2234.04 (rounded to 2 decimals). Note that your monthly payment is about $13 less each month than in the previous example where payments are made at the end of the month.

Now suppose that you know that you'll receive $100,000 in 15 years so there is no need to fully pay off the loan; only to reduce the amount owed to $100,000 after 15 years. Note that the future value is negative since after 15 years you need to pay out $100,000 to clear the loan. Your monthly loan payment is calculated as:

Pmt (0.07 / 12, 15 * 12, 250000, -100000)

Returns -1931.58 (rounded to 2 decimals).

Comment
  • This function is designed to work like the Visual Basic function of the same name.
  • To find the total amount paid out over the whole loan, multiply the payment per period (the value returned by Pmt) by the total number of periods (nPeriods).


PPmt

Basic and Crystal syntax.

Overloads
  • PPmt (rate, period, nPeriods, presentValue)
  • PPmt (rate, period, nPeriods, presentValue, futureValue)
  • PPmt (rate, period, nPeriods, presentValue, futureValue, type)
Arguments
  • rate is a Number that specifies the interest rate per period.
  • period is a Number that specifies the payment period in the range 1 through nPeriods.
  • nPeriods is a positive Number that specifies the total number of payment periods in the annuity. The units used for specifying rate, period and nPeriods must be consistent. For example, if nPeriods is the number of periods in months, then rate is a monthly interest rate and period specifies a month.
  • presentValue is a Number or Currency that specifies the present value, or value today, of a series of future payments or receipts.
  • futureValue is an optional Number or Currency that specifies the future value or cash balance you want after you've made the final payment. If omitted, 0 is assumed.
  • type is an optional Number that specifies when payments are due. Specify 0 if payments are due at the end of the payment period, and 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Returns

Number value

Action

PPmt returns a Number specifying the principal payment for a given period of an annuity based on periodic, fixed payments and a fixed interest rate.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Suppose that you want to take out a $250,000 loan payable monthly over 15 years at an annual interest rate of 7 percent. The following formula returns the amount of principal that you pay in your first loan payment. Note that the monthly interest rate is 0.07 / 12 and the number of months of the loan is 15 * 12.

PPmt (0.07 / 12, 1, 15 * 12, 250000)

Returns the Number value -788.74 (rounded to 2 decimals). The value is negative because it represents a payment out from you whereas the loan amount of $250,000 is positive because it represents a payment in to you.

The following formula returns the amount of principal that you pay in your 121st payment (after 10 years of payments):

PPmt (0.07 / 12, 10*12 + 1, 15 * 12, 250000)

Returns -1585.09 (rounded to 2 decimals). You've made progress on the loan and are paying off more of the principal per payment. This is because less interest can accrue each month since more of the loan is paid off so that your fixed monthly payment is applied more to the principal.

The following Basic syntax formula returns the amount of the loan that has been paid off after 10 years by summing up the principal payments made for the first 120 monthly payment:

Rem Basic syntax
Dim total, i
total = 0
For i = 1 To 10 * 12
total = total + PPmt (0.07 / 12, i, 15 * 12, 250000)
Next i
formula = total

Returns -136518.45 (rounded to 2 decimals). So you have paid off $136,518.45 of the loan and still owe $113,481.55 after the 120th payment.

Another way to calculate the amount you still owe after 10 years is to use 2 financial functions:

Rem Basic syntax
Dim payment
payment = Pmt (0.07 / 12, 15 * 12, 250000)
formula = FV (0.07 / 12, 10 * 12, payment, 250000)

Returns -113481.55 (rounded to 2 decimals). So you still owe $113, 481.55 after 10 years of payments.

Comment

This function is designed to work like the Visual Basic function of the same name.


PV

Basic and Crystal syntax.

Overloads
  • PV (rate, nPeriods, payment)
  • PV (rate, nPeriods, payment, futureValue)
  • PV (rate, nPeriods, payment, futureValue, type)
Arguments
  • rate is a Number that specifies the interest rate per period.
  • nPeriods is a positive Number that specifies the total number of payment periods in the annuity. The units used for specifying rate and nPeriods must consistent. For example, if nPeriods is the number of periods in months, then rate is a monthly interest rate.
  • payment is a Number or Currency that specifies payment to be made each period.
  • futureValue is an optional Number or Currency that specifies the future value or cash balance you want after you've made the final payment. If omitted, 0 is assumed.
  • type is an optional Number that specifies when payments are due. Specify 0 if payments are due at the end of the payment period, and 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
Returns

Number value

Action

PV returns a Number specifying the present value of an annuity based on periodic, fixed payments to be paid in the future and a fixed interest rate.

Example

The following example is applicable to both Basic and Crystal syntax:

Suppose that you want to buy a condo and can make payments of $1100 twice a month (24 annual payments). If the mortgage rates are 7 percent, and you want to pay off the condo in 10 years, what is the maximum loan that you can take out?

PV (0.07 / 24, 10 * 24, -1100)

Returns 189668 (rounded to the nearest dollar). Thus you can afford a loan of about $190,000. Notice that the payment argument is negative since you are paying out the money each month.

Comment

This function is designed to work like the Visual Basic function of the same name.


Rate

Basic and Crystal syntax.

Overloads
  • Rate (nPeriods, payment, presentValue)
  • Rate (nPeriods, payment, presentValue, futureValue)
  • Rate (nPeriods, payment, presentValue, futureValue, type)
  • Rate (nPeriods, payment, presentValue, futureValue, type, guess)
Arguments
  • nPeriods is a positive Number that specifies the total number of payment periods in the annuity.
  • payment is a Number or Currency that specifies payment to be made each period.
  • presentValue is a Number or Currency that specifies the present value, or value today, of a series of future payments or receipts.
  • futureValue is an optional Number or Currency that specifies the future value or cash balance you want after you've made the final payment. If omitted, 0 is assumed.
  • type is an optional Number that specifies when payments are due. Specify 0 if payments are due at the end of the payment period, and 1 if payments are due at the beginning of the period. If omitted, 0 is assumed.
  • guess is an optional Number value that is estimated to be returned by Rate. If omitted, guess is 0.1 (10 percent).
Returns

Number value

Action

Rate returns a Number specifying the interest rate per period for an annuity. The units of the returned value are consistent with the units of nPeriods. For example, if nPeriods is in months, then the rate returned will be a monthly interest rate.

Examples

The following examples are applicable to both Basic and Crystal syntax:

An electronics store offers to finance a $1500 television for $70 per month, over 2 years, with no money down. Is this a good deal? A first step to determine this is to figure out what interest rate the store is charging:

Rate (2 * 12, -70, 1500)

Returns 0.00927 (rounded to 5 decimals). Notice that nPeriods is 24 months, payment (-70) is negative since you are paying out the monthly payments, and the present value (1500) is positive since at the start of the loan, you effectively received $1500 (the value of the television). The interest rate returned is a monthly interest rate, since nPeriods was in months.

This next expression calculates the interest rate but expressed as a yearly interest rate and as a percent.

Rate (2 * 12, -70, 1500) * 12 * 100

Returns 11.1 (rounded to 1 decimal). Thus, the store is charging an effective annual interest rate of 11.1 percent.

Comment
  • This function is designed to work like the Visual Basic function of the same name.
  • There is no direct formula for the Rate function and so Seagate Crystal Reports calculates the value by iteration. The process depends on the initial guess for the rate. If the program reports an error, try changing the value of the guess argument to be closer to what you expect the interest rate should be.


SLN (cost, salvage, life)

Arguments
  • cost is a Number or Currency that specifies the initial cost of the asset.
  • salvage is a Number or Currency that specifies the value of the asset at the end of its useful life.
  • life is a Number that specifies the length of the useful life of the asset. It must not equal 0.
Returns

Number value

Action

SLN returns a Number specifying the straight-line depreciation of an asset for a single period.

Example

The following examples is applicable to both Basic and Crystal syntax:

Suppose a company purchases a fleet of cars for $500,000. The cars have a lifetime of 10 years and a salvage value of $60,000. The depreciation per year is:

SLN (500000, 60000, 10)

Returns 44000. Thus the depreciation per year is $44,000.

Comment

This function is designed to work like the Visual Basic function of the same name.


SYD (cost, salvage, life, period)

Basic and Crystal syntax.

Arguments
  • cost is a Number or Currency that specifies the initial cost of the asset.
  • salvage is a Number or Currency that specifies the value of the asset at the end of its useful life.
  • life is a positive Number that specifies the length of the useful life of the asset.
  • period is a Number that specifies the period for which asset depreciation is calculated. The value is positive and less than or equal to life. The arguments life and period must have the same units.
Returns

Number value

Action

SYD returns a Number specifying the sum-of-years' digits depreciation of an asset for a single period.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Suppose a company purchases a fleet of cars for $500,000. The cars have a lifetime of 10 years and a salvage value of $60,000. They are depreciated as follows:

SYD (500000, 60000, 10, 1)

Returns 80000. The first year's depreciation is $80,000.

SYD (500000, 60000, 10, 4)

Returns 56000. The fourth year's depreciation is $56,000.

SYD (500000, 60000, 10, 10)

Returns 8000. The final year's depreciation is $8,000.

Comment

This function is designed to work like the Visual Basic function of the same name.


String functions

String functions are used for the evaluation, manipulation and conversion of text strings.

Len (str)

Length (str)

Trim (str)

LTrim (str)

TrimLeft (str)

RTrim (str)

TrimRight (str)

UCase (str)

UpperCase (str)

LCase (str)

LowerCase (str)

StrReverse (inputString)

IsNumeric (str)

NumericText (str)

ToNumber (numeric), ToNumber (string)

ToText

ToWords (x), ToWords (x, #places)

ReplicateString (str, #copies)

Space (x)

InStr (str1, str2), InStr (start, str1, str2)

InStrRev

StrCmp (str1, str2), StrCmp (str1, str2, compare)

Mid (str, start), Mid (str, start, length)

Left (str, length)

Right (str, length)

Val (str)

Chr (x)

Asc (str)

Filter

Replace

Join

Split


Len (str)

Len and Length (str) are equivalent functions. However, Len is preferred in Basic syntax whereas Length is preferred in Crystal syntax.

Argument

str is a text String value

Returns

Whole number

Action

Len returns a Number indicating the length of the given string.

Note: Text strings must be enclosed in quotation marks. Any blank spaces are included as part of the character count.

Typical use

Use this function any time you have a manipulation, comparison, or calculation that is dependent on the length of a text string.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Len("Account")

Returns 7.

Len("Text String")

Returns 11. The blank space between "Text" and "String" is counted as a character.

Len(" Center ")

Returns 10. There are 2 spaces on either side of the word "Center".

Len(ToText({orders.ORDER AMOUNT}))

Returns 9, where {orders.ORDER AMOUNT} is 14233.08, and ToText ({orders.ORDER AMOUNT}) returns the String "14,233.08". Here, the comma and period have been specified in the Number format for the formula field as the thousands and decimal separators respectively.

Len(ToText({orders.ORDER AMOUNT}, 2, "", "."))

Returns 8 where {orders.ORDER AMOUNT} = 14233.08, and ToText ({orders.ORDER AMOUNT}, 2, "", ".") returns the String "14233.08". Here, the null character and period have been specified in the Number format for the formula field as the thousands and decimal separators respectively.

Len({customer.CUSTOMER NAME})

The length of the text string stored as a value in {customer.CUSTOMER NAME}.

The following examples are applicable to Basic syntax:

{customer.CUSTOMER NAME} (Len({customer.CUSTOMER NAME})-2)

Returns the third character from the right in the Customer Name. This can also be used to extract a substring from a String that always starts at a fixed position from the end of the String.

In the following example, an address line contains the province name and postal code. Full province names are of different lengths; however, a postal code has a fixed number of characters: the first character of the postal code is always the seventh from the last character in the String. The formula determines the length of the address line, subtracts 7 from it, and uses the result to identify the first character of the postal code in the address line.

Dim addressLine As String
Dim addressLen As Number
addressLine = "British Columbia V6X 3W2"
addressLen = Len (addressLine)
formula = addressLine (addressLen-7+1 To addressLen)

Returns the String "V6X 3W2".

Comments

This function is designed to work like the Visual Basic function of the same name.


Length (str)

Length and Len (str) are equivalent functions. However, Length is preferred in Crystal syntax whereas Len is preferred in Basic syntax.

Arguments

str is a text value.

Returns

Whole Number

Action

Length returns the number of characters in a text string that you enter into the formula, or in a text string stored as a value in a data field.

Note: Text strings must be enclosed in either double or single quotation marks (" " or ` '). Any blank spaces are included as part of the character count.

Typical uses

Use this function any time you have a manipulation, comparison, or calculation that is dependent on the length of a text string.

Examples

The following examples are applicable to both Basic and Crystal syntax, although Len is preferred in the latter:

Length("Account")

Returns 7.

Length("Text_String")

Returns 11.

Length("__Center__")

Returns 10.

Length(ToText({orders.ORDER AMOUNT}))

Returns 9, where {orders.ORDER AMOUNT} is 14233.08, and ToText ({orders.ORDER AMOUNT}) returns the String "14,233.08". Here, the comma and period have been specified in the Number format for the formula field as the thousands and decimal separators respectively,

Length(ToText({orders.ORDER AMOUNT}, 2, "", "."))

Returns 8 where {orders.ORDER AMOUNT} = 14233.08, and ToText ({orders.ORDER AMOUNT}, 2, "", ".") returns the String "14233.08". Here, the null character and period have been specified in the Number format for the formula field as the thousands and decimal separators respectively.

Length("BOB")

Returns 3.

Length("SMITH")

Returns 5.

Length("BOB SMITH")

Returns 9. (The blank space between BOB and SMITH is counted as a character.)

Length({customer.CUSTOMER NAME})

The length of the text string stored as a value in {customer.CUSTOMER NAME}.

The following examples are applicable to Crystal syntax.

{customer.CUSTOMER NAME}[Length({customer.CUSTOMER NAME})-2]

Returns the third character from the right in the Customer Name. This can also be used to extract a substring from a String that always starts at a fixed position from the end of the String.

In the following example, an address line contains the province name and postal code. Full province names are of different lengths, but the first character of the postal code is always the seventh from the last character. The formula determines the length of the address line, subtracts 7 from it, and uses the result to identify the first character of the postal code in the address line.

Local StringVar addressLine;
Local NumberVar addrLength;
addressLine := "British Columbia V6X 3W2";
addrLength := Length (addressLine);
addressLine [addrLength-7+1 to addrLength]

Related topics

Formula 14


Trim (str)

Basic and Crystal syntax.

Arguments

str is a text string to be trimmed.

Returns

Text String

Action

The Trim function removes leading and trailing spaces from string arguments.

Typical uses

Use this function any time there are leading and/or trailing blanks in a text object that may interfere with an alignment of text strings, a character count, or with a calculation (if the string is eventually converted to a Number).

Examples

The following examples are applicable to both Basic and Crystal syntax:

Trim("   abcde   ")

Returns "abcde".

Comments

This function is designed to work like the Visual Basic function of the same name.


LTrim (str)

LTrim and TrimLeft (str) are equivalent functions. However, LTrim is preferred in Basic syntax, whereas TrimLeft is preferred in Crystal syntax.

Argument

str is a text String value

Returns

String value.

Action

LTrim removes all spaces stored to the left of the given string and returns it.

Typical uses
  • Use this function any time there are leading blanks in a text object that may interfere with an alignment of text strings, a character count, or with a calculation (if the string is eventually converted to a Number).
  • Use whenever you combine (concatenate) justified text strings and want to have the proper spacing between strings.
Examples

The following examples are applicable to both Basic and Crystal syntax:

LTrim("   Al/4520/B12")

Returns "A1/4520/B12".

LTrim("   200")

Returns "200", where the text string " 200" is right-justified with leading blanks.

You have two right-justified database fields, {file.FOOD1} and {file.FOOD2}. Each field can hold up to 15 characters. {file.FOOD1} contains the word bread and {file.FOOD2} contains the word butter. If you were to print these words, they would appear like this:

" bread"

" butter"

For each 15-character field the database includes the field value, right-justified plus enough blank spaces to fill up the field. To use these words without the leading spaces (to create the expression bread and butter, for example) use the LTrim function in the following manner:

LTrim({file.FOOD1}) + " and " + LTrim({file.FOOD2})

Returns "bread and butter".

The spaces enclosed in the quotation marks before and after the word and assure that there is the correct spacing between the three words in the resulting sentence.

Comments

This function is designed to work like the Visual Basic function of the same name.

Related topics

Trim (str)

RTrim (str)


TrimLeft (str)

TrimLeft and LTrim (str) are equivalent functions. However, TrimLeft is preferred in Crystal syntax, whereas LTrim is preferred in Basic syntax.

Arguments

str is a string.

Returns

Text String

Action

TrimLeft removes all spaces to the left of a string or data field which is stored as a right-justified string in a database.

Typical uses
  • Use this function any time there are leading blanks in a text object that may interfere with an alignment of text strings, a character count, or with a calculation (if the string is eventually converted to a Number).
  • Use whenever you combine (concatenate) justified text strings and want to have the proper spacing between strings.
Examples

The following examples are applicable to both Basic and Crystal syntax, although LTrim is preferred in the latter:

TrimLeft(" Al/4520/B12")

Returns "A1/4520/B12".

TrimLeft(" 200")

Returns "200", where the text string "200" is right-justified with leading blanks.

You have two right-justified database fields, {file.FOOD1} and {file.FOOD2}. Each field can hold up to 15 characters. {file.FOOD1} contains the word bread and {file.FOOD2} contains the word butter. If you were to print these words, they would appear like this:

" bread"

" butter"

For each 15-character field the database includes the field value, right-justified plus enough blank spaces to fill up the field. To use these words without the leading spaces (to create the expression bread and butter, for example) use the TrimLeft function in the following manner:

TrimLeft({file.FOOD1}) + " and " + TrimLeft({file.FOOD2})

Returns "bread and butter".

The spaces enclosed in the quotation marks before and after the word and assure that there is the correct spacing between the three words in the resulting sentence.

Related topics

Trim (str)

TrimRight (str)

Formula 14


RTrim (str)

RTrim and TrimRight (str) are equivalent functions. However, RTrim is preferred in Basic syntax, whereas TrimRight is preferred in Crystal syntax.

Argument

str is a text String value

Returns

String value.

Action

RTrim removes all spaces to the right of the given string and returns it.

Typical uses
  • Use this function any time there are trailing blanks in a text object that may interfere with an alignment of text strings, a character count, or with a calculation (if the string is eventually converted to a Number).
  • Use whenever you combine (concatenate) justified text strings and want to have the proper spacing between strings.
Examples

The following examples are applicable to both Basic and Crystal syntax:

RTrim("Al/4520/B12    ")

Returns "A1/4520/B12".

RTrim({file.REFERENCE})

Returns "Bal Fwd." where {file.REFERENCE} contains the left-justified text string "Bal Fwd. ".

Comments

This function is designed to work like the Visual Basic function of the same name.

Related topics

Trim (str)

LTrim (str)


TrimRight (str)

TrimRight and RTrim (str) are equivalent functions. However, TrimRight is preferred in Crystal syntax, whereas RTrim is preferred in Basic syntax.

Arguments

TrimRight(str)

Where str is a text string.

Returns

Text String

Action

TrimRight removes all spaces to the right of a string or data field which is stored left-justified in a database.

Typical uses
  • Use this function any time there are trailing blanks in a text object that may interfere with an alignment of text strings, a character count, or with a calculation (if the string is eventually converted to a Number).
  • Use whenever you combine (concatenate) justified text strings and want to have the proper spacing between strings.
Examples

The following examples are applicable to both Basic and Crystal syntax, although RTrim is preferred in the latter:

TrimRight("Al/4520/B12    ")

Returns "A1/4520/B12".

TrimRight({file.REFERENCE})

Returns "Bal Fwd." where the text string "Bal Fwd. " is left-justified in the field.

Related topics

Trim (str)

TrimLeft (str)


UCase (str)

UCase and UpperCase (str) are equivalent functions. However, UCase is preferred in Basic syntax, whereas UpperCase is preferred in Crystal syntax.

Argument

str is a text String value

Returns

String value.

Action

UCase converts the given string to all upper case and returns it.

Typical use

A good use of this function is when a field contains both uppercase and lowercase letters and you want to convert all letters to uppercase for consistency.

Examples

The following examples are applicable to both Basic and Crystal syntax:

UCase("Description")

Returns "DESCRIPTION".

UCase({customer.FIRST NAME})

Returns "RONALD", where {customer.FIRST NAME} contains "Ronald".

UCase("Ronald Black")

Returns "RONALD BLACK".

UCase("abc12345")

Returns "ABC12345".

UCase("BrEaD " + "AND " + "bUtTeR")

Returns "BREAD AND BUTTER".

Comments

This function is designed to work like the Visual Basic function of the same name.

Related topics

LCase (str)


UpperCase (str)

UpperCase and UCase (str) are equivalent functions. UpperCase is preferred in Crystal syntax, whereas UCase is preferred in Basic syntax.

Arguments

str is a text string.

Returns

Text String

Action

UpperCase returns the text string or text value in the data field in upper case (capital letters).

Typical uses

A good use of this function is when a field contains both uppercase and lowercase letters and you want to convert all letters to uppercase for consistency.

Examples

The following examples are applicable to both Basic and Crystal syntax, although UCase is preferred in the latter:

UpperCase("Description")

Returns "DESCRIPTION".

UpperCase({customer.FIRST NAME})

Returns "RONALD", where {customer.FIRST NAME} contains "Ronald".

UpperCase("Ronald Black")

Returns "RONALD BLACK".

UpperCase("abc12345")

Returns "ABC12345".

UpperCase("BrEaD " + "AND " + "bUtTeR" )

Returns "BREAD AND BUTTER".

Related topics

LowerCase (str)


LCase (str)

LCase and LowerCase (str) are equivalent functions. However, LCase is preferred in Basic syntax, whereas LowerCase is preferred in Crystal syntax.

Argument

str is a text value

Returns

String value.

Action

LCase converts the given string to all lower case and returns it.

Typical use

A good use of this function is when a field contains both uppercase and lowercase letters and you want to convert all letters to lowercase for consistency.

Examples

The following examples are applicable to both Basic and Crystal syntax:

LCase ("Description")

Returns "description".

LCase ({customer.FIRST NAME})

Returns "ronald", where {customer.FIRST NAME} is "Ronald".

LCase ("Ronald Black")

Returns "ronald black".

LCase ("ABC12345")

Returns "abc12345".

LCase ("BrEaD " + "AND " + "bUtTeR")

Returns "bread and butter".

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • Numbers that are part of the text are not affected by the LCase function.
Related topics

UCase (str)


LowerCase (str)

LowerCase and LCase (str) are equivalent functions. However, LowerCase is preferred in Crystal syntax, whereas LCase is preferred in Basic syntax.

Arguments

x is a text value.

Returns

Text String

Action

LowerCase returns the given text value in all lower case letters.

Typical uses

A good use of this function is when a field contains both uppercase and lowercase letters and you want to convert all letters to lowercase for consistency.

Examples

The following examples are applicable to both Basic and Crystal syntax, although LCase is preferred in the latter:

LowerCase("Description")

Returns "description".

LowerCase({customer.FIRST NAME})

Returns "ronald", where {customer.FIRST NAME} is "Ronald".

LowerCase("Ronald Black")

Returns "ronald black".

LowerCase("ABC12345")

Returns "abc12345".

LowerCase("BrEaD " + "AND " + "bUtTeR")

Returns "bread and butter".

Comments

Numbers that are part of the text are not affected by the LowerCase function.

Related topics

UpperCase (str)


StrReverse (inputString)

Basic and Crystal syntax.

Argument

inputString is a String whose characters are to be reversed.

Returns

String value.

Action

StrReverse returns a String in which the character order of inputString is reversed. If inputString is a zero-length string (""), a zero-length string is returned.

Examples

The following example is applicable to both Basic and Crystal syntax:

StrReverse("abc")

Returns "cba".

Comments

This function is designed to work like the Visual Basic function of the same name.


IsNumeric (str)

IsNumeric and NumericText (str) are equivalent functions. However, IsNumeric is preferred in Basic syntax, whereas NumericText is preferred in Crystal syntax.

Argument

str is a String value to be tested.

Returns

Boolean value (True or False).

Action

IsNumeric returns True if the String argument can be converted to a Number and False otherwise.

Typical use

If you store numbers (like weight) in a text String object, use IsNumeric to check the value of each record to make sure it is OK to convert using ToNumber or CDbl.

Examples

The following examples are applicable to both Basic and Crystal syntax:

IsNumeric({file.REFERENCE})

Returns FALSE where {file.REFERENCE} = "ABCDEFG".

IsNumeric({file.IDNUM})

Returns TRUE where {file.IDNUM} = "12345".

IsNumeric({file.IDNUM})

Returns TRUE where {file.IDNUM} = "12345443".

IsNumeric({file.IDNUM})

Returns FALSE where {file.IDNUM} = "12345-443".

IsNumeric ({file.IDNUM} (1 to 5))

Returns TRUE where {file.IDNUM} = "12345-443".

IsNumeric ({file.IDNUM} (6))

Returns FALSE where {file.IDNUM} = "12345-443".

IsNumeric ({file.IDNUM} (7 to 9))

Returns TRUE where {file.IDNUM} = "12345-443".

IsNumeric({file.IDNUM})

Returns FALSE where {file.IDNUM} = "12345T".

Note: You can use this function in combination with ToNumber (numeric), ToNumber (string) or CStr to test for a Number in the Reference field, then return the string as a Number or return 0 if the text string is not a Number.

The following example is applicable to Basic syntax:

If IsNumeric({file.IDNUM}) Then
formula = ToNumber({file.IDNUM})
Else
formula = 0
End If


NumericText (str)

NumericText and IsNumeric (str) are equivalent functions. However, NumericText is preferred in Crystal syntax, whereas IsNumeric is preferred in Basic syntax.

Arguments

str is a text string being tested for numeric text.

Returns

Boolean Value

Action

NumericText tests to see if the content of a text object is a Number.

  • If the entire content of the field is a Number - or if the characters extracted via the Subscript for arrays and strings are entirely a Number - the function returns a TRUE value.
  • If any part of the content of the field - or of the characters extracted - are not a Number, the function returns the value FALSE.
Typical uses

If you store numbers (like weight) in a text object, use NumericText to check the value of each record to make sure it is OK to convert using ToNumber (numeric), ToNumber (string).

Examples

The following examples are applicable to both Basic and Crystal syntax, although IsNumeric is preferred in the latter:

NumericText({file.REFERENCE})

Returns FALSE where {file.REFERENCE} = "ABCDEFG".

NumericText({file.IDNUM})

Returns TRUE where {file.IDNUM} = "12345".

NumericText({file.IDNUM})

Returns TRUE where {file.IDNUM} = "12345443".

NumericText({file.IDNUM})

Returns FALSE where {file.IDNUM} = "12345-443".

NumericText ({file.IDNUM} [1 to 5])

Returns TRUE where {file.IDNUM} = "12345-443".

NumericText ({file.IDNUM} [6])

Returns FALSE where {file.IDNUM} = "12345-443".

NumericText ({file.IDNUM} [7 to 9])

Returns TRUE where {file.IDNUM} = "12345-443".

NumericText({file.IDNUM})

Returns FALSE where {file.IDNUM} = "12345T".

Note: You can use this function in combination with ToNumber (numeric), ToNumber (string) to test for a Number in the Reference field, then print the string as a Number or print 0 if the text string is not a Number.

The following example is applicable to Crystal syntax:

If NumericText({file.REFERENCE}) Then
ToNumber({file.REFERENCE})
Else
0;

Related topics

Formula 9


ToNumber (numeric), ToNumber (string)

Basic and Crystal syntax.

ToNumber and CDbl are equivalent functions.

Arguments
  • numeric is a Number or a Currency type value.
  • string is a text string that holds numeric text.
Returns

Fractional Number

Action

ToNumber converts a Number, Currency or text string to a Number.

In a database, some numbers are stored in numeric fields, as Numbers, and some are stored in character fields, as text. You make the determination which fields are to be numeric and which are to be text when you set up the database in the first place. Numbers on which you might wish to perform arithmetic (item cost, quantity ordered, etc.) are typically stored in numeric fields; numbers on which you do not expect to perform arithmetic (customer number, telephone number, etc.) are typically stored in text objects.

ToNumber allows you to convert a Number stored as text to a Number on which you can perform arithmetic.

Typical uses

You might use this function, for example, if your item numbers contain coded product information and you want to use that information in calculations. Typically, you would be using this function to convert a Currency or String value that contains all numeric characters to a Number type value.

Examples

The following examples are applicable to both Basic and Crystal syntax:

ToNumber({orders.ORDER AMOUNT})

Returns a Number type value that the Currency field {orders.ORDER AMOUNT} contains.

ToNumber("123.45")

Returns 123.45.

ToNumber({file.REFERENCE})

Returns 200.00 where "200" is the text string in the {file.REFERENCE} field.

ToNumber({file.ACCTNO}/2)

Returns 22144 where {file.ACCTNO} = 44288.

ToNumber({customers.POSTAL CODE}) < 33333

Returns TRUE where {customer.POSTAL CODE} is "21385".

Comments

When using the ToNumber function, you should first test the value with the NumericText function. NumericText returns a value of TRUE only if the value in the string can be correctly converted to a Number. Otherwise, if you try to convert a value to a Number that is not a Number, the formula will produce an error in your report.

The following example is a common use of the NumericText and ToNumber functions together, in Crystal syntax:

If NumericText ({file.FIELD}) Then
ToNumber ({file.FIELD})
Else
0

Related topics

Formula 2

Formula 3

Formula 9

Formula 17


ToText

Basic and Crystal syntax.

ToText and CStr are equivalent functions.

Overloads
  • ToText (x)
  • ToText (x, y)
  • ToText (x, y, z)
  • ToText (x, y, z, w)
  • ToText (x, y, z, w, q)
Arguments

Converting . . . Description

Boolean values

  • x is a Boolean value that is converted to a String, either "True" or "False".

Number and Currency values

  • x is a Number or Currency value to be converted into a text string; it can be a whole or fractional value.
  • y is a whole number indicating the number of decimal places to carry the value in x to (This argument is optional.).
  • z is a single character text string indicating the character to be used to separate thousands in x. Default is the character specified in your International or Regional settings control panel. (This argument is optional.)
  • w is a single character text string indicating the character to be used as a decimal separator in x. Default is the character specified in your International or Regional settings control panel. (This argument is optional.)

Number and Currency values (formatting)

  • x is a Number or Currency value to be converted into a text string; it can be a whole or fractional value.
  • y is a text string used to indicate the format for displaying the value in x. See Format Strings for information on creating a format string.
  • z is a whole number indicating the number of decimal places to carry the value in x to. (This argument is optional.)
  • w is a single character text string indicating the character to be used to separate thousands in x. Default is the character specified in your International or Regional settings control panel. (This argument is optional.)
  • q is a single character text string indicating the character to be used as a decimal separator in x. The default is the character specified in your International or Regional settings control panel. (This argument is optional.)

Date values

  • x is a Date value to be converted into a text string.
  • y is a text string that defines how the value in x is to be formatted. See Format strings for Date, Time, and DateTime values for more information on creating this format string. (This argument is optional.)

Time values

  • x is a Time value to be converted into a text string.
  • y is a text string that defines how the value in x is to be formatted. See Format strings for Date, Time, and DateTime values for more information on creating this format string. (This argument is optional.)
  • z is a text string to be used as a label for A.M. (morning) hours. (This argument is optional.)
  • w is a text string to be used as a label for P.M. (evening) hours. (This argument is optional.)

DateTime values

  • x is a DateTime value to be converted into a text string.
  • y is a text string of characters that indicate how the resulting text string will be formatted. See Format strings for Date, Time, and DateTime values for more information on creating a format string. (This argument is optional.)
  • z is a text string to be used as a label for A.M. (morning) hours. (This argument is optional.)
  • w is a text string to be used as a label for P.M. (evening) hours. (This argument is optional.)

Returns

Text String

Action

The ToText function converts Numbers, Currency, Date, Time, and DateTime values to text strings.

Typical uses

Use this function to convert a Number, Currency, Date, Time, or DateTime value to a text string to appear as text in your report (form letters, comments, etc.).

Examples

The following examples are applicable to both Basic and Crystal syntax:

ToText({orders.SHIPPED})

Returns True where the value in ({orders.SHIPPED}) is True.

ToText(123.45)

Returns "123.45".

ToText(12345.6749,2)

Returns "12345.67".

ToText(12345.6750,2)

Returns "12345.68".

ToText(12345.4999,0)

Returns "12345".

ToText(12345.5000,0)

Returns "12346".

ToText({file.AMT} * {file.QUANTITY})

Returns 44,890.20 where Amt = 24.45 and Quantity = 1836.

ToText is useful when you want to build a sentence by combining (concatenating) a converted Number or other value with other text strings:

"The base price of item # " + {file.ITEM NUMBER} + " is $" + ToText({file.BASE PRICE}) + "."

Prints the sentence "The base price of item A1/4520/B12 is $50.00." where the Item number is A1/4520/B12 and the Base Price is 50.00, converted to text and formatted with two decimal places.

The following examples are applicable to Crystal syntax:

ToText(CDate(1996, 11, 1), "yy MMM dd, dddd")

Returns 96 Nov 01, Monday.

ToText(DateTime(1995,10,12,3,30,11),"HH:mm, yy MMMM ddd")

Returns 03:30, 95 October Mon.

ToText(Time(12, 10, 10), "HH*mm*ss tt", "amStr", "pmStr")

Returns 12*10*10 pmStr.


Format Strings

The ToText and CStr functions can use format strings to control how the Number, Currency, Date, Time, or DateTime value passed to the x argument will appear when converted to a String. This section describes how to create format strings for the various data types.

Format strings for fractional Numbers and Currency values

The following characters are used to create format strings for fractional Numbers and Currency values:

Character Description Comments/Examples

#

Represents numerical digits or spaces.

When the original number is converted, # characters are ignored unless the number of # characters in the format string extends beyond the number of significant digits in the original value. Then, for every additional # that appears, a space is added to the string.

If your original value is 125.34:

  • the format string "#" produces the string "125" (number of significant digits exceeds the number of # characters)
  • the format string "###.##" produces the string "125.34" (number of significant digits equal to number of # characters)
  • the format string "####.###" produces the string "125.34" (number of significant digits is less than the number of # characters).

0

Represents numerical digits or zeros (0).

When the original number is converted, 0 characters are ignored unless the number of 0 characters in the format string extends beyond the number of significant digits in the original value. Then, for every additional 0 that appears, a zero is added to the string.

If your original value is 125.34:

  • the format string "0" produces the string "125" (number of significant digits exceeds the number of 0 characters)
  • the format string "000.00" produces the string "125.34" (number of significant digits equal to number of 0 characters)
  • the format string "0000.000" produces the string "0125.340" (number of significant digits is less than the number of 0 characters).

# and 0 characters can be combined in format strings. If your original value is 125.34:

  • the format string "####.0000" produces the string "125.3400".
  • A comma (,)
  • A decimal point (.) indicates where a decimal separator should appear. The actual character that appears as a decimal separator in the resulting string can be changed.

comma (,)

Indicates where a thousands separator should appear.

The actual character that appears as a thousands separator in the resulting string can be changed.

decimal point (.)

Indicates where a decimal separator should appear.

The actual character that appears as a decimal separator in the resulting string can be changed.

How format string can affect values

The following table illustrates how format strings can affect different fractional Numbers and Currency values being converted. In this table, the underscore character (_) represents a space in the resulting string:

Original Value | Format string | Resulting String
16.13 | # | 16
16.13 | 0 | 16
16.13 | ## | 16
16.13 | 00 | 16
16.13 | ### | _16
16.13 | 000 | 016
16.13 | #.#### | 16.13_
16.13 | 0.0000 | 16.1300
16125.00 | ###,###.# | _16,125.0
16125.00 | 000,000.0 | 016,125.0
16125.00 | 000000.0 | 016125.0


Format strings for Date, Time, and DateTime values

The following characters are used to create format strings for Date, Time, and DateTime values:

Character | Comments
d | day of month without leading zero for single digits
dd | day of month with leading zero for single digits.
ddd | day of week as a three letter abbreviation
dddd | full name of day of week
M | month without leading zero for single digit
MM | month with leading zero for single digit
MMM | month as three letter abbreviation.
MMMM | full name of month
yy | last two digits of year
yyyy | full four digits of year
h | hours without leading zeros for single digits (12 hour)
hh | hours without leading zeros for single digits (12 hour).
H | hours without leading zeros for single digits (24 hour)
HH | hours with leading zeros for single digits (24 hour)
m | minutes without leading zeros for single digits
mm | minutes with leading zeros for single digits
s | seconds without leading zeros for single digits
ss | seconds with leading zeros for single digits
t, tt | single character or multiple character a.m./p.m. string

The following table illustrates how format strings can affect different Date, Time, and DateTime values being converted by the ToText or CStr function:

Date, Time, or DateTime value | Format String | Resulting String
CDate(1996, 11, 1) | yy MMM dd, dddd | 96 Nov 01, Monday
CTime(12, 10, 10) | HH*mm*ss tt | 12*10*10
CDateTime(1995, 10, 12, 3, 30, 11) | HH:mm, yy MMMM ddd | 03:30, 96 October Mon
CTime(13, 20, 22) | hh "h" mm "min" ss "sec" tt | 01 h 20 min 22 sec
CDate(1998, 3, 17) | M/dd/yy | 3/17/98


Converting Boolean values

The ToText function, when used with Boolean values, is most useful for combining (concatenating) a Boolean value with other text. Otherwise, a Boolean field can be formatted to appear as True or False in your report simply by changing the format on the Boolean tab (Format Editor) of the Format Editor.


Converting fractional Numbers and Currency values

If the number of decimal places is specified, this function does not truncate the number when converted to text, but rounds it to the number of decimal places specified. See Round (x), Round (x, #places), for more information on the rounding procedure.


Converting Date, Time, and DateTime values

Any character, with the exception of the date or time format characters, can be used within the format string. For example, you may wish to use a slash to separate the different elements (month, day, year) of the date, as in "12/30/95", or you may wish to use a colon to separate the different elements (hours, minutes, seconds) of the time, as in "12:30:10".

If you wish to use any of the above characters in the format string, they must appear in quotes. For example:

ToText(DateTime(1995,10,12,13,20,22), "MM/dd/yy hh 'h' mm 'min' ss 'sec' ", 'am', 'pm') = "10/12/95 1 h 20 min 22 sec pm"


Passing optional arguments

  • Many arguments for the ToText function have been specified as optional. However, you can only leave an argument blank if all the arguments that follow it are left blank as well. In other words, you can not leave the y and z arguments blank and provide an argument for w. It is possible, however, to leave one, two, or all of the optional arguments blank, as long as no arguments are supplied after the blank arguments.

    The following combinations are possible when supplying arguments to the ToText function:

      • ToText(x)
      • ToText (x, y)
      • ToText (x, y, z)
      • ToText (x, y, z, w)
      • ToText (x, y, z, w, q)
  • Using the "t" or "tt" format characters in a time format string provides default strings for indicating a.m. (morning) and p.m. (evening) hours. "t" produces just a single character, "a" or "p", while "tt" produces the entire string, "am" or "pm". You can pass your own custom strings for indicating am/pm strings. See the arguments for converting time and DateTime values with ToText in the Arguments section of ToText.)

    If you do pass your own am/pm strings, the "t" and "tt" format characters will have the same effect on them (producing single character vs. multiple character strings). However, the "t" and "tt" format characters are optional and only necessary when default am/pm strings are needed.

Related topics

CStr

Formula 1

Formula 2

Formula 3

Formula 5

Formula 13


ToWords (x), ToWords (x, #places)

Basic and Crystal syntax.

Arguments
  • x is a fractional Number to be converted into words.
  • #places is a whole number indicating the number of decimal places to be converted. (This argument is optional.)
Returns

Text String

Action

You can use this function to convert a Number or Currency field value or the result of a numeric calculation to words so it can be used as text. The ability to adjust the number of decimal places can be useful when the number is the result of a calculation that may produce more decimal places than you want.

Typical uses

You can use this function to spell out the dollar amount for each check if you are using computer checks.

Examples

The following examples are applicable to both Basic and Crystal syntax:

ToWords(12345)

Returns twelve thousand three hundred forty-five and xx/100.

ToWords(12345.6749,2)

Returns twelve thousand three hundred forty-five and 67/100.

ToWords(12345.4999,0)

Returns twelve thousand three hundred forty-five.

ToWords(12345.5000,0)

Returns twelve thousand three hundred forty six.

ToWords(-12345)

Returns negative twelve thousand three hundred forty-five and xx/100.

ToWords(12.3499)

Returns twelve and 35/100.

ToWords({orders.ORDER AMOUNT})

Returns two thousand sixteen and 84/100 where Amount = 2016.84.

ToWords((({file.QTY1} + {file.QTY2} + {file.QTY3}) * {file.PRICE}) * 1.075)

Returns one hundred two and 13/100.

ToWords((({file.QTY1} + {file.QTY2} + {file.QTY3}) * {file.PRICE}) * 1.075,0)

Returns one hundred two where QTY1 = 1, QTY2 = 82, QTY3 = 12, and Price = 1.00 (sums three quantities, multiplies them times the price and adds 7.5% sales tax). In this case the numeric answer is 102.125 which is then rounded to 102.13 (the standard two decimal places) before putting into words.

Comments
  • The function treats the number as a whole, rather than as a series of individual numbers. That is, 123 is treated as the number one hundred twenty-three rather than the individual digits one, two, and three.
  • Negative numbers begin with the word "negative."
  • Currency field values and Number field values are treated in the same way and produce identical results.
  • Since the spelled out value will be much longer than the Number value, you will need to increase the size of the field box to accommodate the new field length.


ReplicateString (str, #copies)

Basic and Crystal syntax.

Arguments
  • str is the text string to be replicated.
  • #copies is a whole number indicating the number of times str is to be replicated.
Returns

Text String

Action

Replicates the string in str the number of times specified by #copies.

Typical uses

You can use this function to insert a line of characters any time they are needed. Some typical uses are:

  • to flag critical data on your report
  • to build simple bar graphs
  • to split your report into visible sections
  • to highlight totals, subtotals, and other summary data.
Examples

The following examples are applicable to Crystal syntax:

If {file.SALES} < {file.QUOTA} Then
ReplicateString("*",10)
Else
""

Prints the character * ten times as a flag.

{file.NAME}+ " " + ReplicateString("*", {file.SCORE})

Prints a simple bar graph showing test results. The formula prints an asterisk for each point in a test score (the value in the file.SCORE field).

The formula prints an asterisk for each point in a test score (the value in the {file.SCORE} field). For example, given the following data:

Name | Score
Smith | 23
Jones | 17
Brown | 21
Johnson | 13
Reynolds | 25

The formula will produce the following results:

Name | @Score
Smith | ***********************
Jones | ******************
Brown | **********************
Johnson | ***************
Reynolds | *****************************


Space (x)

Basic and Crystal syntax.

Arguments

x is a whole number indicating the number of spaces.

Returns

Text String (one or more spaces)

Action

The Space function returns a specified number of spaces.

Typical uses

Use the Space function to easily add a specific number of spaces to a text string.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Space(2)

Returns " ".

Comments

This function is designed to work like the Visual Basic function of the same name.


InStr (str1, str2), InStr (start, str1, str2)

Basic and Crystal syntax.

Arguments
  • start is the character in str1 where the search is to begin. This is a 1 based index. (This argument is optional.)
  • str1 is the text string to be searched.
  • str2 is the text string being sought.
Returns

Whole Number

Action

The InStr function returns the position of the first occurrence of one string within another. This position is a 1 based index of the characters in str1. If str2 is not found in str1, the InStr function returns 0. The start argument sets the starting position for the search.

Typical uses

Use this function to determine if one string contains another.

Examples

The following examples are applicable to both Basic and Crystal syntax:

InStr("abcdefg", "bcd")

Returns 2.

InStr(3, "abcdefg", "cde")

Returns 3.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • There are two versions of this function. The first does not use the start argument, the second does. If the start argument is not used, InStr searches all of str1 to try to find str2. If the start argument is used, InStr begins searching at the character in str2 indicated by the start argument.


InStrRev

Basic and Crystal syntax.

Overloads
  • InStrRev (inputString, findString)
  • InStrRev (inputString, findString, startPosition)
  • InStrRev (inputString, findString, startPosition, compare)
Arguments
  • inputString is a String expression being searched.
  • findString is a String expression being searched for.
  • startPosition is an optional numeric expression that sets the starting position for each search. If omitted, -1 is used, which means that the search begins at the last character position.
  • compare is an optional numeric value indicating the kind of comparison to use when evaluating substrings:
      • Performs a comparison that is case-sensitive
      • Performs a comparison that is case-insensitive

        If omitted, a case-sensitive comparison is performed.

Returns

Number value that indicates the position of the matching string in the string to be matched. The first character of the inputString (from the beginning) is 1.

Action

InStrRev returns the position of the first occurrence of one string within another. The matching proceeds in the reverse direction from the specified start position.

Examples

The following examples are applicable to Basic and Crystal syntax:

InStrRev ("abcdefgbchijk", "bc")

Returns 8, where matching starts from the very end of the string in the reverse direction.

InStrRev ("abcdefgbchijk", "bc", -1)

Returns 8, where matching starts from the very end of the string in the reverse direction.

InStrRev ("abcdefgbchijk", "bc", 2)

Returns 0, i.e., no match is found. Matching starts from the "b" in "ab" in the reverse direction.

InStrRev ("abcdefgbchijk", "bc", 3)

Returns 2. Matching starts from the "c" in "abc" in the reverse direction.

InStrRev ("abcdefgbchijk", "bc", 10)

Returns 8. Matching starts from the 'h' in "abcdefgbch" in the reverse direction, and the first occurrence of "bc" is found at position 8 from the beginning of the string s.

InStrRev ("abcdefgbchijk", "BC", -1, 1)

Returns 8. Matching starts from the very end of the string in the reverse direction, and the first occurrence of "BC", independent of case since case-insensitive comparison is specified, is found at position 8 from the beginning of the input string.

InStrRev ("aBCdefgbchijk", "BC", -1, 0)

Returns 2. Matching starts from the very end of the string in the reverse direction, and the first occurrence of "BC" is found at position 2 from the beginning of the string s.

Comment

This function is designed to work like the Visual Basic function of the same name.


StrCmp (str1, str2), StrCmp (str1, str2, compare)

Basic and Crystal syntax.

Arguments
  • str1 is the first text string to be compared.
  • str2 is the second text string to be compared.
  • compare is an optional Number value indicating the kind of string comparison to use:
      • Performs a comparison that is case-sensitive
      • Performs a comparison that is case-insensitive

        If omitted, a case-sensitive comparison is performed.

Returns

Whole Number where

  • -1 = Less Than
  • 0 = Equal To
  • 1 = Greater Than
Action

The StrCmp function compares two strings.

Typical Uses

Use this function to determine if two string values are identical.

Examples

The following examples are applicable to both Basic and Crystal syntax:

StrCmp("abcd", "aa")

Returns = 1.

StrCmp("abcd", "aa", 1)

Returns = 1.

StrCmp ("abcd", "ac")

Returns = -1.

StrCmp ("aa", "aa")

Returns = 0.

Comments

This function is designed to work like the Visual Basic function of the same name.


Mid (str, start), Mid (str, start, length)

Basic and Crystal syntax.

Arguments
  • str is the text string from which one or more characters is being extracted.
  • start is a whole number indicating the position of the first character to extract.
  • length is a whole number indicating the number of characters to be extracted from the text string. This argument is optional. If a value is not specified, the rest of the string from the starting position is extracted.
Returns

Text String

Action

The Mid function returns a specified number of characters from a string. The second argument is the character position where the part to be taken begins. The third argument is the length of the string you want to be taken out. If the third argument is not specified, everything from the start position to the end of the string is extracted.

Typical uses

Use this function anytime you need to extract a set of characters from somewhere in the middle of a text string.

Examples

The following example is applicable to both Basic and Crystal syntax:

Mid("abcdef", 3, 2)

Returns "cd".

Comments

This function if designed to work like the Visual Basic function of the same name.


Left (str, length)

Basic and Crystal syntax.

Arguments
  • str is a text string value.
  • length is a whole number indicating the number of characters to be extracted from str.
Returns

Text String

Action

Extracts the specified number of characters from the left side of the string.

Typical uses

Use this function to obtain a certain number of characters from the left end of a text string. For instance, you could use the Left function to obtain just the area code from the values in a field containing phone numbers.

Examples

The following examples are applicable to Crystal syntax:

Left("abcdefg", 4)

Returns "abcd".

Left({customer.FAX}, 3)

Retrieves the area code of each fax number when the first three characters of the Fax field contains the area code.

Comments

This function is designed to work like the Visual Basic function of the same name.


Right (str, length)

Basic and Crystal syntax.

Arguments
  • str is a text string.
  • Length is a whole number indicating the number of characters to be extracted from str.
Returns

Text String

Action

Extracts the given number of text characters from the right side of the specified string.

Typical uses

Use this function to obtain just the right part of a string. For instance, use it to obtain the last four digits of social security numbers stored in a field.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Right("abcdefg", 3)

Returns "efg".

Right({table.SSNUM}, 4)

Returns the last 4 digits of the social security number as a String.

Comments

This function is designed to work like the Visual Basic function of the same name.


Val (str)

Basic and Crystal syntax.

Arguments
  • str is a text string.
Returns

Fractional Number

Action

The Val (str) function reads a string containing Numbers (example: an address, phone number, or social security number) and converts them to a decimal value. Val stops reading the string when it finds the first character in the string that it finds that it can not recognize as a number or as a space.

Typical uses

Use this function to extract only the numeric portion of a string that contains both numbers and text. For instance, you can extract only the street number from an address, or only the numeric portion of an ID that contains letters and numbers.

Examples

The following example is applicable to both Basic and Crystal syntax:

Val("2234 100th Street")

Returns 2234100.

Comments

This function is designed to work like the Visual Basic function of the same name.


Chr (x)

Basic and Crystal syntax.

Arguments

x is a whole number, specifically, it is any ASCII value.

Returns

Text String (one character long)

Action

The Chr (x) function returns the single character text string associated with the ASCII value passed as x.

Typical uses

Use this function any time you need to obtain the character associated with a particular ASCII value. This function is most useful for application developers using the Report Engine.

Examples

The following example is applicable to both Basic and Crystal syntax:

Chr(65)

Returns "A".

Comments

This function is designed to work like the Visual Basic function of the same name.


Asc (str)

Basic and Crystal syntax.

Arguments

str is a text string.

Returns

Whole Number (the ASCII value for the first character in the string).

Action

The Asc (str) function returns the ASCII code of the first character of the string.

Typical uses

Use this function anytime you need to obtain the ASCII value of a character. This function is most useful for application developers using the Report Engine.

Examples

The following example is applicable to both Basic and Crystal syntax:

Asc("A")

Returns 65.

Comments

This function is designed to work like the Visual Basic function of the same name.


Filter

Basic and Crystal syntax.

Overloads
  • Filter (inputStrings, searchString)
  • Filter (inputStrings, searchString, include)
  • Filter (inputStrings, searchString, include, compare)
Arguments
  • InputStrings is an array of strings to be searched.
  • searchString is a string to search for.
  • include is an optional Boolean value indicating whether to return substrings that include or exclude searchString. If include is True, Filter returns the subset of the array that contains searchString as a substring. If include is False, Filter returns the subset of the array that does not contain searchString as a substring. If omitted, the value True is assumed.
  • compare is an optional Number value indicating the kind of string comparison to use:
      • Performs a comparison that is case-sensitive
      • Performs a comparison that is case-insensitive

        If omitted, a case-sensitive comparison is performed.

Returns

Array of String values.

Action

Filter searches an array of strings for a specified string, and returns the strings in an array.

Examples

The following examples are applicable to Basic and Crystal syntax.

The examples assume that inputStrings is a String array consisting of the 5 elements: "pineapple", "Apple", "APPLE", "grape", and "orange".

Filter (inputStrings, "ap")

Returns an array containing the 2 strings "pineapple" and "grape".

Filter (inputStrings, "Ap", True)

Returns an array containing the 1 string "Apple".

Filter (inputStrings, "ap", True, 1)

Returns an array containing the 4 strings "pineapple", "Apple", "APPLE" and "grape". Matching to the search string uses case-insensitive comparison.

Filter (inputStrings, "ap", False)

Returns an array containing the 3 strings "Apple", "APPLE" and "orange".

Filter (inputStrings, "cd")

Returns an array containing 1 string, the empty string "". The returned array does not contain any matching strings but contains 1 element since the formula language does not support empty arrays.

Comments

This function is designed to work like the Visual Basic function of the same name.


Replace

Basic and Crystal syntax.

Overloads
  • Replace (inputString, findString, replaceString)
  • Replace (inputString, findString, replaceString, startPosition)
  • Replace (inputString, findString, replaceString, startPosition, count)
  • Replace (inputString, findString, replaceString, startPosition, count, compare)
Arguments
  • inputString is a String containing substring to replace.
  • findString is a substring being searched for.
  • replaceString is the replacement substring.
  • startPosition is an optional Number indicating the position within inputString where substring search is to begin. If omitted, 1 is assumed.
  • count is an optional Number of substring substitutions to perform. If omitted, the default value is -1, which means make all possible substitutions.
  • compare is an optional Number indicating the kind of comparison to use when evaluating substrings:
      • Performs a comparison that is case-sensitive
      • Performs a comparison that is case-insensitive

        If omitted, a case-sensitive comparison is performed.

Returns

String value.

Action

Replace returns a String in which a specified substring has been replaced with another substring a specified number of times. As an option, you can also specify where in the String to begin replacing, and return a String starting from that position.

Typical use

To systematically replace in a String one substring with another.

Examples

The following examples are applicable to both Basic and Crystal syntax. They assume that inputString is the text String "Monday is my day off. Can we meet next Monday?".

Replace (inputString, "Monday", "Wednesday")

Returns "Wednesday is my day off. Can we meet next Wednesday?".

Replace (inputString, "Monday", "Wednesday", 23)

Returns "Can we meet next Wednesday?" The replacement begins at the 23rd character from the beginning of the original inputString. The returned string is this portion of the string with the substitutions made.

Replace (inputString, "Monday", "Wednesday", 1, 1)

Returns "Wednesday is my day off. Can we meet next Monday?" There is only 1 replacement beginning at the 1st character from the beginning of the original inputString. The returned string is thus the original string with the single substitution made.

Replace (inputString, "monday", "Wednesday", 1, -1, 0)

Returns the same inputString with no replacements since no match was found for "monday" with a case-sensitive comparison.

Replace (inputString, "monday", "Wednesday", 1, -1, 1)

Returns the inputString with both occurrences of "Monday" replaced by "Wednesday". That is, "Wednesday is my day off. Can we meet next Wednesday?".

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • The returned value of the Replace function is a String, with the specified substring replacements made, that begins at the position specified by startPosition and ends at the end of the inputString string. It is not a copy of the original string from start to finish.


Join

Basic and Crystal syntax.

Overloads
  • Join (list)
  • Join (list, delimiter)
Arguments
  • list is a String array containing substrings to be joined.
  • delimiter is an optional String used to separate the substrings in the returned string. If omitted, the space character (" ") is used. If delimiter is a zero-length string (""), all items in the list are concatenated with no delimiters.
Returns

String value.

Action

Join returns a String created by joining a number of substrings contained in an array.

Typical use

To convert elements stored in a String array to a single String.

Examples

The following examples are applicable to Basic and Crystal syntax.

The examples assume that list is a String array consisting of the 3 elements: "Chocolate", "Vanilla" and "Strawberry".

Join (list)

Returns the String "Chocolate Vanilla Strawberry".

Join (list, "***")

Returns the String "Chocolate***Vanilla***Strawberry".

Comments

This function is designed to work like the Visual Basic function of the same name.

Related topics

Split


Split

Basic and Crystal syntax.

Overloads
  • Split (inputString)
  • Split (inputString, delimiter)
  • Split (inputString, delimiter, count)
  • Split (inputString, delimiter, count, compare)
Arguments
  • inputString is a String expression containing substrings and delimiters.
  • delimiter is an optional String character used to identify substring limits. If omitted, the space character (" ") is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire inputString string is returned.
  • count is an optional number value of substrings to be returned. The value -1 indicates that all substrings are returned. If omitted, -1 is assumed.
  • compare is an optional Number indicating the kind of comparison to use when evaluating the delimiter string:
      • Performs a comparison that is case-sensitive
      • Performs a comparison that is case-insensitive

        If omitted, a case-sensitive comparison is performed.

Returns

Array of String values.

Action

Split takes a String that contains a number of substrings, breaks it up into a specified number of substrings and returns an array containing the substrings.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Split ("Chocolate Strawberry Pineapple")

Returns an array that contains 3 elements, "Chocolate", "Strawberry" and "Pineapple".

Split ("Chocolate//Strawberry//Pineapple", "//")

Returns an array that contains 3 elements, "Chocolate", "Strawberry" and "Pineapple".

Split ("Chocolate//Strawberry//Pineapple", "//", 2)

Returns an array that contains 2 elements, "Chocolate" and "Strawberry//Pineapple". The last element in the array is a concatenation of the 2nd substring and the remaining substring.

Split ("Chocolate and Strawberry and Pineapple", " And ", -1, 0)

Returns an array that contains 1 element, "Chocolate and Strawberry and Pineapple". The delimiter " And " cannot be matched.

Split ("Chocolate and Strawberry and Pineapple", " And ", -1, 1)

Returns an array that contains 3 elements, "Chocolate", "Strawberry" and "Pineapple". The delimiter " And " is matched with " and " regardless of the case.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • If count, c, is less than the total number of substrings in inputString, then at most c substrings will be returned as elements in the resultant array. The last element in the array being a concatenation of the c-th substring and all the remaining substrings.
Related topics

Join


Date/Time functions

Date functions allow you to convert numbers to dates (which you can then format to display as you wish) and to convert dates to numbers.

CurrentDate

CurrentTime

CurrentDateTime

Date

Time

DateTime

DateValue

TimeValue

DateTimeValue

DateSerial (year, month, day)

TimeSerial (hour, minute, second)

IsDateTime

IsTime

IsDate

Year (x)

Month (x)

Day (x)

WeekDay

DayOfWeek

Hour (x)

Minute (x)

Second (x)

MonthName

WeekdayName

Timer ( )

DateAdd (intervalType, nIntervals, startDateTime)

DateDiff

DatePart

First Day of Week/Year constants

Additional Date/Time functions

DateTo2000 (Date, Number)

DTSTo2000 (DateString, Number)

DTSToDate (DateTimeString)

DTSToSeconds (DateTimeString)

DTSToTimeString (DateTimeString)


CurrentDate

Basic and Crystal syntax.

Returns

Date Value

Action

CurrentDate returns the current date on a report. The date is taken from your computer's internal clock.

Typical Uses

Use CurrentDate any time you want to stamp your report with the current date.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CurrentDate

Returns 1998/07/04, if you begin printing your report on July 4, 1998.

CurrentDate

Returns 1996/12/11, if you begin printing your report on December 11, 1996.

Comments
  • The date format is determined by the settings in the International or Regional Settings control panel.
  • CurrentDate is identical to the Today function, which was included with previous version of the program. Today is provided for compatibility with reports created with earlier versions of the program. New reports should use the CurrentDate function.


CurrentTime

Basic and Crystal syntax.

Returns

Time Value

Action

CurrentTime returns the current time on a report. The time is taken from your computer's internal clock.

Typical Uses

Use CurrentTime any time you want to time stamp your report.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CurrentTime

Returns 4:45:18 if you begin printing your report at 4:45:18.

CurrentTime

Returns 17:14:33 if you begin printing your report at 17:14:33.

Comments
  • The time format is determined by the settings in the International or Regional Settings control panel.
  • The CurrentTime function is identical to the Now function, which was included with previous versions of the program. Now is provided for compatibility with reports created with earlier versions of the program. New reports should use the CurrentTime function.


CurrentDateTime

Basic and Crystal syntax.

Returns

DateTime Value

Action

CurrentDateTime returns the current date and time on a report. The date and time is taken from your computer's internal clock.

Typical Uses

Use CurrentDateTime any time you want to stamp your report with the current date and time.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CurrentDateTime

Returns 1998/07/04 4:45:18, if you begin printing your report at 4:45:18 on July 4, 1998.

CurrentDateTime

Returns 1996/12/11 17:14:33, if you begin printing your report at 17:14:33 on December 11, 1996.

Comments
  • The date and time formats are determined by the settings in the International or Regional Settings control panel.
  • CurrentDateTime produces the same result as the formula:

CDateTime(CurrentDate, CurrentTime)


Date

Crystal syntax.

The CDate and DateValue functions are equivalent to Date. However, Date can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • Date (number)
  • Date (string)
  • Date (dateTime)
  • Date (YYYY, MM, DD)
Arguments

Date (number)

  • number is a value representing the number of days starting from December 30, 1899.
  • It can be positive or negative, and is truncated if fractional.

Date (string)

  • string is a text string representing a date, example: "September 20, 1999".

Date (dateTime)

  • dateTime is a DateTime value.

Date (YYYY, MM, DD)

  • YYYY is a whole number representing a year, example: 1996.
  • MM is a whole number representing a month, example: 12 for December.
  • DD is a whole number representing a day of the month, example: 05.

Returns

A Date value.

Action

Date (number) | Returns a Date value given a number of days starting from December 30, 1899.
Date (string) | Returns a Date value given a string that represents a date from January 1, 100 through December 31, 9999.
Date (dateTime) | Returns the date portion of a given DateTime value.
Date (YYYY, MM, DD) | Returns a Date value given numeric arguments of the year, month, and day.

Examples

The following examples are applicable to Crystal syntax:

Date ("Dec 31, 1999")

Returns the Date value for Dec. 31, 1999.

Date (50)

Returns the Date value for February 18, 1900.

Date (#Oct. 20, 1999 12:02pm#)

Returns the Date value for October 20, 1999.

Date (1930, 7, 30)

Returns the Date value for July 30, 1930.

Comments

You can use the IsDate function to check if a String argument can be converted to a Date before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.

Related topics

DateSerial (year, month, day)


Time

Crystal syntax.

The CTime and TimeValue functions are equivalent to Time. However, Time can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • Time (number)
  • Time (string)
  • Time (dateTime)
  • Time (HH, MM, SS)
Arguments

Time (number)

  • Returns a Time value given a number in units of 24 hours
  • number can be fractional or negative as well

Time (string)

Returns a Time value that represents the time, given a String expression specifying a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive.

Time (dateTime)

DateTime is a DateTime value.

Time (hour, min, sec)

  • Hour is a whole number representing an hour of the day.
  • Min is a whole number representing a minute.
  • Sec is a whole number representing a second.

Returns

Time Value

Action

Creates a Time value from the information provided.

Typical uses

Use this function any time you need to work with a Time value that is obtained either from a DateTime value or from the individual elements of the time (i.e. hour, minute, second).

Examples

The following examples are applicable to Crystal syntax:

Time(.2) and Time (1.2)

Both return 4:48:00 AM

Time(-.2)

Returns 7:12:00 PM

Time("3:05pm")

Returns 3:05:00 PM

Time(DateTime(1996, 1, 1, 12, 10, 10)

Returns 12:10:10.

Time(10, 20, 22)

Returns 10:20:22.

Related topics

TimeValue


DateTime

Crystal syntax.

The CDateTime and DateTimeValue functions are equivalent to DateTime. However, DateTime can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • DateTime (date)
  • DateTime (number)
  • DateTime (string)
  • DateTime (date, time)
  • DateTime (YYYY, MM, DD)
  • DateTime (YYYY, MM, DD, HH, MM, SS)
Arguments

DateTime (date)

date is a Date value.

DateTime (date, time)

  • date is a Date value.
  • time is a Time value.

DateTime (string)

string represents a date and time

Example: "September 15, 1999, 10:45a.m."

DateTime (number)

number represents a number of days from December 30, 1899.

Example: 20 represents 20 days from December, 1899, which is January 19, 1900.

DateTime (year, month, day)

DateTime (year, month, day, hour, min, sec)

  • year is a whole number representing a calendar year, example: 1996.
  • month is a whole number representing a month, example: 1 for January.
  • day is a whole number representing a day of the month, example: 10.
  • hour is a whole number representing an hour of the day, example: 12.
  • min is a whole number representing a minute, example: 59.
  • sec is a whole number representing seconds, example: 30.

Returns

DateTime value.

Action

DateTime (date) | Returns a DateTime value given a Date value, assigning 12:00:00 AM for the time portion for the returned DateTime value.
DateTime (date, time) | Returns a DateTime value given a Date and a Time value.
DateTime (number) | Returns a DateTime value given a number that specifies the number of days from December 30, 1899. Number can be positive or negative, and can be fractional.
DateTime (string) | Returns a DateTime value given a string that specifies a date and time; various formats of the string are supported.
DateTime (YYYY, MM, DD) | Returns a DateTime value given numeric arguments for the year, month and day. Assigns 12:00:00 AM for the time portion for the returned DateTime value.
DateTime (YYYY, MM, DD, HH, MM, SS) | Returns a DateTime value given numeric arguments for the year, month, day, hour, minute and second.

Examples

The following examples are applicable to Crystal syntax:

DateTime ("10/4/1999 10:20am")

Returns the DateTime value October 4, 1999 10:20:00 am.

DateTime (12.5)

Returns the DateTime value January 11, 1900 12:00:00 pm.

DateTime (-2.5)

Returns the DateTime value December 27, 1899, 12:00:00 pm.

DateTime (CDate ("Dec. 25, 1999"))

Returns the DateTime value December 25, 1999 12:00:00 am.

DateTime (CDate ("November 10, 1999"), CTime("12:20am"))

Returns the DateTime value November 10, 1999 12:20:00 am.

DateTime (1945, 8, 21, 0, 0, 0)

Returns the DateTime value August 21, 1945 12:00:00 am.

DateTime (1945, 8, 21, 10, 0, 0)

Returns the DateTime value August 21, 1945 10:00:00 am.

Comments

You can use the IsDateTime function to check if a String argument can be converted to a DateTime before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.

Related topics

DateTimeValue


DateValue

Basic and Crystal syntax.

The CDate and Date functions are equivalent to DateValue. However, Date can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • DateValue (string)
  • DateValue (number)
  • DateValue (dateTime)
  • DateValue (YYYY, MM, DD)
Arguments

DateValue (number)

  • number is a value representing the number of days starting from December 30, 1899.
  • It can be positive or negative, and is truncated if fractional.

DateValue (string)

string is a text string representing a date, example: "September 20, 1999".

DateValue (dateTime)

dateTime is a DateTime value.

DateValue (YY,MM,DD)

  • year is a whole number representing a year, example: 1996.
  • month is a whole number representing a month, example: 12 for December.
  • day is a whole number representing a day of the month, example: 05.

Returns

Date value.

Action

DateValue (string) returns a Date value given a string that represents a date from January 1, 100 through December 31, 9999.

DateValue (number) returns a Date value given a number of days starting from December 30, 1899. Number can be positive or negative, and truncated if fractional.

DateValue (dateTime) returns the date portion of a given DateTime value.

DateValue (YYYY, MM, DD) returns a Date value given numeric arguments of the year, month and day.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DateValue ("Dec 31, 1999")

Returns the Date value for Dec. 31, 1999.

DateValue (50)

Returns the Date value for February 18, 1900.

DateValue (#Oct. 20, 1999 12:02pm#)

Returns the Date value for October 20, 1999.

DateValue (1930, 7, 30)

Returns the Date value for July 30, 1930.

Comments

You can use the IsDate function to check if a String argument can be converted to a Date before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.

Related topics

DateSerial (year, month, day)


TimeValue

Basic and Crystal syntax.

The CTime and Time functions are equivalent to TimeValue. However, Time can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • TimeValue (number)
  • TimeValue (string)
  • TimeValue (dateTime)
  • TimeValue (HH, MM, SS)
Arguments

TimeValue (number)

  • Returns a Time value given a number in units of 24 hours
  • number can be fractional or negative as well.

TimeValue (string)

Returns a Time value that represents the time, given a String expression specifying a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive.

TimeValue (dateTime)

DateTime is a DateTime value.

TimeValue (hour, min, sec)

  • Hour is a whole number representing an hour of the day.
  • Min is a whole number representing a minute.
  • Sec is a whole number representing a second.

Returns

Time value.

Action

TimeValue (number) returns a Time value given a number in units of 24 hours. The number can be negative or fractional as well.

TimeValue (string) returns a Time value that represents the time, given a String expression specifying a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive.

TimeValue (dateTime) returns the time portion of a given DateTime value.

TimeValue (HH, MM, SS) returns a Time value given numeric arguments of the hour, minute and seconds.

Examples

The following examples are applicable to both Basic and Crystal syntax:

TimeValue (.2)
TimeValue (1.2)

Both return the same value 4:48:00 a.m.

TimeValue (-.2)

Returns 7:12:00 pm

TimeValue ("Jan. 6, 1999 2:30pm")

Returns 2:30:00 pm

TimeValue (#Feb. 24, 1999 2:40pm#)

Returns 2:40:00 pm

TimeValue (18, 30, 30)

Returns 6:30:30 pm

Comments

You can use the IsTime function to check if a string argument can be converted to a Time before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately. See alsoTimeSerial (hour, minute, second).


DateTimeValue

Basic and Crystal syntax.

The CDateTime and DateTime functions are equivalent to DateTimeValue. However, DateTime can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • DateTimeValue (date)
  • DateTimeValue (date, time)
  • DateTimeValue (number)
  • DateTimeValue (string)
  • DateTimeValue (YYYY, MM, DD)
  • DateTimeValue (YYYY, MM, DD, HH, MM, SS)
Arguments

DateTimeValue (date)

  • date is a Date value.

DateTimeValue (date, time)

  • date is a Date value.
  • time is a Time value.

DateTimeValue (number)

  • number represents a number of days from December 30, 1899, example: 20 represents 20 days from December, 1899, which is January 19, 1900.

DateTimeValue (string)

  • string represents a date and time, example: "September 15, 1999, 10:45a.m."

DateTimeValue (year, month, day)

DateTimeValue (year, month, day, hour, min, sec)

  • year is a whole number representing a calendar year, example: 1996.
  • month is a whole number representing a month, example: 1 for January.
  • day is a whole number representing a day of the month, example: 10.
  • hour is a whole number representing an hour of the day, example: 12.
  • min is a whole number representing a minute, example: 59.
  • sec is a whole number representing seconds, example: 30.

Returns

DateTime value.

Action

DateTimeValue (date) returns a DateTime value given a Date value, assigning 12:00:00 AM for the time portion for the returned DateTime value.

DateTimeValue (date, time) returns a DateTime value given a Date and a Time value.

DateTimeValue (number) returns a DateTime value given a number that specifies the number of days from December 30, 1899. Number can be positive or negative, and can be fractional.

DateTimeValue (string) returns a DateTime value given a string that specifies a date and time; various formats of the string are supported.

DateTimeValue (YYYY, MM, DD) returns a DateTime value given numeric arguments for the year, month and day. Assigns 12:00:00 AM for the time portion for the returned DateTime value.

DateTimeValue (YYYY, MM, DD, HH, MM, SS) returns a DateTime value given numeric arguments for the year, month, day, hour, minute and second.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DateTimeValue ("10/4/1999 10:20am")

Returns the DateTime value October 4, 1999 10:20:00 am

DateTimeValue (12.5)

Returns the DateTime value January 11, 1900 12:00:00 pm

DateTimeValue (-2.5)

Returns the DateTime value December 27, 1899, 12:00:00 pm

DateTimeValue (CDate ("Dec. 25, 1999"))

Returns the DateTime value December 25, 1999 12:00:00 am

DateTimeValue (CDate ("November 10, 1999"), CTime("12:20am"))

Returns the DateTime value November 10, 1999 12:20:00 am

DateTimeValue (1945, 8, 21, 0, 0, 0)

Returns the DateTime value August 21, 1945 12:00:00 am

DateTimeValue (1945, 8, 21, 10, 0, 0)

Returns the DateTime value August 21, 1945 10:00:00 am

Comments

You can use the IsDateTime function to check if a String argument can be converted to a DateTime before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.


DateSerial (year, month, day)

Basic and Crystal syntax.

Arguments
  • year is a whole Number or numeric expression representing a year, example: 1996.
  • month is a whole Number or numeric expression representing a month, example: 12 for December.
  • day is a whole Number or numeric expression representing a day of the month, example: 5.
Returns

A Date value.

Action

DateSerial returns a Date value for the specified year, month and day. It also handles relative Date expressions.

Typical uses

DateSerial can be used instead of CDate or DateValue to create a Date value out of a year, month and day.

A useful feature of DateSerial is that the month argument does not have to be from 1 to 12 and the day argument does not have to be in the valid range for the number of days in the month. Such dates are interpreted as relative dates, and DateSerial will produce a valid Date value. This can be used to perform many computations with dates, without checking for special cases such as the end of the year, leap years and the number of days in a month. See the examples below for some typical applications.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DateSerial (1999, 6, 15)
DateSerial (2000, 1 - 7, 15)
DateSerial (1999, 1, 166)

All three return the date June 15, 1999. The second says that 7 months before January 1, 2000 is June 15, 1999. The third says that the 166th day of 1999 is June 15, 1999.

DateSerial (1996 + 12, 2 + 13, 29 + 14)

Returns April 12, 2009. What it means is that 12 years, 13 months and 14 days from February 29, 1996 is April 12, 2009.

Suppose you want to calculate the last day of the month for the DateTime field {Orders.Order Date}. Notice that in the calculation, DateSerial(Year(d), Month(d) + 1, 1) is the first day of the month after {Orders.Order Date} and then subtracting one day gives the desired result:

Rem Basic syntax
Dim d
d = {Orders.Order Date}
formula = DateSerial(Year(d), Month(d) + 1, 1 - 1)

//Crystal syntax
Local DateTimeVar d := {Orders.Order Date};
DateSerial(Year(d), Month(d) + 1, 1 - 1)

It is often useful to combine DateSerial with other date functions. For example, if you want to calculate the date of the last Friday of the month for the field {Orders.Order Date} you can do the following.

The calculation proceeds by finding the last day of the month and then subtracting off a number of days to get to a Friday. Since some months have 5 Fridays (example: October 1999) and some have 4 Fridays (example: November 1999), this approach is easier than working from the first day of the month.

Rem Basic syntax
Dim d1, d2
d1 = {Orders.Order Date}
d2 = DateSerial(Year(d1), Month(d1) + 1, 1 - 1)
formula = d2 - (WeekDay(d2, crFriday) - 1)

//Crystal syntax
Local DateTimeVar d1 := {Orders.Order Date};
Local DateVar d2;
d2 := DateSerial(Year(d1), Month(d1) + 1, 1 - 1);
d2 - (DayOfWeek(d2, crFriday) - 1)

Returns the Date value March 27, 1998 if {Orders.Order Date} is March 18, 1998.

Here is an example that returns the date of the second Tuesday of the month 3 months before {Orders.Order Date}:

Rem Basic syntax
Dim d1, d2
d1 = {Orders.Order Date}
d2 = DateSerial(Year(d1), Month(d1) - 3, 1)
formula = d2 + (2 * 7 - (WeekDay(d2, crTuesday) - 1))

//Crystal syntax
Local DateTimeVar d1 := {Orders.Order Date};
Local DateVar d2 := DateSerial(Year(d1), Month(d1) - 3, 1);
d2 + (2 * 7 - (DayOfWeek(d2, crTuesday) - 1))

Returns the Date value December 9, 1997 if {Orders.Order Date} is March 18, 1998.

Comment

This function is designed to work like the Visual Basic function of the same name.


TimeSerial (hour, minute, second)

Basic and Crystal syntax.

Arguments
  • hour is a Number or numeric expression specifying the hour.
  • minute is a Number or numeric expression specifying the number of minutes.
  • second is a Number or numeric expression specifying the number of seconds.
Returns

Time value.

Action

TimeSerial returns a Time value specifying the time for a specific hour, minute and second.

Typical uses

TimeSerial can be used instead of CTime or TimeValue to create a Time value out of an hour, minute and second.

A useful feature of TimeSerial is that the hour, minute and second arguments do not need to fall within normally valid ranges. That is, the hour does not need to be from 0 to 24 and the minute and second do not need to be from 0 to 59. Such times are interpreted as relative times, and TimeSerial will produce a valid Time value. This can be used to easily perform many computations with times.

Examples

The following examples are applicable to both Basic and Crystal syntax:

TimeSerial (18, 45, 0)
TimeSerial (22 - 3, 15 - 30, 0)

Both return the same time 6:45 PM. The second has the interpretation that 3 hours and 30 minutes before 10:15 PM is 6:45 PM.

TimeSerial (10 + 20, 30 + 55, 0)

Returns 7:25 AM. What it means is that 20 hours and 55 minutes from 10:30 AM is 7:25 AM (of the next day).

Comment

This function is similar to the Visual Basic function of the same name. There is a difference when the relative times span more than one day. For example, in Seagate Crystal Reports,

TimeSerial (1, 0 - 180, 0)

returns 10:00 PM. This has the interpretation that 180 minutes before 1:00 AM is 10:00 PM. However, the same function call in Visual Basic returns 2:00 AM. The difference occurs because 180 minutes before 1:00 AM moves the time to 10:00 PM of the previous day and Visual Basic then handles this differently.


IsDateTime

Basic and Crystal syntax.

Overloads
  • IsDateTime (string)
  • IsDateTime (number)
Arguments
  • string is a String value or expression to be tested for being convertible to a DateTime value. Many forms are accepted.
  • number is a Number value or expression to be tested for being convertible to a DateTime value. It can be positive, negative or fractional. It is interpreted as a number of days since December 30, 1899.
Returns

Boolean value (True or False).

Action

IsDateTime returns True if the given String or Number value can be converted to a valid DateTime and returns False otherwise. A valid DateTime is any date-time between January 1, 100 through December 31, 9999.

Typical use

If you want to convert a String value to a DateTime using the functions CDateTime or DateTimeValue, use the IsDateTime function first to check if the conversion will succeed. See the examples section of IsDate for an example of this type.

Examples

The following examples are applicable to both Basic and Crystal syntax:

IsDateTime ("September 30, 1999")

Returns True since the given string "September 30, 1999 is interpreted as the DateTime value September 30, 1999, 12:00:00am.

IsDateTime (-100.2)

Returns True since the given number argument is interpreted as the DateTime value September 20, 1899, 7:12:00 pm.

Comment

This function is similar to the Visual Basic function IsDate.


IsTime

Basic and Crystal syntax.

Overloads
  • IsTime (string)
  • IsTime (number)
Arguments
  • string is a String value or expression to be tested for being convertible to a Time value. Many forms are accepted
  • number is a Number value or expression to be tested for being convertible to a Time value. It can be positive, negative or fractional. It is interpreted as units of 24 hours. What this means is that 0 is 12 midnight and 0.5 is 12 noon.
Returns

Boolean value (True or False).

Action

IsTime returns True if the given String or Number value can be converted to a valid Time and returns False otherwise.

Typical use

If you want to convert a String value to a Time using the functions CTime or TimeValue, use the IsTime function first to check if the conversion will succeed. See the examples section of IsDate for an example of this type.

Examples

The following examples are applicable to both Basic and Crystal syntax:

IsTime ("10:30 pm")

Returns True.

IsTime ("September 30,1999")

Returns True since the given String argument is interpreted as 12:00:00 am.

IsTime (3.2)

Also returns True since the given Number argument is interpreted as 3.2 units of 24 hours, which is 4:48:00am.

Comment

This function is similar to the Visual Basic function IsDate, except that it works specifically with Seagate Crystal Report's Time type which holds Time values only.


IsDate

Basic and Crystal syntax.

Overloads
  • IsDate (string)
  • IsDate (number)
Arguments
  • string is a String value or expression to be tested for being convertible to a Date value. Many forms are accepted.
  • number is a Number value or expression to be tested for being convertible to a Date value. It can be positive, negative or fractional. It is interpreted as a number of days since December 30, 1899.
Returns

Boolean value (True or False).

Action

IsDate returns True if the given String or Number value can be converted to a valid Date and returns False otherwise. A valid Date is any date between January 1, 100 through December 31, 9999.

Typical use

If you want to convert a String value to a Date using the functions CDate or DateValue, use the IsDate function first to check if the conversion will succeed. See below for an example.

Examples

The following examples are applicable to both Basic and Crystal syntax:

IsDate ("Jan 1, 1999")

Returns True.

IsDate (100)

Also returns True since the number 100 is interpreted as 100 days from Dec. 30, 1899, which is April 9, 1900.

IsDate ("Feb 29, 1999")

Returns False since 1999 is not a leap year and so the String cannot be converted to a Date.

Suppose an orders report is grouped monthly by order date. Here is a formula that returns the Date value that is extracted from the GroupName String field. If the report is a TopN report, the GroupName field can have a value "Others". This can not be converted into a Date, and so IsDate is used to prevent an error from being generated in the call to CDate:

Rem Basic syntax
Dim s As String
s = GroupName ({Orders.Order Date}, "monthly")
If IsDate(s) Then
formula = CDate(s)
Else
formula = CDate(0,0,0)
End If

//Crystal syntax
Local StringVar s := GroupName ({Orders.Order Date}, "monthly");
If IsDate(s) Then
CDate(s)
Else
CDate(0,0,0)

Returns the Date value May 1, 1998 if the GroupName field value is "May - 1998". Returns the null Date (a non-printing Date value, if the GroupName field value is "Others".

Comment

This function is similar to the Visual Basic function of the same name, except that it works specifically with Seagate Crystal Report's Date type which holds date values only.


Year (x)

Basic and Crystal syntax.

Arguments

x is a Date value or a DateTime value.

Returns

Whole Number

Action

Year extracts the year from a date and returns it as a Number.

Typical uses

Use this function any time you need to use a year, converted to a Number, in calculations or comparisons.

Examples

The following examples are applicable to Crystal syntax:

Year({file.LAST INVOICE ON})

Returns 1989, where the last invoice date was in 1989.

If Year({file.LAST UPGRADE}) < 1988 Then
"P.S. You are missing out on many of the benefits of our new, improved version."
Else
""

Prints a P.S. for those customers who last upgraded prior to 1988, and prints nothing for those customers who show a more recent upgrade.

Year(CDateTime(1996, 3, 3, 10, 33, 20))

Returns 1996.

Comments

This function is designed to work like the Visual Basic function of the same name.


Month (x)

Basic and Crystal syntax.

Arguments

x is a Date value or a dateTime value.

Returns

Whole Number

Action

Month extracts the month component of a date and converts it to a Number.

Typical uses

Use any time you need only the month component of a date. For example, if you are tracking payments that fall within a given year, you are interested only in the month they arrive; day and year information would be redundant. Also, if you need to use the number of the month in a numeric calculation (Month({file.OCTPMT}) - Month({file.SEPPMT}), for example) use the Month function to extract the month component of the date and convert it to a Number.

Examples

The following examples are applicable to Crystal syntax:

Month({file.INVOICE}) - Month({file.PAYMENT})

Calculates the number of months between the Invoice and the Payment.

If Month({file.LAST PURCHASE}) < 6 Then
"You will see some changes since you last shopped our store."
Else
"As you have certainly noticed, we have been making many changes in our store recently.";

Prints "You will see some changes since you last shopped our store." for those customers whose last purchase was in May or earlier, and prints "As you have certainly noticed, we have been making many changes in our store recently." for customers who have purchased more recently than May.

Comments

This function is designed to work like the Visual Basic function of the same name.


Day (x)

Basic and Crystal syntax.

Arguments

x is a Date value or a DateTime value.

Returns

Whole Number (the day of the month)

Action

Day extracts the day from a Date or DateTime value and returns a whole number.

Typical uses

Use any time you need only the day component of a Date or DateTime value. For example, if you are tracking payments that fall within a given month, you are interested only in the day they arrive; month and year information would be redundant. Also, if you need to use the day of the month in a numeric calculation (example: Day({file.OCTPMT}) - Day ({file.SEPPMT})), use the Day function to extract the day of the month and convert it to a Number.

Examples

The following examples are applicable to Crystal syntax:

Day({file.LAST INVOICE})

Returns 10 where the last invoice date was the 10th day of the month.

If Day({file.LAST PAYMENT}) < 15 Then
"Past Due"
Else
""

If the day of the last payment was less than 15, print "Past Due", otherwise print nothing.

Day(CDateTime(1996, 3, 3, 10, 33, 20))

Returns 3.

Comments

This function is designed to work like the Visual Basic function of the same name.


WeekDay

WeekDay and DayOfWeek are equivalent functions. However, WeekDay is preferred in Basic syntax and DayOfWeek is preferred in Crystal syntax.

Overloads
  • WeekDay (date)
  • WeekDay (date, firstDayOfWeek)
Arguments
  • date is a Date or DateTime value for which a numeric designation for the day of the week is to be returned.
  • firstDayOfWeek is an optional Number indicating the first day of the week. See DayOfWeek for more information. If not specified, Sunday is assumed.
Returns

Number value.

Action

WeekDay returns a number n which is the nth day of the week given a Date or DateTime value.

Typical use

WeekDay is often useful in performing date computations that take into account special days of the week such as weekends. See the DateSerial (year, month, day) examples section for some examples.

Examples

The following examples are applicable to both Basic and Crystal syntax:

WeekDay (#Oct. 4, 1999#)

Returns 2 since Oct. 3, 1999 is a Monday, and the first day of the week is assumed to be Sunday.

WeekDay (#Oct. 4, 1999#, crMonday)

Returns 1 since Oct. 3, 1999 is a Monday, and the first day of the week is specified to be Monday.

Comments

This function is designed to work like the Visual Basic function of the same name.


DayOfWeek

DayOfWeek and WeekDay are equivalent functions. However, WeekDay is preferred in Basic syntax and DayOfWeek is preferred in Crystal syntax.

Overloads
  • DayOfWeek (date)
  • DayOfWeek (date, firstDayOfWeek)
Arguments

date is a Date value or dateTime value.

Returns

Whole Number

Action

DayOfWeek determines the day of the week the given date falls on, and converts the day of the week to a Number (1 to 7). Optionally a numeric value for the first day of the week can be specified. If the first day of the week is not specified, Sunday is assumed.

Typical uses

Use this function any time you need to use the day of the week as a Number.

Examples

The following examples are applicable to Crystal syntax:

DayOfWeek(Date(1990,10,1))

Returns 2 where October 1, 1990 is a Monday.

If DayOfWeek({orders.ORDER DATE}) = 3 Then
"Sam"
Else
"Bill"

In determining whether Sam or Bill was on duty on September 8, 1990.

If DayOfWeek({orders.ORDER DATE}) = 7 Then
"Saturday"
Else
""

DayOfWeek(#Sept. 24, 1999#, crMonday)

Returns 5 where Sept. 24, 1999, is a Friday, and Monday is specified to be the first day of the week.

Comments

If you want to get the day of the week spelled out, in Crystal syntax, use this formula:

["Sun", "Mon", "Tues",...] [DayOfWeek(Date)]

Sets up an array (["Sun",...]) and uses the number of the day of the week (Sun = 1, Sat = 7) to select the desired date name from the array.

Related topics

Formula 10


Hour (x)

Basic and Crystal syntax.

Arguments

x is a Time value or DateTime value.

Returns

Whole Number

Action

The Hour function extracts the hour portion of a Time value and returns it as a whole number.

Typical uses

Use this function anytime you need to display just the hour portion of a Time value or to perform calculations based on hours.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Hour(CTime(10, 20, 22))

Returns 10.

Hour(CTime(10, 00, 30)) - Hour(CTime(6, 00, 00))

Returns 4.

Comments

This function is designed to work like the Visual Basic function of the same name.


Minute (x)

Basic and Crystal syntax.

Arguments

x is a Time value.

Returns

Whole Number

Action

Retrieves just the minutes from a Time value.

Typical uses

Use this function whenever you need to work with the minutes specified in a Time value for performing time calculations.

Examples

The following examples are applicable to Crystal syntax:

Minute(CTime(10, 20, 22))

Returns 20.

TimeVar ShipTime := CTime({orders.SHIP DATE});
Minute(ShipTime)

Returns 30 if {orders.SHIP DATE} is 1998/12/05 8:30:15.

Comments

This function is designed to work like the Visual Basic function of the same name.


Second (x)

Basic and Crystal syntax.

Arguments

x is a Time value or DateTime value.

Returns

Whole Number

Action

Extracts the seconds portion of a specified Time value.

Typical uses

Use this function anytime you need to perform calculations with the seconds indicated in a Time value.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Second(CTime(10, 20, 22))

Returns 22.

Comments

This function is designed to work like the Visual Basic function of the same name.


MonthName

Basic and Crystal syntax.

Overloads
  • MonthName (month)
  • MonthName (month, abbreviate)
Arguments
  • month is a whole Number representing the month of the year, value between 1 and 12, with 1 being January.
  • abbreviate is an optional Boolean value that indicates if the month name is to be abbreviated. If omitted, the default is False.
Returns

String value.

Action

MonthName returns a string name for the specified month.

Examples

The following examples are applicable to both Basic and Crystal syntax:

MonthName (4)

Returns the String value "April".

MonthName (4, True)

Returns "Apr".

Comment

This function is designed to work like the Visual Basic function of the same name.


WeekdayName

Basic and Crystal syntax.

Overloads
  • WeekdayName (weekday)
  • WeekdayName (weekday, abbreviate)
  • WeekdayName (weekday, abbreviate, firstDayOfWeek)
Arguments
  • weekday is the numeric designation for the day of the week. Numeric value of each day depends on the value of the firstDayOfWeek argument. If firstDayOfWeek is not specified, crSunday is assumed.
  • abbreviate is an optional Boolean value that indicates if the weekday name is to be abbreviated. If omitted, the default is False.
  • firstDayOfWeek is an optional Number indicating the first day of the week. See Day of Week constants.
Returns

String value.

Action

WeekdayName returns a String indicating the name of the specified day of the week.

Examples

The following examples are applicable to both Basic and Crystal syntax:

WeekdayName (3)

Returns "Tuesday" since Sunday is assumed to be the first day of the week.

WeekdayName (3, True, crMonday)

Returns "Wed" since abbreviation is selected and the first day of the week is specified to be Monday.

Comments

This function is designed to work like the Visual Basic function of the same name.


Timer ( )

Basic and Crystal syntax.

Returns

Number value.

Action

Timer returns the number of seconds elapsed since midnight.

Example

The following example is applicable to both Basic and Crystal syntax:

Timer

Returns 57,720 if the current time is 4:02 PM.

Comments

This function is designed to work like the Visual Basic function of the same name.


DateAdd (intervalType, nIntervals, startDateTime)

Basic and Crystal syntax.

Arguments

intervalType is a String expression specifying the interval of time to be added. Values can be:

IntervalType value | Description
yyyy | Year
q | Quarter (3-month period)
m | Month
y | Day of year
d | Day
w | Weekday
ww | Week (7-day period)
h | Hour
n | Minute
s | Second

  • nIntervals is a Number or numeric expression specifying the number of intervals to be added. It can be positive (to get date-times in the future) or negative (to get date-times in the past).
  • startDateTime is the DateTime value to which the intervals are to be added.
Returns

A DateTime value.

Action

DateAdd returns a DateTime value to which a specified number of time intervals have been added.

Typical use

DateAdd is used to add intervals of time to a DateTime. Its main feature is that the DateTime returned will always be valid. For example, DateAdd takes into account such factors as the number of days in a month and leap years. If you want to add or subtract days to a DateTime, you could use the addition and subtraction operators instead of DateAdd with the "d" parameter. However, DateAdd also handles other types of intervals such as adding months or hours to a DateTime.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DateAdd("d", -32, #Sept 28, 1999#)

Returns the DateTime value for August 27, 1999.

DateAdd ("m", 1, #1/31/1996#)

Returns the DateTime value for February 29, 1996. Notice that DateAdd will not return the invalid value February 31, 1996.

DateAdd ("q", 17, #Sept 28, 1999#)

Returns the DateTime value for December 28, 2003.

DateAdd ("h", -400, #Sept 28, 1999#)

Returns the DateTime value for September 11, 1999 8:00 AM. In other words, this is the result of subtracting 400 hours from September 28, 1999 12:00 AM.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • To add days to a date-time, you can use any of the interval type parameters "y", "d" or "w". They all have the same effect for DateAdd.
  • DateAdd returns a DateTime value and not a Date value. However, you may need to convert this DateTime value to a Date value in certain situations (such as if you wanted to assign the value returned by DateAdd to a Date type variable). To convert to a Date value, use DateAdd in combination with the CDate type conversion function. For example, the following returns the Date value for October 6, 1997:

CDate(DateAdd("yyyy", -2, #October 6, 1999#))


DateDiff

Basic and Crystal syntax.

Overloads
  • DateDiff (intervalType, startDateTime, endDateTime)
  • DateDiff (intervalType, startDateTime, endDateTime, firstDayOfWeek)
Arguments
  • intervalType is a String expression that is the interval of time you use to calculate the difference between startDateTime and endDateTime. Possible values can be:

    Interval type value Description

    yyyy

    Year

    q

    Quarter

    m

    Month

    y

    Day of year

    d

    Day (both "y" and "d" find the difference in days)

    w

    Number of weeks between startDateTime and endDateTime

    ww

    Number of firstDayOfWeek's between startDateTime and endDateTime

    h

    Hour

    n

    Minute

    s

    Second

  • startDateTime is the first DateTime value used in calculating the difference.
  • endDateTime is the second DateTime value used in calculating the difference.
  • firstDayOfWeek is an optional constant specifying the first day of the week. If not specified, crSunday is assumed. See Day of Week constants.
Returns

A Number value.

Action

DateDiff returns a number of time intervals between two specified dates.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Use DateDiff with the "d" or "y" interval type parameter to find the number of days between two dates:

DateDiff ("d", #10/7/1999#, #10/10/1999#)

Returns 3.

Use DateDiff with the "yyyy" interval type parameter to find the number of years difference between two dates. This use of DateDiff is the same as finding the difference between the year of endDateTime and the year of startDateTime.

DateDiff ("yyyy", #10/7/1999#, #2/10/2005#)

Returns 6.

DateDiff ("yyyy", #12/31/1999#, #1/1/2000#)

Returns 1 (a 1 year difference), even though there is only a 1 day difference between the dates.

DateDiff ("yyyy", #1/1/1999#, #12/31/1999#)

Returns 0 (a 0 year difference), even though there is a 364 day difference.

Suppose that for the above examples, the first date is the date that you bought a mutual fund, and the second date is the date you sold it. The mutual fund company must send you an annual report for every year in which you owned units in the fund. Thus, you would get 7, 2 and 1 annual reports respectively, in the above cases.

Use DateDiff with the "q" parameter to find the number of quarters (3 month periods) difference between two dates.

DateDiff ("q", #10/6/1999#, #5/20/2003#)

Returns 14.

DateDiff ("q", #3/31/1999#, #4/1/1999#)

Returns 1. The two dates are in adjacent quarters.

DateDiff ("q", #1/1/1999#, #3/31/1999#)

Returns 0. The two dates are in the same quarter.

Suppose the mutual fund company in the "yyyy" example mailed out quarterly reports. Then it would need to mail out 15, 2 and 1 quarterly reports respectively, in the above cases.

Use DateDiff with the "m" parameter to find the number of months difference between two dates.

DateDiff ("m", #3/15/1999#, #7/13/1999#)

Returns 4.

Use DateDiff with the "w" parameter to calculate the number of weeks between two dates. For example, if startDateTime is on a Tuesday, DateDiff counts the number of Tuesdays between startDateTime and endDateTime not including the initial Tuesday of startDateTime. Note however that it counts endDateTime if endDateTime is on a Tuesday.

DateDiff ("w", #10/19/1999#, #10/25/1999#)

Returns 0.

DateDiff ("w", #10/19/1999#, #10/26/1999#)

Returns 1.

Use DateDiff with the "ww" parameter to calculate the number of firstDayOfWeek's occurring between two dates. For the DateDiff function, the "ww" parameter is the only one that makes use of the firstDayOfWeek argument. It is ignored for all the other interval type parameters. For example, if firstDayOfWeek is crWednesday, it counts the number of Wednesday's between startDateTime and endDateTime. It does not count startDateTime even if startDateTime falls on a Wednesday, but it does count endDateTime if endDateTime falls on a Wednesday. For the examples, note that October 6, 13, 20 and 27 all fall on a Wednesday in 1999.

DateDiff ("ww", #10/5/1999#, #10/29/1999#, crWednesday)

Returns 4.

DateDiff ("ww", #10/6/1999#, #10/29/1999#, crWednesday)

Returns 3.

DateDiff ("ww", #10/5/1999#, #10/27/1999#, crWednesday)

Returns 4.

For example, suppose you want to calculate the number of days between the order date and ship date, excluding Saturdays and Sundays:

Rem Basic syntax
Dim d1, d2
d1 = {Orders.Order Date}
d2 = {Orders.Ship Date}
formula = DateDiff("d", d1, d2) - _
DateDiff("ww", d1, d2, crSaturday) - _
DateDiff("ww", d1, d2, crSunday)

//Crystal syntax
Local DateTimeVar d1 := {Orders.Order Date};
Local DateTimeVar d2 := {Orders.Ship Date};
DateDiff ("d", d1, d2) -
DateDiff ("ww", d1, d2, crSaturday) -
DateDiff ("ww", d1, d2, crSunday)

Comment

This function is designed to work like the Visual Basic function of the same name.


DatePart

Basic and Crystal syntax.

Overloads
  • DatePart (intervalType, inputDateTime)
  • DatePart (intervalType, inputDateTime, firstDayOfWeek)
  • DatePart (intervalType, inputDateTime, firstDayOfWeek, firstWeekOfYear)
Arguments
  • intervalType a String expression that specifies the part of a date to be returned. Possible values can be:

    Interval type value Description

    yyyy

    Extracts the year

    q

    Quarter (the result is 1, 2, 3 or 4

    m

    Month (the result is from 1 to 12)

    y

    Day of year (1 to 365 or 366 in a leap year)

    d

    Day part of the date (1 to 31)

    Year

    w

    Day of week (1 to 7 with the result depending on firstDayOfWeek)

    ww

    Week of year (1 to 53 with firstDayOfWeek and firstWeekOfYear determining the exact days of the first calendar week of the year)

    h

    Extracts the hour part of the given DateTime (0 to 23)

    n

    Minute part (0 to 59)

    s

    Second part (0 to 59)

  • inputDateTime is the DateTime value whose part will be extracted.
  • firstDayOfWeek is an optional constant used to specify the first day of the week. If not specified, crSunday is assumed. See Day of Week constants for more information.
  • firstWeekOfYear is an optional constant specifying the first week of the year. If not specified, the first week is assumed to be the one in which Jan. 1 occurs (crFirstJan1). See First Week of Year constants.
Returns

A Number value.

Action

DatePart returns a Number that specifies a given part of a given date.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DatePart ("d", #August 15, 1999#)

Returns 15.

DatePart ("m", #August 15, 1999#)

Returns 9.

DatePart ("n", #10:35 am#)

Returns 35.

DatePart ("q", #September 29, 1999#)

Returns 3 since September 29 is in the third quarter of the year.

DatePart ("ww", #September 14, 1997#)

Returns 38 since September 14, 1997 is in the 38th week of 1997.

Suppose that a company wants to stamp an id number on each of its shipments for quality control purposes. The id is composed of the order id, followed by a dash, followed by the week the order was shipped, followed by the last two digits of the year. Here is an example formula that produces these ids:

Rem Basic syntax
formula = CStr({Orders.Order ID}, 0, "") & "-" & _
CStr(DatePart("ww", {Orders.Ship Date}), 0) & _
CStr({Orders.Ship Date}, "yy")

//Crystal syntax
CStr({Orders.Order ID}, 0, "") & "-" &
CStr(DatePart("ww", {Orders.Ship Date}), 0) &
CStr({Orders.Ship Date}, "yy")

Returns the string "2082-3897" if {Orders.Order ID} is 2082 and {Orders.Ship Date} is September 14, 1997.

Comments

This function is designed to work like the Visual Basic function of the same name.

The DatePart function with "yyyy" intervalType argument is the same as the Year function. Similarly, the DatePart function with "m", "d", "w", "h", "n" and "s" intervalType argument is the same as the functions Month, Day, Weekday (or DayOfWeek), Hour, Minute and Second respectively. On the other hand, there is no easy alternative to using the DatePart function for the "q", "y" and "ww" intervalType arguments.

The firstDayOfWeek argument affects the DatePart function when the interval type argument is "w" or "ww". For all other intervalType argument values, it is ignored.

The firstWeekOfYear argument affects the DatePart function only when the intervalType argument is "ww". For all other intervalType argument values, it is ignored.


First Day of Week/Year constants

Day of Week constants

Day of Week enclosure constants

First Week of Year constants


Date Range functions

Date range functions are preset date ranges that can be used in formulas.

WeekToDateFromSun

MonthToDate

YearToDate

Last7Days

Last4WeeksToSun

LastFullWeek

LastFullMonth

AllDatesToToday

AllDatesToYesterday

AllDatesFromToday

AllDatesFromTomorrow

Aged0To30Days, Aged31To60Days, Aged61To90Days

Over90Days

Next30Days, Next31To60Days, Next61To90Days, Next91To365Days

Calendar1stQtr, Calendar2ndQtr, Calendar3rdQtr, Calendar4thQtr

Calendar1stHalf, Calendar2ndHalf

LastYearMTD

LastYearYTD


WeekToDateFromSun

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all days from last Sunday to Today (including today).

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in WeekToDateFromSun Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls within the range of last Sunday to Today (including today). The following table identifies the first and last dates included in the date range if today equals 04/13/95.

If today = 04/13/95 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range (previous Saturday) | 04/08/95 | 0
first date included (previous Sunday) | 04/09/95 | 1252.24
 | 04/11/95 | 1597.87
 | 04/12/95 | 2546.35
last date included | 04/13/95 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


MonthToDate

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all dates from the first day of the month to today.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in MonthToDate Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from the first day of the month to today. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 03/31/98 | 0
first date included | 04/01/98 | 1252.24
 | 04/05/98 | 1597.87
 | 04/09/98 | 2546.35
last date included | 04/10/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


YearToDate

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all days from the first day of the calendar year to today.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in YearToDate Then
{orders.ORDER AMOUNT}
Else
0

Returns the Order Amount if the date falls within the range of the first day of the calendar year to today. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 12/31/97 | 0
first date included | 01/01/98 | 1252.24
 | 02/28/98 | 1597.87
 | 03/15/98 | 2546.35
last date included | 04/10/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


Last7Days

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all dates from seven days ago to today (including today).

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in Last7Days Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from seven days ago to today (including today). The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 04/03/98 | 0
first date included | 04/04/98 | 1252.24
 | 04/06/98 | 1597.87
 | 04/08/98 | 2546.35
last date included | 04/10/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


Last4WeeksToSun

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of dates that includes the four weeks previous to last Sunday. A week begins on a Monday and ends on a Sunday. For example, September, 1996, begins on a Sunday.

  • If today is September 22 (Sunday), Last4WeeksToSun begins on August 26 (Monday) and ends on September 22 (today, Sunday).
  • If today is September 28 (a Saturday), Last4WeeksToSun begins on August 26 (a Monday) and ends on September 22 (the previous Sunday).
Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in Last4WeeksToSun Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls within the last 4 weeks to Sunday (See Action section for specifics). The following table identifies the first and last dates included in the date range if today equals 04/10/95 (Monday).

If today = 04/10/95 | {orders. ORDER DATE} | {orders. ORDER AMOUNT}
not in range | 03/12/95 | 0
first date included | 03/13/95 | 1252.24
 | 03/27/95 | 1597.87
 | 04/05/95 | 2546.35
last date included (Sunday before current date) | 04/09/95 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


LastFullWeek

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all dates from Sunday to Saturday of the previous week.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in LastFullWeek Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from Sunday to Saturday of the last full week. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 03/28/98 | 0
first date included | 03/29/98 | 1252.24
last date included | 04/04/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


LastFullMonth

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all dates from the first to last day of the previous month.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in LastFullMonth Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from the previous month. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 02/28/98 | 0
first date included | 03/01/98 | 1252.24
 | 03/15/98 | 1597.87
 | 03/27/98 | 2546.35
last date included | 03/31/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


AllDatesToToday

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes every day up through the present day. AllDatesToToday includes the present day.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in AllDatesToToday Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from the first date entered to today (including today). The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
first date included (earliest date in field) | 12/10/97 | 1252.24
 | 01/05/98 | 1597.87
 | 03/05/98 | 2546.35
last date included | 04/10/98 | 5462.21
not in range | 04/11/98 | 0

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


AllDatesToYesterday

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes every day up through the previous day. AllDatesToYesterday includes all dates before today, but does not include the present day.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in AllDatesToYesterday Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from the first date entered to yesterday. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
first date included (earliest date in field) | 12/10/97 | 1252.24
 | 01/05/98 | 1597.87
 | 03/05/98 | 2546.35
last date included | 04/09/98 | 5462.21
not in range | 04/10/98 | 0

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


AllDatesFromToday

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes any date from the present day to any future Date value that may appear in a field. AllDatesFromToday includes the present day.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in AllDatesFromToday Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from today (including today) to all future dates. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 04/09/98 | 0
first date included | 04/10/98 | 1252.24
 | 07/08/98 | 1597.87
 | 09/24/98 | 2546.35
last date included (latest date in field) | 10/08/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


AllDatesFromTomorrow

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that fall after the present day. AllDatesFromTomorrow does not include the present day, but does include any future date.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in AllDatesFromTomorrow Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date from tomorrow to all future dates. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 04/10/98 | 0
first date included | 04/11/98 | 1252.24
 | 07/08/98 | 1597.87
 | 09/24/98 | 2546.35
last date included (latest date in field) | 10/08/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


Aged0To30Days, Aged31To60Days, Aged61To90Days

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that fall within a certain time period before the present date. If the current date is 12/30/98, Aged0To30Days specifies the period from 12/1/98 to the present date, Aged31To60Days specifies the period from 11/1/98 to 11/30/98, and Aged61To90Days specifies the period 10/2/98 to 10/31/98.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in Aged0To30Days Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls within the previous 30 days from today's date. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 03/10/98 | 0
first date included | 03/11/98 | 1252.24
 | 03/15/98 | 1597.87
 | 04/05/98 | 2546.35
last date included | 04/10/98 | 5462.21

If {orders.ORDER DATE} in Aged31To60Days Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls within the previous 31 to 60 days from today's date. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 02/08/98 | 0
first date included | 02/09/98 | 1252.24
 | 02/25/98 | 1597.87
 | 03/05/98 | 2546.35
last date included | 03/10/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


Over90Days

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all values that are more than 90 days older than the current date.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in Over90Days Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls in the range of over 90 days from today's date. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
first date included (earliest date in field) | 12/10/97 | 1252.24
 | 12/31/97 | 1597.87
 | 01/05/98 | 2546.35
last date included | 01/09/98 | 5462.21
not in range | 01/10/98 | 0

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


Next30Days, Next31To60Days, Next61To90Days, Next91To365Days

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all dates in the period specified starting from today (including today).

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in Next30Days Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls anywhere in the next 30 days starting from today (including today). The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 04/09/98 | 0
first date included | 04/10/98 | 1252.24
 | 04/30/98 | 1597.87
 | 05/05/98 | 2546.35
last date included | 05/10/98 | 5462.21

If {orders.ORDER DATE} in Next31To60Days Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls anywhere in the next 31 to 60 days starting from today. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 05/10/98 | 0
first date included | 05/11/98 | 1252.24
 | 05/30/98 | 1597.87
 | 06/03/98 | 2546.35
last date included | 06/09/98 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


Calendar1stQtr, Calendar2ndQtr, Calendar3rdQtr, Calendar4thQtr

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that falls within the 1st, 2nd, 3rd, or 4th quarter of the calendar year. The first quarter of the calendar year includes all dates from January 1st through March 31st. The second quarter of the calendar year includes all dates from April 1st through June 30th. The third quarter of the calendar year includes all dates from July 1st through September 30th. The fourth quarter of the calendar year includes all dates from October 1st through December 31st.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in Calendar1stQtr Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date in the 1st quarter of the calendar year. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 12/10/97 | 0
first date included | 01/01/98 | 1252.24
 | 02/05/98 | 1597.87
 | 03/15/98 | 2546.35
last date included | 03/31/98 | 5462.21


Calendar1stHalf, Calendar2ndHalf

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all dates that fall within the first or second half of the calendar year, respectively. The first half of the calendar year includes all dates from January 1st through June 30th. The second half of the calendar year includes all dates from July 1st through December 31st.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in Calendar1stHalf Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date in the 1st half of the calendar year. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 12/10/97 | 0
first date included | 01/01/98 | 1252.24
 | 03/05/98 | 1597.87
 | 05/15/98 | 2546.35
last date included | 06/30/98 | 5462.21


LastYearMTD

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values in the previous year that matches the current month to date.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in LastYearMTD Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date in the current month last year, up to the current date last year. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 03/31/97 | 0
first date included | 04/01/97 | 1252.24
 | 04/05/97 | 1597.87
 | 04/08/97 | 2546.35
last date included | 04/10/97 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


LastYearYTD

Basic and Crystal syntax.

Returns

None

Action

Specifies a range of Date values that includes all dates in the last year, up to the current date last year.

Examples

The following examples are applicable to Crystal syntax:

If {orders.ORDER DATE} in LastYearYTD Then
{orders.ORDER AMOUNT}
Else
0

Returns the Amount if the date falls on any date in the last year, up to the current date last year. The following table identifies the first and last dates included in the date range if today equals 04/10/98.

If today = 04/10/98 | {orders.ORDER DATE} | {orders.ORDER AMOUNT}
not in range | 12/31/96 | 0
first date included | 01/01/97 | 1252.24
 | 02/16/97 | 1597.87
 | 03/24/97 | 2546.35
last date included | 04/10/97 | 5462.21

Note: If you would like to base the date range on a date other than today's date, you must either change the date via the Date/Time option in the Windows Control Panel, or change the report print date via the Set Print Date/Time command in the Report Menu.


Arrays

Array (x,...)

MakeArray (x, ...)

UBound (array)

Array summary functions (x)

SummaryFunction (x)


Array (x,...)

Basic syntax.

Array and MakeArray (x, ...) are equivalent functions. However, Array cannot be used in Crystal syntax since it is a keyword for declaring array variables in that syntax.

Arguments

The given arguments are array elements with which to initialize the array. The number of array elements can be any number between 1 and 1000. All the arguments must be of the same type. Unlike Visual Basic, you may not have 0 number of elements.

Returns

Array of values.

Action

The Array function creates an array, initializes it with the given array elements and returns it.

Typical use

To create and initialize an array variable in Basic syntax.

In Crystal syntax, you can use the square bracket notation for arrays instead.

Example

The following example is applicable to Basic syntax:

The following sets up an array of days for a week, starting with Monday:

Dim week, firstDay, lastDay
week = Array("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", _
"Saturday", "Sunday")
Rem firstDay contains "Monday"
firstDay = week(1)
Rem lastDay contains "Sunday"
lastDay = week(7)
formula = firstDay

Returns "Monday".

Comments

This function is designed to work like the Visual Basic function of the same name.


MakeArray (x, ...)

Basic and Crystal syntax.

Array (x,...) and MakeArray are equivalent functions. However, Array cannot be used in Crystal syntax since it is a keyword for declaring array variables in that syntax.

Arguments

The given arguments are array elements with which to initialize the array. The number of array elements can be any number between 1 and 1000. All the arguments must be of the same type.

Returns

Array of values.

Action

MakeArray creates an array, initializes it with the given array elements and returns it.

Typical use

To create and initialize an array variable, especially in Basic syntax.

In Crystal syntax, you can use the square bracket notation for arrays instead.

Example

The following example is applicable to Crystal syntax:

Local NumberVar Array x := MakeArray (1, 1000, 10, 100, 10);

Creates and initializes an array x with five Number elements: 1, 1000, 10, 100, 10.


UBound (array)

Basic and Crystal syntax.

Argument

array is an array value, expression or variable.

Returns

Number value.

Action

UBound returns a Number containing the largest available subscript for the given array.

Typical use

Commonly used to obtain the size of an array before using a looping control mechanism to systematically manipulate elements of the array.

Examples

The following examples are for both Basic and Crystal syntax:

Rem Basic syntax
Dim simpleArray(10) As Number
formula = UBound(simpleArray)

//Crystal syntax
Local NumberVar Array simpleArray;
Redim simpleArray[10];
UBound(simpleArray)

Returns 10.

Rem Basic syntax
Dim dateArray () As Date
dateArray = Array (CDate(#12/25/1998#), CDate(#12/24/1999#))
formula = UBound(dateArray)

//Crystal syntax
Local DateVar Array dateArray;
dateArray := [CDate(#12/25/1998#), CDate(#12/24/1999#)];
UBound (dateArray)

Returns 2.

Comments
  • This function is designed to work like the Visual Basic function of the same name.

    Note: Unlike Visual Basic, only 1 dimensional arrays are supported in Seagate Crystal Reports. Also, array subscripts start at 1 in Seagate Crystal Reports and not 0 as is the default in Visual Basic.

  • UBound returns 1 for an uninitialized array variable, however, it causes an error to subscript an uninitialized array variable. The reason for this behavior is that at present Seagate Crystal Reports does not support arrays with zero elements. To work around this problem, always initialize your array variables. For example, initialize Global array variables in a formula located in the report header and local array variables within the formula itself.


Array summary functions (x)

Average (x)

See Average (fld), Average (fld, condFld), Average (fld, condFld, cond), Average (x)

Count (x)

See Count (fld), Count (fld, condFld), Count (fld, condFld, cond), Count (x).

DistinctCount

See DistinctCount (fld), DistinctCount (fld, condFld), DistinctCount (fld, condFld, cond), DistinctCount (x)

Maximum (x)

See Maximum (fld), Maximum (fld, condFld), Maximum (fld, condFld, cond), Maximum (x).

Minimum

See Minimum (fld), Minimum (fld, condFld), Minimum (fld, condFld, cond), Minimum (x).

PopulationStdDev (x)

See PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x)

PopulationVariance (x)

See PopulationVariance (fld), PopulationVariance (fld, condFld), PopulationVariance (fld, condFld, cond), PopulationVariance (x).

StdDev (x)

See StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x).

Sum (x)

See Sum (fld), Sum (fld, fld), Sum (fld, condFld), Sum (fld, condFld, cond), Sum (x)

Variance

See Variance (fld), Variance (fld, condFld), Variance (fld, condFld, cond), Variance (x).


SummaryFunction (x)

Basic and Crystal syntax.

Arguments

x is an array of values that can be evaluated by the function being used.

Returns

Fractional Number

Action

SummaryFunction (x) summarizes the values in an array of constants, data field values, or formulas (a*b, c/d, etc.) separated by commas.

Typical uses

Use any time you want to summarize two or more values.

Examples

The following examples are applicable to Crystal syntax:

Note: Use the Array (x,...) function to create the arrays instead of square brackets to make Basic syntax examples.

SummaryFunction([25,50,75,100])

Summarizes the values in an array of constants.

SummaryFunction([{file.PERIOD 8}, {file.PERIOD 9}, {file.PERIOD 10}])

Summarizes the values in an array of field values.

Average ([10,12,32,48])

Calculates the average of the values in an array of constants.

Count([1,2,3,4,5])

Returns 5. Counts the total number of values in the array.

DistinctCount([1,3,5,3,2,5])

Returns 4. Counts the number of distinct values in the array. Duplicate values are ignored.

Variance([{file.QTY1}, {file.QTY2}, {file.QTY3}, {file.QTY4}])

Returns 17.00 where Qty1 = 2, Qty2 = 2, Qty3 = 10, and Qty4 = 8.


Type Conversion functions

These functions allow you to convert from one data type to another.

CBool (number or currency)

CCur

CDbl

CStr

CDate

CTime

CDateTime


CBool (number or currency)

Basic and Crystal syntax.

Argument

A single argument that can be either a Number or Currency value or expression.

Returns

Boolean value

Action

CBool returns True if the argument is positive or negative but not 0 and returns False if the argument is 0.

Example

The following example is applicable to Basic and Crystal syntax:

CBool({Item.NETSALES})

Returns True if there is an increase or decrease in net sales; returns False if net sales is 0.

Comment

This function is designed to work like the Visual Basic function of the same name.


CCur

Basic and Crystal syntax.

Overloads
  • CCur (number or currency)
  • CCur (string)
Arguments

CCur (number or currency) | number or currency is a Number or Currency value or expression.
CCur (string) | string is a String value or expression.

Returns

Currency value

Action

CCur returns a Currency value created by converting the given Number, Currency or String type argument to a Currency value. If the conversion cannot be done, an error occurs.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CCur (200.20)

In Crystal syntax this is equivalent to writing $200.20. In Basic syntax, CCur (200.20) is the way to directly create a Currency value of 200.20.

CCur ("$200.20")

Returns the Currency value CCur (200.20) given the String value "$200.20".

CCur ("two hundred dollars")

Causes an error to occur. The CCur function cannot convert the String "two hundred dollars" to a Currency value.

Comments
  • This function is designed to work like the Visual Basic function of the same name.
  • You can use the IsNumeric (str) or NumericText (str) function to check if the String argument can be converted to a Currency before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.
  • In Crystal syntax, you can use the To currency operator operator instead of CCur when converting from a Number value to a Currency value.


CDbl

Basic and Crystal syntax.

CDbl and ToNumber (numeric), ToNumber (string) are equivalent functions.

Overloads
  • CDbl (number or currency)
  • CDbl (string)
Arguments

CDbl (number or currency) | number or currency is a Number or Currency value or expression.
CDbl (string) | string is a String value or expression.

Returns

Number value

Action

CDbl returns a Number value created by converting the given Number, Currency or String type argument to a Number value. If the conversion cannot be done, an error occurs.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CDbl ({Orders.Order Amount})

Returns the value of the Currency field {Orders.Order Amount} converted to Number type.

CDbl ("$120.20")

Returns the Number value of 120.2.

Comments
  • This function is designed to work like the Visual Basic function of the same name.

You can use the IsNumeric (str) or NumericText (str) function to check if the String argument can be converted to a Currency before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.


CStr

Basic and Crystal syntax.

CStr and ToText are equivalent functions.

Overloads
  • CStr (x)
  • CStr (x, y)
  • CStr (x, y, z)
  • CStr (x, y, z, w)
  • CStr (x, y, z, w, q)
Arguments

Converting . . . Description

Boolean values

  • x is a Boolean value that is converted to a String, either "True" or "False".

Number and Currency values

  • x is a Number or Currency value to be converted into a text string; it can be a whole or fractional value.
  • y is a whole number indicating the number of decimal places to carry the value in x to (This argument is optional.).
  • z is a single character text string indicating the character to be used to separate thousands in x. Default is the character specified in your International or Regional settings control panel. (This argument is optional.)
  • w is a single character text string indicating the character to be used as a decimal separator in x. Default is the character specified in your International or Regional settings control panel. (This argument is optional.)

Number and Currency values (formatting)

  • x is a Number or Currency value to be converted into a text string; it can be a whole or fractional value.
  • y is a text string used to indicate the format for displaying the value in x. See Format Strings for information on creating a format string.
  • z is a whole number indicating the number of decimal places to carry the value in x to. (This argument is optional.)
  • w is a single character text string indicating the character to be used to separate thousands in x. Default is the character specified in your International or Regional settings control panel. (This argument is optional.)
  • q is a single character text string indicating the character to be used as a decimal separator in x. The default is the character specified in your International or Regional settings control panel. (This argument is optional.)

Date values

  • x is a Date value to be converted into a text string.
  • y is a text string that defines how the value in x is to be formatted. See Format strings for Date, Time, and DateTime values for more information on creating this format string. (This argument is optional.)

Time values

  • x is a Time value to be converted into a text string.
  • y is a text string that defines how the value in x is to be formatted. See Format strings for Date, Time, and DateTime values for more information on creating this format string. (This argument is optional.)
  • z is a text string to be used as a label for A.M. (morning) hours. (This argument is optional.)
  • w is a text string to be used as a label for P.M. (evening) hours. (This argument is optional.)

DateTime values

  • x is a DateTime value to be converted into a text string.
  • y is a text string of characters that indicate how the resulting text string will be formatted. See Format strings for Date, Time, and DateTime values for more information on creating a format string. (This argument is optional.)
  • z is a text string to be used as a label for A.M. (morning) hours. (This argument is optional.)
  • w is a text string to be used as a label for P.M. (evening) hours. (This argument is optional.)

Returns

Text String

Action

The CStr function converts Numbers, Currency, Date, Time, and DateTime values to text strings.

Typical uses

Use this function to convert a Number, Currency, Date, Time, or DateTime value to a text string to appear as text in your report (form letters, comments, etc.).

Examples

The following examples are applicable to both Basic and Crystal syntax:

CStr ({Orders.Shipped})

Returns "True" if the value of {Orders.Shipped} is True.

CStr(123.45)

Returns "123.45".

CStr(12345.6749,2)

Returns "12345.67".

CStr(12345.6750,2)

Returns "12345.68".

CStr(12345.4999,0)

Returns "12345".

CStr(12345.5000,0)

Returns "12346".

CStr({file.AMT} * {file.QUANTITY})

Returns "44,890.20" where Amt = 24.45 and Quantity = 1836.

CStr is useful when you want to build a sentence by combining (concatenating) a converted number or other value with other text strings:

"The base price of item # " + {file.ITEM NUMBER} + " is $" + CStr({file.BASE PRICE}) + "."

Prints the sentence "The base price of item A1/4520/B12 is $50.00." where the Item number is A1/4520/B12 and the Base Price is 50.00, converted to text and formatted with two decimal places.

CStr(CDate(1996, 11, 1), "yy MMM dd, dddd")

Returns "96 Nov 01, Monday".

CStr(CDateTime(1995,10,12,3,30,11),"HH:mm, yy MMMM ddd")

Returns "03:30, 95 October Mon".

CStr(CTime(12, 10, 10), "HH*mm*ss tt", "amStr", "pmStr")

Returns "12*10*10 pmStr".

Comments

The overloads of CStr that take only one argument work like the Visual Basic function of the same name.

Converting Boolean values:

    • The CStr function, when used with Boolean values, is most useful for combining (concatenating) a Boolean value with other text. Otherwise, a Boolean field can be formatted to appear as True or False in your report simply by changing the format on the Boolean Tab of the Format Editor.

Converting numbers and currency values:

    • If the number of decimal places is specified, this function does not truncate the number when converted to text, but rounds it to the number of decimal places specified. See Round (x), Round (x, #places), for more information on the rounding procedure.

Converting Date, Time, and DateTime values:

    • Any character, with the exception of the Date or Time format characters, can be used within the format string. For example, you may wish to use a slash to separate the different elements (month, day, year) of the date, as in "12/30/95", or you may wish to use a colon to separate the different elements (hours, minutes, seconds) of the time, as in "12:30:10".
    • If you wish to use any of the above characters in the format string, they must appear in quotes. For example: CStr(CDateTime(1995,10,12,13,20,22), "MM/dd/yy hh 'h' mm 'min' ss 'sec' ", 'am', 'pm') = "10/12/95 1 h 20 min 22 sec pm"

Passing optional arguments:

  • Many arguments for the CStr function have been specified as optional. However, you can only leave an argument blank if all the arguments that follow it are left blank as well. In other words, you can not leave the y and z arguments blank and provide an argument for w. It is possible, however, to leave one, two, or all of the optional arguments blank, as long as no arguments are supplied after the blank arguments. The following combinations are possible when supplying arguments to the CStr function:
      • CStr (x)
      • CStr (x, y)
      • CStr (x, y, z)
      • CStr (x, y, z, w)
      • CStr (x, y, z, w, q)
      • Using the "t" or "tt" format characters in a time format string provides default strings for indicating a.m. (morning) and p.m. (evening) hours. "t" produces just a single character, "a" or "p", while "tt" produces the entire string, "am" or "pm". You can pass your own custom strings for indicating am/pm strings. (See the arguments for converting Time and DateTime values with CStr in the Arguments section above.) If you do pass your own am/pm strings, the "t" and "tt" format characters will have the same effect on them (producing single character vs. multiple character strings). However, the "t" and "tt" format characters are optional and only necessary when default am/pm strings are needed.


CDate

Basic and Crystal syntax.

The DateValue and Date functions are equivalent to CDate. However, Date can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • CDate (number)
  • CDate (string)
  • CDate (dateTime)
  • CDate (YYYY, MM, DD)
Arguments

CDate (number)

Number is a value representing the number of days starting from December 30, 1899. It can be positive or negative, and is truncated if fractional.

CDate (string)

string is a text string representing a date, example: "September 20, 1999"; many formats are supported for the string

CDate (dateTime)

dateTime is a DateTime value.

CDate (YY,MM,DD)

  • year is a whole number representing a year, example: 1996.
  • month is a whole number representing a month, example: 12 for December.
  • day is a whole number representing a day of the month, example: 05.

Returns

Date value

Action

CDate (number) converts and returns a Date given a number which is the number of days starting from December 30, 1899.

CDate (string) converts and returns a Date given a string.

CDate (dateTime) converts and returns a Date given a DateTime value.

CDate (YYYY, MM, DD) uses the given arguments to create a Date value.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CDate ("Dec. 31, 1999")

Returns the Date value for Dec. 31, 1999.

CDate (50)

Returns the Date value for February 18, 1900.

CDate (#Oct. 20, 1999 12:02pm#)

Returns the Date value for October 20, 1999.

CDate (1930, 7, 30)

Returns the Date value for July 30, 1930.

Comments

You can use the IsDate function to check if a String argument can be converted to a Date before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.

Related topics

DateSerial (year, month, day)


CTime

Basic and Crystal syntax.

The TimeValue and Time functions are equivalent to CTime. However, Time can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • CTime (number)
  • CTime (string)
  • CTime (dateTime)
  • CTime (HH, MM, SS)
Arguments

CTime (number)

  • Returns a Time value given a number in units of 24 hours
  • number can be fractional or negative as well

CTime (string)

Returns a Time value that represents the time, given a String expression specifying a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive.

CTime (dateTime)

DateTime is a DateTime value.

CTime (hour, min, sec)

  • Hour is a whole number representing an hour of the day.
  • Min is a whole number representing a minute.
  • Sec is a whole number representing a second.

Returns

A Time value.

Action

CTime (number) converts the given number to a Time value; the given number is in units of 24 hours, can be fractional or negative as well.

CTime (string) converts and returns a time given a string that identifies a Time value.

CTime (dateTime) converts and returns a time given a DateTime value.

CTime (hh, mm, ss) converts and returns a time given the arguments of the hour, minute and seconds.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CTime (.2)
CTime (1.2)

Both return the same value 4:48:00 a.m.

CTime (-.2)

Returns 7:12:00 pm

CTime ("Jan. 6, 1999 2:30pm")

Returns 2:30:00 pm

CTime (#Feb. 24, 1999 2:40pm#)

Returns 2:40:00 pm

CTime (18, 30, 30)

Returns 6:30:30 pm

Comments

You can use the IsTime function to check if a String argument can be converted to a Time before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.

Related topics

TimeSerial (hour, minute, second)

IsTime


CDateTime

Basic and Crystal syntax.

The DateTimeValue and DateTime functions are equivalent to CDateTime. However, DateTime can only be used in Crystal syntax since it is a type name in Basic syntax.

Overloads
  • CDateTime (string)
  • CDateTime (number)
  • CDateTime (date)
  • CDateTime (date, time)
  • CDateTime (YYYY, MM, DD)
  • CDateTime (YYYY, MM, DD, HH, MM, SS)
Arguments

CDateTime (date)

  • date is a Date value.

CDateTime (date, time)

  • date is a Date value.
  • time is a Time value.

CDateTime (number)

  • number represents a number of days from December 30, 1899, example: 20 represents 20 days from December, 1899, which is January 19, 1900.
  • number can be positive, negative or fractional.

CDateTime (string)

  • string represents a date and time, example: "September 15, 1999, 10:45a.m."

CDateTime (year, month, day)

CDateTime (year, month, day, hour, min, sec)

  • year is a whole number representing a calendar year, example: 1996.
  • month is a whole number representing a month, example: 1 for January.
  • day is a whole number representing a day of the month, example: 10.
  • hour is a whole number representing an hour of the day, example: 12.
  • min is a whole number representing a minute, example: 59.
  • sec is a whole number representing seconds, example: 30.

Returns

A DateTime value.

Action

CDateTime (string) converts the given string to a DateTime value.

CDateTime (number) converts the given number to a DateTime value, where number holds the number of days since Dec. 30, 1899.

CDateTime (date) uses the given date to create the date portion, assigns 12:00:00 AM for the time portion for the returned DateTime value.

CDateTime (date, time) uses the given Date and Time data types to create a combined DateTime value.

CDateTime (YYYY, MM, DD) uses the given arguments to create the date portion, and assigns 12:00:00 AM for the time portion for the returned DateTime value.

CDateTime (YYYY, MM, DD, HH, MM, SS) uses the given arguments to create a combined DateTime value.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CDateTime ("10/4/1999 10:20am")

Returns the DateTime value October 4, 1999 10:20:00 am

CDateTime (12.5)

Returns the DateTime value January 11, 1900 12:00:00 pm

CDateTime (-2.5)

Returns the DateTime value December 27, 1899 12:00:00 pm

CDateTime (CDate ("Dec. 25, 1999"))

Returns the DateTime value December 25, 1999 12:00:00 am

CDateTime (CDate ("November 10, 1999"), CTime("12:20am"))

Returns the DateTime value November 10, 1999 12:20:00 am

CDateTime (1945, 8, 21, 0, 0, 0)

Returns the DateTime value August 21, 1945 12:00:00 am

CDateTime (1945, 8, 21, 10, 0, 0)

Returns the DateTime value August 21, 1945 10:00:00 am

Comments

You can use the IsDateTime function to check if a String argument can be converted to a DateTime before doing the actual conversion. That way, if the conversion cannot be done, you can handle the situation appropriately.

Related topics

IsDateTime


Programming shortcut functions

These functions provide shortcut alternatives to using control structures to achieve the same results.

Choose (index, choice1, choice2, ..., choiceN)

IIF (expression, truePart, falsePart)

Switch (expr1, value1, expr2, value2, ..., exprN, valueN)


Choose (index, choice1, choice2, ..., choiceN)

Arguments
  • index is a Number or numeric expression that specifies the index of the choice. It should be between 1 and the number of available choices. If it is out of bounds, Choose returns a default value. (The default value returned depends on the type of the choices. For example, if the choices are of Number type, the default value is 0 and if the choices are of String type, the default value is the empty string ("").)
  • choice is one of the choices to choose from. All choices must be of the same type. A choice can be any simple type (Number, Currency, String, Boolean, Date, Time or DateTime) or range type (Number Range, Currency Range, String Range, Date Range, Time Range or DateTime Range), but it may not be an array.
Returns

A value from the given list of choices. The type of the returned value is the same as the type of the choices.

Action

Choose returns a value from the list of choices based on the value of index. For example, if index is 1, it returns choice1 and if index is 2 it returns choice2 and so forth.

Typical uses
  • Choose can be used instead of the If-Then-Else operators or the Select control structures in some situations. For example, if you are mapping an index value to a String value, it can be simplest to use Choose.
  • One situation where Choose may be better than a control structure is when writing record selection formulas so that they can be pushed down to the database server.

    See Switch (expr1, value1, expr2, value2, ..., exprN, valueN) function for an example of this.

    See Advanced record selection formulas for an explanation of the techniques involved.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Choose (3, "Poor", "Fair", "Good", "Excellent")

Returns the String "Good".

Choose (2, 10 To 20, 100 To 200, 60 To 70)

Returns the Number Range value 100 To 200.

If a company has fiscal year starting July 1 (the 3rd calendar quarter) and it wants to print the fiscal quarter of each order date:

Rem Basic syntax
formula = Choose (DatePart ("q", {Orders.Order Date}), _
"third fiscal quarter", "fourth fiscal quarter", _
" first fiscal quarter", "second fiscal quarter")

//Crystal syntax
Choose (DatePart ("q", {Orders.Order Date}),
"third fiscal quarter", "fourth fiscal quarter",
"first fiscal quarter", "second fiscal quarter")

If {Orders.Order Date} is February 18, 1996, then the DatePart function call returns 1 since this date is in the first calendar quarter. Thus, the first choice value, namely the String value "third fiscal quarter" is returned by the formula.

Comments
  • This function is designed to work like the Visual Basic function of the same name. A difference is that the function does not return a Variant and thus all the choices must have the same type.
  • Every argument of the Choose function is evaluated before the choice is returned. Thus, you should watch out for undesirable side effects when using Choose. For example, if one of the choice expressions results in division by zero, an error will occur, even if that choice is not the choice that is returned by the Choose function.
Related topics

IIF (expression, truePart, falsePart) function

Switch (expr1, value1, expr2, value2, ..., exprN, valueN) function

If-Then-Else operators

Select statements (Basic syntax)

Select expressions (Crystal syntax)


IIF (expression, truePart, falsePart)

Basic and Crystal syntax.

Argument
    • expression is a Boolean expression.
    • truePart is the value returned if expression is True. It can be any simple type (Number, Currency, String, Boolean, Date, Time or DateTime) or range type (Number Range, Currency Range, String Range, Date Range, Time Range or DateTime Range), but it may not be an array.
    • falsePart is the value returned if expression is False. It must be of the same type as truePart.
Returns

truePart if expression is True and falsePart if expression is False. The type of the returned value is the same as the type of truePart and falsePart.

Action

IIF returns one of two parts, depending on the evaluation of the expression.

Typical uses
  • IIF can be used as an alternative to the If/Then/Else control structure in some situations.
  • One situation where IIF may be better than a control structure is when writing record selection formulas so that they can be pushed down to the database server. See Switch (expr1, value1, expr2, value2, ..., exprN, valueN) for an example and Advanced record selection formulas for an explanation of the techniques involved.
Examples

The following examples are applicable to both Basic and Crystal syntax:

IIF ({Orders.Order Amount} > 10000, "large order", "standard order")

Returns the String value "large order" if {Orders.Order Amount} is more than $10,000 and the String value "standard order" otherwise.

You can insert a formula field that represents the order amount if the payment has been made already, and is 0 otherwise:

Rem Basic syntax
formula = IIF ({Orders.Payment Received}, {Orders.Order Amount}, 0)

//Crystal syntax
IIF ({Orders.Payment Received}, {Orders.Order Amount}, 0)

Comments
  • This function is designed to work like the Visual Basic function of the same name. A difference is that the function does not return a Variant and thus truePart and falsePart must have the same type.
  • Every argument of the IIF function is evaluated before the result is returned. Thus, you should watch out for undesirable side effects when using IIF. For example, if falsePart results in division by zero, an error will occur, even if expression is True and so truePart is returned.
Related topics

Choose (index, choice1, choice2, ..., choiceN)

Switch (expr1, value1, expr2, value2, ..., exprN, valueN)

Select statements (Basic syntax)

Select expressions (Crystal syntax)


Switch (expr1, value1, expr2, value2, ..., exprN, valueN)

Basic and Crystal syntax.

Arguments
  • expr1, expr2, ..., exprN are Boolean expressions.
  • value1, value2, ...., valueN are the possible values that may be returned. All the values must be of the same type. A value can be any simple type (Number, Currency, String, Boolean, Date, Time or DateTime) or range type (Number Range, Currency Range, String Range, Date Range, Time Range or DateTime Range), but it may not be an array.
Returns

One of the values in the value list value1, value2, ...., valueN. The type of the returned value is the same as the type of the values.

Action

The argument list for Switch consists of pairs of expressions and values. Switch evaluates the expressions from left to right, and returns the value associated with the first expression to evaluate to True.

For example, if expression1 is True, the Switch returns value1. If expression1 is False and expression2 is True, then Switch returns value2. If expression1 and expression2 are False and expression3 is True, then Switch returns value3.

If all of the expressions are False, then Switch returns a default value. (The default value returned depends on the type of the values in the value list. For example, if the values are of Number type, the default value is 0 and if the values are of String type, the default value is the empty string ("").)

Typical uses

Switch can be used instead of If-Then-Else operators or Select statements (Basic syntax) and Select expressions (Crystal syntax) in some situations.

One situation where Switch may be better than a control structure is when writing record selection formulas so that they can be pushed down to the database server. See below for an example as well as Advanced record selection formulas for an explanation of the techniques involved.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Suppose that a company wants to classify orders into "large", "medium" or "small" based on the order size:

Rem Basic syntax
formula = Switch ({Orders.Order Amount} > 5000, "large", _
{Orders.Order Amount} > 1000, "medium", _
True, "small")

//Crystal syntax
Switch ({Orders.Order Amount} > 5000, "large",
{Orders.Order Amount} > 1000, "medium",
True, "small")

If {Orders.Order Amount} is greater than $5,000 then the formula returns the String value "high". Otherwise, if {Orders.Order Amount} is greater than $1,000, the formula returns the String "medium". Otherwise, the formula returns "small".

Here is an example showing how to use the Switch function for writing efficient record selection formulas that can be pushed down to the database server. Writing this formula using If-Then-Else operators or Select statements (Basic syntax) and Select expressions (Crystal syntax) would not let it be pushed down.

See Advanced record selection formulas for further explanation of the techniques involved.

Note: This example is in Crystal syntax since record selection formulas edited with the Formula Editor must be in Crystal syntax only.

Sample report

A more complete version of the example, with 27 Switch conditions, is provided with the sample report named Date Range Formula.rpt.

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

When you preview the report, you supply a reference order date parameter, {?reference date} and a range condition, {?reference condition} to indicate a range of dates around the reference order date. The report is then previewed with only the records whose order dates fall in the specified range.

The entire record selection is performed on the database server. This is because the Switch function and all its arguments can be evaluated before accessing the database.

Note:

  • In this sample report, the Switch function is returning a Date Range value.
  • The indentation style of the code makes the Switch function call look similar to a control structure and makes reading the function easier.
  • The last expression is the Boolean value True.

    This Switch function call provides for an explicit default value since if none of the other expression are True, the last expression is automatically True, and so the Date Range CDate (1899, 12, 30) To CDate(1899, 12, 30) is returned.

//Crystal syntax record selection formula
{Orders.Order Date} in
Switch
(
{?reference condition} = "Aged 0 to 30 days",
({?reference date} - 30) To {?reference date},
{?reference condition} = "Aged 31 to 60 days",
({?reference date} - 60) To ({?reference date} - 31),
{?reference condition} = "Aged 61 to 90 days",
({?reference date} - 90) To ({?reference date} - 61),
True, // provide default handling and specify a valid range
CDate(1899, 12, 30) To CDate(1899, 12, 30)
)

Comments
  • This function is designed to work like the Visual Basic function of the same name. A difference is that the function does not return a Variant and thus all the values must have the same type.
  • Every argument of the Switch function is evaluated before the result is returned. Thus, you should watch out for undesirable side effects when using Switch.

    For example, if one of the values results in division by zero, an error will occur, even if that value is not the value that is returned by the Switch function.

Related topics

Choose (index, choice1, choice2, ..., choiceN)

IIF (expression, truePart, falsePart)

.Select statements (Basic syntax)

Select expressions (Crystal syntax)


Evaluation Time functions

Evaluation Time functions can control how data is presented by controlling when it is calculated or presented.

BeforeReadingRecords

WhileReadingRecords

WhilePrintingRecords

EvaluateAfter (x)


BeforeReadingRecords

Basic and Crystal syntax.

Returns

None

Action

Specifies that the formula is to be evaluated before the database records are read.

Typical uses

Formulas are normally evaluated at the following times:

  • If no database or group field is included in the formula, the formula is evaluated before the program reads database records.
  • If a database is included in the formula, the formula is evaluated while the program reads database records.
  • If a group field, page number field, subtotal, etc., is included in the formula, the formula is evaluated after database records are read and while the data from the records is being printed in the report.

BeforeReadingRecords forces the formula to be evaluated before the program reads database records. When this function is used in a formula, the Formula Checker returns an error message if you attempt to include elements in the formula (database fields, groups, etc.) that must be evaluated at a later time (while reading or while printing records).

Examples

The following example is applicable to Crystal syntax:

BeforeReadingRecords;
ToNumber ("12345")

Forces the formula (which contains no database fields or groups), to be evaluated before reading records.

Note: If you try to include a database field or group in this formula, you will get an error message.


WhileReadingRecords

Basic and Crystal syntax.

Returns

None

Action

Forces the program to evaluate the formula while it is reading database record data.

Typical uses

Formulas are normally evaluated at the following times:

  • If no database or group field is included in the formula, the formula is evaluated before the program reads database records.
  • If a database is included in the formula, the formula is evaluated while the program reads database records.
  • If a group field, page # field, subtotal, etc. is included in the formula, the formula is evaluated after database records are read and while the data from the records is being printed in the report.

WhileReadingRecords forces the formula to be evaluated while the program reads database records. When this function is used in a formula, the Formula Checker returns an error message if you attempt to include elements in the formula (groups, page number fields, etc.) that must be evaluated at a later time (while printing records).This function can also be used to force a formula that includes no database fields and no group fields to process while reading records instead of before reading records.

Examples

The following examples are applicable to Crystal syntax:

WhileReadingRecords;
ToNumber({orders detail.QUANTITY})

Forces the formula (which contains a database field) to be evaluated at its normal time (while reading records).

Note: If you try to include a group in this formula, you will get an error message.

WhileReadingRecords;
ToNumber ("12345")

Forces the formula (which contains no database fields or groups), to be evaluated later than it would normally be evaluated. In this case, it causes the formula to be evaluated while reading records instead of before reading records.

Note: If you try to include a group in this formula, you will get an error message.


WhilePrintingRecords

Basic and Crystal syntax.

Returns

None

Action

Forces the program to evaluate the formula while it is printing database record data.

Typical uses

Formulas are normally evaluated at the following times:

  • If no database or group field is included in the formula, the formula is evaluated before the program reads database records.
  • If a database is included in the formula, the formula is evaluated while the program reads database records.
  • If a group field, page # field, subtotal, etc. is included in the formula, the formula is evaluated after database records are read and while the data from the records is being printed in the report.

WhilePrintingRecords forces the formula to be evaluated while the program prints database records.

This function can also force a formula that includes no database fields and no group fields to process while printing records instead of before reading records. It will also force a formula that includes database fields to process while printing records instead of while reading records.

Examples

The following examples are applicable to Crystal syntax:

WhilePrintingRecords;
3* Sum ({file.QTY1}, {file.QTY2})

Forces the formula (which contains a group) to be evaluated at its normal time (while printing records).

WhilePrintingRecords;
ToNumber ("12345")

Forces the formula (which contains no database fields or groups), to be evaluated later than it would normally be evaluated. In this case, it causes the formula to be evaluated while printing records instead of before reading records.

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


EvaluateAfter (x)

Basic and Crystal syntax.

Arguments

x is any valid formula name.

Returns

None

Action

This function can be used to force one formula to be evaluated after another. For example, two separate formulas in your report may have the same evaluation time (BeforeReadingRecords, WhileReadingRecords, or WhilePrintingRecords), or they appear in the same section of the report and, therefore, are automatically evaluated while records are printing. In such cases, it is often unclear which formula is evaluated first.

In many situations, it may be unimportant which formula is evaluated first. However, some situations may require that one formula be evaluated after another. For instance, one formula may set the value of a variable while the other formula reads the value of that variable. The EvaluateAfter function can be used to force the second formula to be evaluated after the first formula has completed.

Examples

The following examples are applicable to both Basic and Crystal syntax:

EvaluateAfter({@SetVariable})

Forces the formula to wait until the @SetVariable formula has completed calculations.


Print State functions

These functions deal with the state of a report being previewed.

Previous (fld)

PreviousValue (fld)

Next (fld)

NextValue (fld)

IsNull (fld)

PreviousIsNull (fld)

NextIsNull (fld)

PageNumber

TotalPageCount

PageNofM

RecordNumber

GroupNumber

RecordSelection

GroupSelection

InRepeatedGroupHeader

OnFirstRecord

OnLastRecord


Previous (fld)

Crystal syntax.

PreviousValue (fld) and Previous are equivalent functions. However, you can use Previous only with Crystal syntax, and PreviousValue only with Basic syntax.

Arguments

fld is any valid database or formula field in the report.

Returns

A field value of the same type that was passed as the fld argument.

Action

Previous (fld) returns the value of the specified field in the previous record.

Typical uses

You can use previous to identify the last record in a previous range or the last record occurring before a new range begins, or to test for duplicate values.

Examples

The following examples are applicable to Crystal syntax:

If Previous({file.QTY}) <> 0 Then
{file.QTY}/2
Else
{file.QTY}

Tests the previous value in the {file.QTY} field to see if it is a zero value. If it is not, it divides the value by two. If it is a zero value, it returns the value itself.

If Previous ({customer.CUSTOMER ID}) = {customer.CUSTOMER ID} Then
"Repeated Value"
Else
""

This flags repeated values in the {customer.CUSTOMER ID} field.

If Remainder(Previous ({file.SERIALNUM}), 300) = 0 Then
"Beginning, new block"
Else
""

Divides the previous value in the {file.SERIALNUM} field by 300. If there is no remainder, it flags the current value as "Beginning, new block". If there is a remainder (Else) it prints no flag. (This formula divides serial numbers into blocks of 300.)

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


PreviousValue (fld)

Basic syntax

PreviousValue and Previous (fld) are equivalent functions. However, you can use PreviousValue only with Basic syntax and Previous only with Crystal syntax

Argument

fld is the name of a database field.

Returns

Value of specified field; type depends on type of that field.

Action

PreviousValue returns the value of the previous record of the specified field.

Typical use

You can use previous to identify the last record in a previous range or the last record occurring before a new range begins, or to test for duplicate values.

Examples

The following examples are applicable to Basic syntax:

If PreviousValue ({Orders Detail.Quantity}) <> 0 Then
formula = {Orders Detail.Quantity} / 2
Else
formula = {Orders Detail.Quantity}
End If

Tests the previous value in the {Orders Detail.Quantity} field to see if it is a zero value. If it is not, it divides the current value by two. If it is a zero value, it returns the current value itself.

If PreviousValue ({Orders.Order ID}) Mod 10 = 0 Then
formula = "Beginning of new block"
Else
formula = "Same block"
End If

Divides orders into blocks of 10. If the previous Order ID is a multiple of 10, it flags the current value as "Beginning of new block". Otherwise, it prints "Same block".

If PreviousValue ({Customer.Customer ID}) = {Customer.Customer ID} Then
formula = "Customer Repeated"
Else
formula = "Customer Changed"
End If

This flags repeated values in the {Customer.Customer ID} field.

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


Next (fld)

Crystal syntax.

Next and NextValue (fld) are equivalent functions. However, you can use Next only with Crystal syntax, and NextValue (fld) only with Basic syntax.

Arguments

fld is any valid database field or formula field.

Returns

A field value of the same type as the argument.

Action

Next(fld) returns the value of the specified field for the next record.

Typical uses

You can use Next to identify the first or last record in a range, to identify the starting point for a new group, or to test for duplicate values.

Examples

The following examples are applicable to Crystal syntax:

If Next({file.QTY})<>0 Then
{file.QTY}/2
Else
{file.QTY}

Tests the next value in the {file.QTY} field to see if it is a zero value. If it is not, it divides the value by two. If it is a zero value, it returns the value itself.

If Remainder(Next ({file.SERIALNUM}), 300) = 0 Then
"End of block"
Else
""

Divides the next value in the {file.SERIALNUM} field by 300. If there is no remainder, it flags the current value as "End of block". If there is a remainder (Else) it prints no flag. (This formula divides serial numbers into blocks of 300.)

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


NextValue (fld)

Basic syntax.

NextValue and Next (fld) are equivalent functions. However, you can use NextValue only with Basic syntax and Next only with Crystal syntax.

Argument

fld is the name of a database field.

Returns

Value of specified field; type depends on type of that field.

Action

NextValue returns the value of the next record of the specified field.

Typical use

You can use NextValue to identify the first or last record in a range, to identify the starting point for a new group, or to test for duplicate values.

Examples

The following examples are applicable to Basic syntax:

If NextValue ({Orders Detail.Quantity}) <> 0 Then
formula = {Orders Detail.Quantity} / 2
Else
formula = {Orders Detail.Quantity}
End If

Tests the next value in the {Orders Detail.Quantity} field to see if it is zero. If it is not, it divides the current value by two. If it is zero, it returns the current value itself.

If NextValue ({Orders.Order ID}) Mod 10 = 0 Then
formula = "End of block"
Else
formula = "More to come"
End If

This formula divides orders into blocks of 10. If the next Order ID is a multiple of 10, it flags the current value as "End of block". Otherwise, it prints "More to come".

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


IsNull (fld)

Basic and Crystal syntax.

Arguments

fld is any valid database, memo, or BLOB field.

Returns

Boolean Value

Action

Evaluates the field specified in the current record and returns TRUE if the field contains a null value.

Typical uses

You can use this function in a record selection formula to limit the report to records that have something other than a null value in the field specified. You can also use it to have the program take some action whenever it encounters a null value.

Examples

The following examples are applicable to both Basic and Crystal syntax:

IsNull({orders.ORDER AMOUNT}) = produces the following results:

If{orders.ORDER AMOUNT} shows this value | IsNull({orders.ORDER AMOUNT}) returns
200.00 | False
(null) | True
100.00 | False
347.12 | False

Not IsNull({orders.ORDER AMOUNT})

When used as a record selection formula, includes in the report only those records that have something other than a null value in the {orders.ORDER AMOUNT} field.

Comments

Some databases support null data values and others do not. This function will not work if the active database(s) do not support null values. If the database(s) do support null values, the function can be used to reference the null values that get created as the result of a failed lookup while joining.

Note: Zero and blank (empty or " ") are not null values.

Related topics

Null fields and how to use IsNull (Basic syntax)

Null fields and how to use IsNull (Crystal syntax)


PreviousIsNull (fld)

Basic and Crystal syntax.

Arguments

fld is any numeric, formula, memo, or BLOB field in the report.

Returns

Boolean Value

Action

Evaluates the field specified in the previous record and returns a TRUE if the field contains a null value.

Typical uses

You can use this function to test for the first item in a list and to take some action when that first item is identified.

Examples

The following example is applicable to Crystal syntax:

If PreviousIsNull ({employee.EMPLOYEE ID}) Then
"First employee of record"
Else
""

In an employee database with no null values in the Employee ID field, flags the first employee on the list.

Comments

Some databases support null data values and others do not. This function will not work if the active database(s) do not support null values. If the database(s) do support null values, the function can be used to reference the null values that get created as the result of a failed lookup while joining.

Note:

  • Zero and blank (empty or " ") are not null values.
  • Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


NextIsNull (fld)

Basic and Crystal syntax.

Arguments

fld is any valid database, formula, memo or BLOB field in the report.

Returns

Boolean Value

Action

Evaluates the field specified in the next record and returns a TRUE if the field contains a null value.

Typical uses

You can use this function to test for the last item in a list and to take some action when you identify that last item.

Examples

The following example is applicable to Crystal syntax:

If NextIsNull ({employee.EMPLOYEE ID}) Then
"Last employee of record"
Else
""

In an employee database with no null values in the Employee ID field, flags the last employee on the list.

Comments

Some databases support null data values and others do not. This function will not work if the active database(s) do not support null values. If the database(s) do support null values, the function can be used to reference the null values that get created as the result of a failed lookup while joining.

Note:

  • Zero and blank (empty or " ") are not null values.
  • Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see Evaluation Time functions.


PageNumber

Basic and Crystal syntax.

Returns

Whole Number

Action

PageNumber inserts the current page number as a field in a formula.

Typical uses

Use this function any time you want to determine the page number, at print time, and use that number in calculating formula results. For example, you can use this function when you want to print something on certain pages and not on others.

Examples

The following examples are applicable to Crystal syntax:

PageNumber

Creates a field containing the current page number that you can place anywhere on the page. Using this formula is the equivalent of using the Page Number field in the Special Fields folder in the Field Explorer.

If PageNumber > 1 Then
PageNumber
Else
0

Creates a field that prints the page number on every page but the first. By activating the Suppress if Zero check box on the Boolean tab (Format Editor) of the Format Editor, the formula will print nothing on the first page instead of a zero.

Note:

  • You do not have to have a page number field in your report to use the PageNumber function in a report formula.
  • Using this function in a formula forces the formula to be evaluated at print time.

    For more information on evaluation time considerations, see the Evaluation Time functions.


TotalPageCount

Basic and Crystal syntax.

Returns

Whole number

Action

Passes the report and returns the total number of pages.

Typical uses

You might use this function, for example, to place the number of pages into the report header or footer.

Examples

The following example is applicable to both Basic and Crystal syntax:

TotalPageCount

Returns 2 where your report contains a total of 2 pages.

Comments

This function will add an extra pass to the report.


PageNofM

Basic and Crystal syntax.

Returns

A text string

Action

PageNofM inserts the "Page [current page number] of [total page count]" as a field in a formula.

Typical uses

Use this function any time you want to determine the page number as compared to the total number of pages, at print time, and use that number in calculating formula results. For example, you can use this function when you want to print something on certain pages and not on others.

Examples

The following example is applicable to both Basic and Crystal syntax:

PageNofM

Creates a field containing the current page number and the total page count, which you can place anywhere on the page. Using this formula is the equivalent of using the PageNofM field from the Insert|Special Field menu.


RecordNumber

Basic and Crystal syntax.

Returns

Whole Number

Action

RecordNumber returns the current record number.

Typical uses

You can use this function in creating a record selection formula to print some records and exclude others.

Examples

The following example is applicable to both Basic and Crystal syntax:

RecordNumber

Creates a field containing the current record number that you can place on your report. Using this formula is the equivalent of using the Record Number field in the Special Fields folder in the Field Explorer.

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the Evaluation Time functions.


GroupNumber

Basic and Crystal syntax.

Returns

Whole Number

Action

Returns the current group number.

Typical uses

You can use this function in a group selection formula to print some groups and exclude others.

Examples

The following example is applicable to both Basic and Crystal syntax:

GroupNumber

Creates a field containing the current group number that you can place on your report. Using this formula is the equivalent of using the GroupNumber field in the Special Fields folder in the Field Explorer.

Note: Using this function in a formula forces the formula to be evaluated at print time. For more information on evaluation time considerations, see the Evaluation Time functions.


RecordSelection

Basic and Crystal syntax.

Returns

The record selection formula

Action

PrintTime inserts the record selection formula for the report in a formula that you can place on your report.

Typical uses

You can use this function any time you want to print the record selection formula on the report, or whenever you want to set something as conditional on the record selection formula.

Examples

The following examples are applicable to both Basic and Crystal syntax:

RecordSelection

Creates a field that contains the record selection formula. You can then place this field on your report. Using this formula is the equivalent of using the Record Selection Formula field in the Special Fields folder in the Field Explorer.


GroupSelection

Basic and Crystal syntax.

Returns

The group selection formula

Action

PrintTime inserts the group selection formula for the report in a formula that you can place on your report.

Typical uses

You can use this function any time you want to print the group selection formula on the report, or whenever you want to set something as conditional on the group selection formula.

Examples

The following examples are applicable to both Basic and Crystal syntax:

GroupSelection

Creates a field that contains the group selection formula. You can then place this field on your report. Using this formula is the equivalent of using the Group Selection Formula field in the Special Fields folder in the Field Explorer.


InRepeatedGroupHeader

Basic and Crystal syntax.

Returns

Boolean

Action

Returns TRUE when a Group Header section is repeated on a second, third, etc., page.

Typical Uses

You can use this function to add conditional formatting to any group headers that appear when a group has broken onto a second, third, or fourth, etc., page. For example, you may want to add the text: "cont." to the group header when it appears on subsequent pages after the first.


OnFirstRecord

Basic and Crystal syntax.

Returns

Boolean

Action

Returns TRUE when the current record being evaluated is the first record in the report.


OnLastRecord

Basic and Crystal syntax.

Returns

Boolean

Action

Returns TRUE when the current record being evaluated is the last record in the report.


Document properties functions

These functions return values of attributes pertaining to a document.

PrintDate

PrintTime

ModificationDate

ModificationTime

DataDate

DataTime

ReportTitle

ReportComments

Filename

FileAuthor

FileCreationDate


PrintDate

Basic and Crystal syntax.

Returns

Date Value

Action

PrintDate inserts the date the report is printed as a field in a formula.

Typical uses

You can use this function any time you want to print the date of printing on the report, or to condition something in the report on the print date.

Examples

The following examples are applicable to Crystal syntax:

PrintDate

Creates a field containing the date the report is printed that you can place on your report. Using this formula is the equivalent of using the PrintDate field in the Special Fields folder in the Field Explorer.

If PrintDate >= CDate(1992,01,01) Then
"Please excuse the delayed report."
Else
""

Prints the message apologizing for the delay if the report prints after January 1, 1992, and prints nothing if the report prints before that date.

Comments

The PrintDate function retrieves a value from the setting established in the report via the Set Print Date/Time command on the Report menu. By default, this value matches the settings in the Windows Date/Time control panel unless changed by the user.


PrintTime

Basic and Crystal syntax.

Returns

Time Value

Action

PrintTime inserts the time the report is printed as a field in a formula.

Typical uses

You can use this function any time you want to print the time of printing on the report, or to condition something in the report on the print time.

Examples

The following example is applicable to both Basic and Crystal syntax:

PrintTime

Creates a field containing the time the report is printed that you can place on your report. Using this formula is the equivalent of using the Print Time field in the Special Fields folder in the Field Explorer.


ModificationDate

Basic and Crystal syntax.

Returns

Date Value

Action

ModificationDate inserts the date the report was last modified as a field in a formula.

Typical uses

Use this function any time you want to print the date the report was last modified, or to condition something in the report on the modification date.

Examples

The following example is applicable to both Basic and Crystal syntax:

ModificationDate

Creates a field that you can place on your report which will return the date the report was last modified. Using this formula is the equivalent of using the ModificationDate field in the Special Fields folder in the Field Explorer.


ModificationTime

Basic and Crystal syntax.

Returns

Time Value

Action

ModificationTime inserts the time the report was last modified as a field in a formula.

Typical uses

Use this function any time you want to time the date the report was last modified, or to condition something in the report on the modification time.

Examples

The following example is applicable to both Basic and Crystal syntax:

ModificationTime

Creates a field containing the time of the report was last modified, which you can place on your report. Using this formula is the equivalent of using the ModificationTime field in the Special Fields folder in the Field Explorer.


DataDate

Basic and Crystal syntax.

Returns

Date Value

Action

DataDate returns the date that the report was last refreshed.

Typical uses

Use DataDate any time you want to date stamp your data.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DataDate

Returns 1998/05/06 if the report was last refreshed on 1998/05/06.

DataDate

Returns 1973/12/06 if the report was last refreshed on 1973/12/06.

Comments

The date format is determined by the settings in the international or regional settings control panel.


DataTime

Basic and Crystal syntax.

Returns

Time Value

Action

DataTime returns the time that the report was last refreshed.

Typical uses

Use DataTime any time you want to time stamp your data.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DataTime

Returns 12:45:23 if the report was last refreshed at 12:45:23.

DataTime

Returns 17:26:10 if the report was last refreshed at 17:26:10.


ReportTitle

Basic and Crystal syntax.

Returns

String

Action

ReportTitle inserts the title of the report as a field in a formula.

Typical uses

You can use this function any time you want to print the title of the report.

Examples

The following example is applicable to both Basic and Crystal syntax:

ReportTitle

Creates a field containing the title that you can place on your report. Using this formula is the equivalent of using the ReportTitle field in the Special Fields folder in the Field Explorer.


ReportComments

Basic and Crystal syntax.

Returns

String

Action

ReportComments inserts the comments included with the report as a field in a formula.

Typical uses

You can use this function any time you want to print the comments for report entered in the Document Properties dialog box.

Examples

The following example is applicable to both Basic and Crystal syntax:

ReportComments

Creates a field containing the comments that you can place on your report. Using this formula is the equivalent of using the ReportComments field in the Special Fields folder in the Field Explorer.


Filename

Basic and Crystal syntax.

Returns

String

Action

Filename inserts (in a formula) the file name and file path that are included with the report as a field.

Typical uses

You can use this function any time you want to print the file name for the report.

Examples

The following example is applicable to both Basic and Crystal syntax:

Filename

Creates a field containing the filename. Using this formula is the equivalent of using the File Path and Name field in the Special Fields folder in the Field Explorer.


FileAuthor

Basic and Crystal syntax.

Returns

String

Action

FileAuthor inserts (in a formula) the file author name that is included with the report as a field.

Typical uses

You can use this function any time you want to print the name of the file author (as specified in the Document Properties dialog box dialog box).

Examples

The following example is applicable to both Basic and Crystal syntax:

FileAuthor

Creates a field containing the name of the file author. Using this formula is the equivalent of using the File Author field in the Special Fields folder in the Field Explorer.


FileCreationDate

Basic and Crystal syntax.

Returns

String

Action

FileCreationDate inserts (in a formula) the report creation date that is included with the report as a field.

Typical uses

You can use this function any time you want to print the date when the report was created (as shown in the Document Properties dialog box dialog box).

Examples

The following example is applicable to both Basic and Crystal syntax:

FileCreationDate

Creates a field containing the report creation date. Using this formula is the equivalent of using the File Creation Date field in the in the Special Fields folder in the Field Explorer.


Additional Functions

DateTo2000 (Date, Number)

DTSTo2000 (DateString, Number)

DTSToDate (DateTimeString)

DTSToSeconds (DateTimeString)

DTSToTimeString (DateTimeString)

ExchGetId (address)

ExchGetOrganization (address)

ExchGetSite (address)

ExtractString (origin, startString, endString)

EventNumber (eventNum)

ExchGetPath (Path)

ByteToText (byte)

FRCurrentRatio (CurrentAssets, CurrentLiabilities)

FRQuickRatio (CurrentAssets, Inventories, CurrentLiabilities)

FRDebtEquityRatio (TotalLiabilities, TotalEquity)

FREquityVsTotalAssets (TotalEquity, TotalAssets)

FRNetProfitMargin (NetProfit, Sales)

FRGrossProfitMargin (GrossProfit, Sales)

FROperatingProfitMargin (OperatingProfit, Sales)

FRInterestCoverage (CashFlow, InterestExpenses)

FRCashFlowVsTotalDebt (CashFlow, TotalDebt)

FRReturnOnEquity (NetProfit, TotalEquity)

FRReturnOnNetFixedAssets (NetProfit, NetFixedAssets)

FRReturnOnTotalAssets (NetProfit, TotalAssets)

FRReturnOnInvestedCapital (NetProfit, TotalBankDebt, TotalEquity)

FRReturnOnCommonEquity (NetProfit, PreferredDividend, CommonEquity)

FREarningsPerCommonShare (NetProfit, PreferredDividend, NumOfCommonShare)

FRAccRecTurnover (AccountReceivable, Sales, NumOfDays)

FRInventoryTurnover (Inventory, Sales, NumOfDays)

FRPriceEarningsRatio (MarketPrice, EarningsPerShare)

FRDividendYield (Dividend, MarketPrice)

Now

Picture (string, picture)

LooksLike (string, mask)

Soundex (string)

DateTimeTo2000 (dateTime, number)

DTSToDateTime (DateTimeString).

DTSToTimeField (DateTimeString)

DateTimeToDate (dateTime)

DateTimeToTime (dateTime)

DateTimeToSeconds (dateTime)


DateTo2000 (Date, Number)

Basic and Crystal syntax.

Arguments
  • Date: accepts only valid date fields, with either 2 digit or 4 digit years.
      • a database field defined as a date field. File|Report Options should be set to Convert Date-Time fields to Date.
      • the CDate function (CDate(yyyy, MM, dd) ). A four digit year is required by this function. If two digits are entered it will assume 00xx (for example, 98 AD).
  • Number: a number between 0 and 99 corresponding with the desired windowing year.
Returns

a date field with a four digit year

Action
  • 2 digit years (xx):

    If the Year value is greater than the windowing number, 19 is appended before the 2 digits (19xx). If the Year value is less than or equal to the windowing number, 20 is appended (20xx).

  • 4 digit years (19xx):

    If the last two digits in the Year value are greater than the windowing number, the Year is preserved as found in the date field (19xx). If the last two digits in the Year value are less than or equal to the windowing number, the first two digits are changed to 20 (20xx). If the first two digits in the year field are 20, the Year is preserved as found in the date field (20xx).

Note:

  • If the year is less than or equal to 1899 and greater or equal to 100, then there will be no change to the date.
  • Whether your database dates are interpreted as two digit years or 4 digit years (19xx) is dependent on the database driver you are using. The result of the formula should be the same in either case.
Examples

The following examples are applicable to Basic and Crystal syntax:

Here the window value is greater than the year and so it will change it to 20XX.

DateTo2000(CDate(1993,12,12), 99)

should return 2093/12/12

Here the window value is less than the year and so it will not change the year.

DateTo2000(CDate(1993,12,12), 92)

should return 1993/12/12

Other Examples

This is an example of a date that will not be affected by the function.

DateTo2000(CDate(1899,12,12), 99)

should return 1899/12/12

This is an example of a date that will not be affected by the function.

DateTo2000(CDate(100,12,12), 99)

should return 100/12/12

Some databases maintain the year of a date as a two digit field and so this will simulate that date field.

DateTo2000(CDate(98,12,12), 99)

should return 2098/12/12

DateTo2000(CDate(98,12,12), 97)

should return 1998/12/12

DateTo2000(CDate(9,12,12), 10)

should return 2009/12/12

DateTo2000(CDate(1,12,12), 0)

should return 1901/12/12


DTSTo2000 (DateString, Number)

Basic and Crystal syntax.

Arguments
  • Date String: accepts only valid date fields, with either 2 digit or 4 digit years.
      • a database field defined as a date field. File|Report Options should be set to Convert Date-Time fields to Date-Time String.
      • a database field defined as a string field, but containing a date.
      • a date-time string entered in the format: "yyyy/MM/dd HH:mm:ss.00" or "yy/MM/dd HH:mm:ss:00", example: "1997/04/11 12:12:12.00" or "97/04/11 12:12:12.00".
  • Number: a number between 0 and 99 corresponding with the desired windowing year.
Returns

a DateTime string with a four digit year

Action
  • 2 digit years (xx):

    If the Year value is greater than the windowing number, 19 is appended before the 2 digits (19xx). If the Year value is less than or equal to the windowing number, 20 is appended (20xx).

  • 4 digit years (19xx):

    If the last two digits in the Year value are greater than the windowing number, the Year is preserved as found in the date field (19xx). If the two digits in the Year value are less than or equal to the windowing number, the first two digits are changed to 20 (20xx). If the first two digits in the year field are 20, the Year is preserved as found in the date field (20xx).

    Note: If the year is less than or equal to 1899 and greater than or equal to 100, there will be no change to the date.

Examples

The following examples are applicable to Basic and Crystal syntax:

Here the window value is greater than the year and so it will change it to 20XX.

DTSTo2000(ToText(CDateTime(1988,12,12,12,12,12)), 90)

should return 2093/12/12 12:12:12

Here the window value is less than the year and so it will not change the year.

DTSTo2000(ToText(CDateTime(1984,12,12,1,2,3)), 83)

should return 1984/12/12 1:02:03

Other Examples

These are examples of a date that will not be affected by the function.

DTSTo2000(ToText(CDateTime(1899,12,12,1,2,3)), 99)

should return 1899/12/12 1:02:03

DTSTo2000(ToText(CDateTime(1899,12,12)), 99)

should return 1899/12/12 12:00:00

DTSTo2000(ToText(CDateTime(100,12,12,1,2,3)), 99)

should return 100/12/12 1:02:03

Some databases maintain the year of a date as a two digit field and so these samples will simulate that date field.

DTSTo2000(ToText(CDateTime(98,12,12,1,2,3)), 99)

should return 2098/12/12 1:02:03

DTSTo2000(ToText(CDateTime(98,12,12,1,2,3)), 97)

should return 1998/12/12 1:02:03

DTSTo2000(ToText(CDateTime(98,12,12), 97)

should return 1998/12/12 12:00:00

DTSTo2000(ToText(CDateTime(9,12,12,1,2,3)), 10)

should return 2009/12/12 1:02:03

DTSTo2000(ToText(CDateTime(1,12,12,1,2,3)), 0)

should return 1901/12/12 1:02:03


DTSToDate (DateTimeString)

Basic and Crystal syntax.

Arguments

DateTimeString is a string including a date and a Time value.

Returns

Date Value

Action

Evaluates the string specified and returns only the date.

Examples

DTSToDate ("2000/01/13 11:30:15")

Returns the Date value, January 13, 2000. The month must be entered as 01 rather than just 1.

Comments

The Date value returned by DateTimeToDate is the date at midnight. The Time value is dropped, and midnight is established as the implied time of the date. This is only relevant when performing operations with the resulting date, such as adding a Time value.

Note: For new formulas, use the CDate or DateValue functions instead of DTSToDate. The CDate and DateValue functions are able to convert more types of strings.


DTSToSeconds (DateTimeString)

Basic and Crystal syntax.

Arguments

DateTimeString is a string including a Date and a Time value.

Returns

Whole Number

Action

Evaluates the string specified and converts the Time value to the number of seconds from 00:00:00 (12:00 midnight) to the specified time.

Examples

The following example is applicable to Crystal syntax:

DTSToSeconds("2000/01/13 11:30:15")

Returns 41415.

Comments

Instead of using the DTSToSeconds function, you can use:

DateDiff ("s", #12:00 am#, CDateTime (CDate(0,0,0), CTime (DateTimeString)))

The above expression is able to convert more types of strings.


DTSToTimeString (DateTimeString)

Basic and Crystal syntax.

Arguments

DateTimeString is a string including a Date and a Time value.

Returns

Time String Value

Action

Evaluates the string specified and returns only the Time value in military format (00:00:00).

Examples

The following example is applicable to Crystal syntax:

DTSToTime(DateTime(1998,10,25,8,35,30))

Returns 08:35:30.


ExchGetId (address)

Basic and Crystal syntax.

Argument

Address is the Address of sender/recipient (string data type).

Return

String

Action

The ExchGetID (address) function will begin by determining whether the address in X500 or X400 format. Once this has been solved, the function will then determine the ID.

  • If the field is in X500 format, the function will extract the last instance of the "CN=" code (not case sensitive).
  • If the field is in the X400 format, it will extract the SMTP or MS Ids.

Note: The fields must follow the address type standards for the functions to operate them.

Examples

The following examples are applicable to Crystal syntax:

Field = /o=Seagate Software/ou=CRYSTALNT
/cn=Configuration/cn=Servers/cn=ESPRESSO/cn=Fredt
ExchGetID({Field})

Returns "Fredt".

Field = c=US; a= ;p=Microsoft; o=apps-wga;
dda:smtp=James@crystal.com
ExchGetID({Field})

Returns "James@crystal.com".

Field = c=US; a= ;p=Microsoft; o=apps-wga; dda:ms=com/
crystal/James
ExchGetID({Field})

Returns "com/crystal/James".


ExchGetOrganization (address)

Basic and Crystal syntax.

Arguments

Address is the Address of the sender/recipient (string data type).

Returns

String

Action

The function will begin by determining whether the address is in X500 or X400 format. Once this has been solved, the function will then determine the Organization Name.

  • If the field is in X500 format, the function will extract the last instance of the "/O=" code (not case sensitive).
  • If the field is in the X400 format, it will extract the instance of the "P=" code (not case sensitive).

Note: The fields must follow the address type standards for the functions to operate on them.

Examples

The following examples are applicable to Crystal syntax:

Field = /o=Seagate Software/ou=CRYSTALNT/
cn=Configuration/
cn=Servers/cn=ESPRESSO/cn=Fredt
ExchGetOrganization({Field})

Returns "Seagate Software".

Field = c=US; a= ; p=Microsoft; o=apps-wga; da:ms=com/
Rich/James.
ExchGetOrganization({Field})

Returns "Microsoft".

Field = c=US; a= ; p=Microsoft; o=apps-wga;
da:smtp=James@crystal.com.
ExchGetOrganization({Field})

Returns "Microsoft".


ExchGetSite (address)

Basic and Crystal syntax.

Argument(s)

Address is the Address of sender/recipient (string data type).

Return(s)

String

Action

The function will begin by determining whether the address is in X500 or X400 format. Once this has been solved, the function will then determine the Site Name.

  • If the field is in X500 format, the function will extract the last instance of the "/OU=" code (not case sensitive).
  • If the field is in the X400 format, it will extract the instance of the "O=" code (not case sensitive).

Note: The fields must follow the address type standards for the functions to operate on them.

Examples

The following examples are applicable to Crystal syntax:

Field = /o=Seagate Software /ou=CRYSTALNT/
cn=Configuration/cn=Servers/cn=ESPRESSO/cn=Fredt
ExchGetSite({Field})

Returns "CRYSTALNT".

Field = c=US; a= ;p=Microsoft; o=apps-wga;
dda:smtp=James@Rich.com.
ExchGetSite({Field})

Returns "apps-wga".


ExtractString (origin, startString, endString)

Basic and Crystal syntax.

Arguments
  • Origin: String
  • StartString: String
  • EndString: String
Returns

String

Action

This function will return the first occurrence (in the Origin string) of a string that starts with the StartString and ends with EndString. If the EndString is not found, the string starting with StartString until the end of the string is returned.

Examples

The following examples are applicable to Basic syntax:

MyTable.Field = "James and crystal"
ExtractString (MyTable.Field, J, s)

Returns "Jame".

MyTable.Field = "James and crystal"
ExtractString (MyTable.Field, J, ;)

Returns "James and crystal".


EventNumber (eventNum)

Basic and Crystal syntax.

Arguments

eventNum is the numeric code that describes the event that was logged (number data type).

Returns

Number

Action

The function will return the appropriate text description for the eventNum argument.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Message Tracking Log Event Number

Returns 4.

EventNumber({Message Tracking Log Event Number})

Returns "Message Submission".

Message Tracking Log Event Number

Returns 1000.

EventNumber ({Message Tracking Log Event Number})

Returns "Local Delivery".


ExchGetPath (Path)

Basic and Crystal syntax.

Arguments

Path is the Address of sender/receiver (string data type).

Returns

String

Action

This function will return the container information in an address field.

  • If the address type is X500, the function will return all of the information from the first instance of the "CN=" code until the last instance of the "CN=" code. If there is only one instance of the "CN=" code, the function will return NULL.
  • If the address type is X400, the function will return all "OU*=" codes (residing between the "P=" and "O=" codes).
  • If the address starts with "DDA:", the function will return all information after the "DDA:" code.
  • If the field is blank, "UNKNOWN ADDRESS" will be returned.
Examples

The following examples are applicable to Crystal syntax:

Field = /o=Seagate Software/ou=CRYSTALNT/
cn=Configuration/cn=Servers/cn=ESPRESSO/cn=Fredt
ExchGetPath ({Field})

Returns "cn=Configuration/cn=Servers/cn=ESPRESSO".

Field - c=US; a= ; p=Microsoft; ou1=James;
ou2=RichCorp; o=apps-wga;
dda:smtp=James@Rich.com
ExchGetPath({Field})

Returns "ou1=James; ou2=Richcorp".

Field = DDA:MS=CRYSTAL/JAMES/crystal
ExchGetpath9{Field})

Returns "MS=CRYSTAL/JAMES/crystal".


ByteToText (byte)

Basic and Crystal syntax.

Arguments

byte is the size of a message in bytes.

Returns

Number

Action

This function will return the size of a message in the "appropriate" unit.

  • If the argument is less than 1024, the result will be in bytes.
  • If the argument is between 1024 and 1048576, then the result will be in kilobytes.
  • Otherwise, the result will be in megabytes.
Examples

The following examples are applicable to both Basic and Crystal syntax:

ByteToText(1000)

Returns "1000 bytes".

ByteToText(345555)

Returns "337KB".


FRCurrentRatio (CurrentAssets, CurrentLiabilities)

Basic and Crystal syntax.

Format

FRCurrentRatio(CurrentAssets, CurrentLiabilities)

Arguments
  • CurrentAssets is a Number or formula.

    In general, CurrentAssets consist of cash, accounts receivable, inventories, prepaid expenses, and short term marketable investment in a company's balance sheet.

  • CurrentLiabilities is a Number or formula.

    In general, CurrentLiabilities consist of bank advances, accounts payable, dividends/income taxes payable, and a portion of long term loans due within one year in a company's balance sheet.

Action

FRCurrentRatio returns the ratio between CurrentAssets and CurrentLiabilities (for example, CurrentRatio = CurrentAssets / CurrentLiabilities).

Typical uses

This ratio is used to measure the short term liquidity of a company. It is a measure of how much the value of current assets exceeds the value of current liabilities. The higher the ratio, the higher the liquidity.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRCurrentRatio(5, 2.5)

Returns 2.

FRCurrentRatio(4.2, 2)

Returns 2.1.

FRCurrentRatio(1.1, 2.2)

Returns 0.5.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRCurrentRatio is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRQuickRatio (CurrentAssets, Inventories, CurrentLiabilities)

Basic and Crystal syntax.

Format

FRQuickRatio(CurrentAssets, Inventories, CurrentLiabilities)

Arguments
  • CurrentAssets is a Number or formula. In general, CurrentAssets consist of cash, accounts receivable, inventories, prepaid expenses, and short term marketable investments in a company's balance sheet.
  • Inventories is a Number or formula. In general, Inventories consist of raw materials, work in progress, and finished goods in a company's balance sheet.
  • CurrentLiabilities is a Number or formula. In general, CurrentLiabilities consists of bank advances, accounts payable, dividends/income taxes payable, and a portion of long term loans due within one year in a company's balance sheet.
Action

FRQuickRatio returns the ratio between CurrentAssets (less Inventories) and CurrentLiabilities (for example, QuickRatio = (CurrentAssets - Inventories) / CurrentLiabilities).

Typical uses

Since it takes time to convert raw materials to finished goods, and even finished goods are not really a liquid asset, this ratio removes inventories from current assets in calculating the liquidity of the company. It is a measure of how well current liabilities are covered by cash and ready cash equivalent. The higher the ratio, the higher the liquidity.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRQuickRatio(7.2, 2.2, 2)

Returns 2.5.

FRQuickRatio(3, 1.5, 3)

Returns 0.5.

Note:

  • None of the arguments can be negative; you may have to check for negative values before passing the arguments.
  • The Formula Editor will automatically check to see if Inventories is smaller than or equal to CurrentAssets. If Inventories is smaller than CurrentAssets, you will receive an error message.
Comment

FRQuickRatio is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRDebtEquityRatio (TotalLiabilities, TotalEquity)

Basic and Crystal syntax.

Format

FRDebtEquityRatio(TotalLiabilities, TotalEquity)

Arguments
  • TotalLiabilities is a Number or formula. In general, TotalLiabilities consist of all the current and long term liabilities in a company's balance sheet. However, some analysts would only include short and long term banks debts in calculating this ratio.
  • TotalEquity is a Number or formula. In general, TotalEquity consist of common stocks, preferred stocks, capital surplus, and retained earnings in a company's balance sheet.
Action

FRDebtEquityRatio returns the ratio between TotalLiabilities and TotalEquity (for example, DebtEquityRatio = TotalLiabilities / TotalEquity).

Typical uses

This ratio is used to measure the capital structure of the company. It can be used to find out the relationship of total liabilities/debt to a company's equity and can be a warning that the company's borrowing is excessive. The higher the ratio, the higher the financial risk.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRDebtEquityRatio(2.6, 1.3)

Returns 2.

FRDebtEquityRatio(1.5, 2.5)

Returns 0.6.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRDebtEquityRatio is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FREquityVsTotalAssets (TotalEquity, TotalAssets)

Basic and Crystal syntax.

Format

FREquityVsTotalAssets(TotalEquity, TotalAssets)

Arguments
  • TotalEquity is a Number or formula. In general, TotalEquity consist of common stocks, preferred stocks, capital surplus, and retained earnings in a company's balance sheet.
  • TotalAssets is a Number or formula. In general, TotalAssets consist of total current assets, net fixed assets and all other assets in a company's balance sheet.
Action

FREquityVsTotalAssets returns the ratio between TotalEquity and TotalAssets (for example, EquityVsTotalAssets = TotalEquity / TotalAssets).

Typical uses

This ratio is used to measure the financial structure of a company. The higher the ratio, the stronger a company's capital structure and the better it is capitalized.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FREquityVsTotalAssets(2, 4)

Returns 0.5.

FREquityVsTotalAssets(2.82, 18.8)

Returns 0.15.

Note:

  • None of the arguments can be negative; you may have to check for negative values before passing the arguments.
  • TotalEquity must be smaller or equal to TotalAssets, otherwise you will receive an error message.
Comment

FREquityVsTotalAssets is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRNetProfitMargin (NetProfit, Sales)

Basic and Crystal syntax.

Format

FRNetProfitMargin(NetProfit, Sales)

Arguments
  • NetProfit is a Number or formula. NetProfit is the amount of earnings a company earns during the year from the sale of its products or services minus all the expense items. It is the bottom line figure in a company's income statement. Some analysts may want to use the net profit before extraordinary items and/or income taxes for calculating this ratio.
  • Sales is a Number or formula. Sales is the total sales during the period that appears in a company's income statement.
Action

FRNetProfitMargin returns the ratio between NetProfit and Sales (for example, NetProfitMargin = NetProfit / Sales).

Typical uses

This ratio is used to measure how well the company is doing. The higher the result, the more profitable the company.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRNetProfitMargin(3, 50)

Returns 0.06.

FRNetProfitMargin(5.6, 100)

Returns 0.056.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRNetProfitMargin is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRGrossProfitMargin (GrossProfit, Sales)

Basic and Crystal syntax.

Format

FRGrossProfitMargin(GrossProfit, Sales)

Arguments
  • GrossProfit is a Number or formula. In general, GrossProfit equals sales minus cost of goods sold in a company's income statement.
  • Sales is a Number or formula. Sales is the total sales during the period that appears in a company's income statement.
Action

FRGrossProfitMargin returns the ratio between GrossProfit and Sales (for example, GrossProfitMargin = GrossProfitMargin / Sales).

Typical uses

This is a measure of how much return is received from the sales of goods prior to deducting all other expenses. The result varies from industry to industry depending on accounting treatment of cost of production that is included in cost of goods sold.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRGrossProfitMargin(3.4, 50)

Returns 0.068.

FRGrossProfitMargin(36.15, 120.5)

Returns 0.3.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRGrossProfitMargin is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FROperatingProfitMargin (OperatingProfit, Sales)

Basic and Crystal syntax.

Format

FROperatingProfitMargin(OperatingProfit, Sales)

Arguments
  • OperatingProfit is a Number or formula. In general, OperatingProfit equals gross profit less all selling, administrative and general expenses in a company's income statement.
  • Sales is a Number or formula. Sales is the total sales during the period that appears in a company's income statement.
Action

FROperatingProfitMargin returns the ratio between OperatingProfit and Sales (for example, OperatingProfitMargin = OperatingProfit / Sales).

Typical uses

FROperatingProfitMargin is used to measure the rate of profit on sales after allowing for all the directly related expenses. It is an indication of how profitable a company's operation is. The higher the result, the higher its profitability.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FROperatingProfitMargin(3.3, 30)

Returns 0.11.

FROperatingProfitMargin(11, 16.5)

Returns 0.6875.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FROperatingProfitMargin is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRInterestCoverage (CashFlow, InterestExpenses)

Basic and Crystal syntax.

Format

FRInterestCoverage(CashFlow, InterestExpenses)

Arguments
  • CashFlow is a Number or formula. In general, CashFlow equals the net profit of the company plus all the expense items not involving cash (such as depreciation, capital losses, etc.) minus all the profit not involving cash (such as capital gains, etc.). This information can be found in a company's income statement and statement of change in financial position.
  • InterestExpenses is a Number or formula. InterestExpenses is the total interest expenses that can be found in a company's income statement.
Action

FRInterestCoverage returns the ratios between CashFlow and InterestExpenses (for example, InterestCoverage = CashFlow / InterestExpenses).

Typical uses

This ratio is used to measure the ability of a company to pay the interest charges on its debt with the cash flows generated from its operation. It is usually measured in number of times (for example, 3X, etc.). The higher the result, the higher the ability for the company to meet interest payment even in time of interest rate hike.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRInterestCoverage(120, 50)

Returns 24.

FRInterestCoverage(30, 100)

Returns 0.3.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRInterestCoverage is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRCashFlowVsTotalDebt (CashFlow, TotalDebt)

Basic and Crystal syntax.

Format

FRCashFlowVsTotalDebt(CashFlow, TotalDebt)

Arguments
  • CashFlow is a Number or formula. In general, CashFlow equals the net profit of the company plus all the expense items not involving cash (such as depreciation, capital losses, etc.) and minus all the profit not involving cash (such as capital gains, etc.). This information can be found in a company's income statement and statement of change in financial position.
  • TotalDebt is a Number or formula. In general, TotalDebt is the total short term and long term bank borrowings. Some analysts may even include all the short and long term liabilities as part of total debt. All this information can be found in a company's income statement.
Action

FRCashFlowVsTotalDebt returns the ratio between CashFlow and TotalDebt (for example, CashFlowVsTotalDebt = CashFlow / TotalDebt).

Typical uses

This ratio is used to measure the ability of a company to pay off its total debts with cash flows generated from operations. It is usually measured in number of times. The higher the result, the higher the ability for the company to pay off its debts.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRCashFlowVsTotalDebt(45, 30)

Returns 1.5.

FRCashFlowVsTotalDebt(74.4, 93)

Returns 0.8.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRCashFlowVstotalDebt is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRReturnOnEquity (NetProfit, TotalEquity)

Basic and Crystal syntax.

Format

FRReturnOnEquity(NetProfit, TotalEquity)

Arguments
  • NetProfit is a Number or formula. NetProfit is the amount of earnings a company earns during the year from the sale of its products or services minus all the expense items. It is the bottom line figure in a company's income statement. Some analysts may want to use the net profit before extraordinary items and/or income taxes for calculating this ratio.
  • TotalEquity is a Number or formula. In general, TotalEquity consist of common stocks, preferred stocks, capital surplus, and retained earnings in a company's balance sheet.
Action

FRReturnOnEquity returns the ratio between NetProfit and TotalEquity (for example, ReturnOnEquity = NetProfit / TotalEquity).

Typical uses

This ratio is used to measure the returns on the total capital employed to run the company. The higher the result, the higher the return.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRReturnOnEquity(34.5,150)

Returns 0.23.

FRReturnOnEquity(12, 15)

Returns 0.8.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRReturnOnEquity is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRReturnOnNetFixedAssets (NetProfit, NetFixedAssets)

Basic and Crystal syntax.

Format

FRReturnOnNetFixedAssets(NetProfit, NetFixedAssets)

Arguments
  • NetProfit is a Number or formula. NetProfit is the amount of earnings a company earns during the year from the sale of its products or services minus all the expense items. It is the bottom line figure in a company's income statement. Some analysts may want to use the net profit before extraordinary items and/or income taxes for calculating this ratio.
  • NetFixedAssets is a Number or formula. NetFixedAssets equals total fixed assets minus accumulated depreciation in a company's balance sheet.
Action

FRReturnOnNetFixedAssets returns the ratio between NetProfit and NetFixedAssets (for example, ReturnOnNetFixedAssets = NetProfit / NetFixedAssets).

Typical uses

This ratio is used to measure the return on capital assets employed. This ratio is normally used for measuring the efficiency of manufacturing companies or servicing industries that required employment of capital assets to provide its services (airlines, etc.). The higher the ratio the better the return.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRReturnOnNetFixedAssets(34, 50)

Returns 0.68.

FRReturnOnNetFixedAssets(50.4, 42)

Returns 1.2.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRReturnOnNetFixedAssets is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. They can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRReturnOnTotalAssets (NetProfit, TotalAssets)

Basic and Crystal syntax.

Format

FRReturnOnTotalAssets(NetProfit, TotalAssets)

Arguments
  • NetProfit is a Number or formula. NetProfit is the amount of earnings a company earns during the year from the sale of its products or services minus all the expense items. It is the bottom line figure in a company's income statement. Some analysts may want to use the net profit before extraordinary items and/or income taxes for calculating this ratio.
  • TotalAssets is a Number or formula. In general, TotalAssets consist of total current assets, net fixed assets and all other assets in a company's balance sheet.
Action

FRReturnOnTotalAssets returns the ratio between NetProfit and TotalAssets (for example, ReturnOnTotalAssets = NetProfit / TotalAssets).

Typical uses

This measures the return on total assets employed. It is a measure of the efficiency of the company in employing its total assets. The higher the result the better is its efficiency.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRReturnOnTotalAssets(23, 100)

Returns 0.23.

FRReturnOnTotalAssets(442, 340)

Returns 1.3.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRReturnOnTotalAssets is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. They can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRReturnOnInvestedCapital (NetProfit, TotalBankDebt, TotalEquity)

Basic and Crystal syntax.

Format

FRReturnOnInvestedCapital(NetProfit, TotalBankDebts, TotalEquity)

Arguments
  • NetProfit is a Number or formula. NetProfit is the amount of earnings a company earns during the year from the sale of its products or services minus all the expense items. It is the bottom line figure in a company's income statement. Some analysts may want to use the net profit before extraordinary items and/or income taxes for calculating this ratio.
  • TotalBankDebts is a Number or formula. TotalBankDebts includes all the short and long term bank debts of a company. They can all be found in a company's balance sheet.
  • TotalEquity is a Number or formula. In general, TotalEquity consists of common stocks, preferred stocks, capital surplus, and retained earnings in a company's balance sheet.
Action

FRReturnOnInvestedCapital returns the ratio between NetProfit and InvestedCapital (which is TotalBankDebts plus TotalEquity) (for example, ReturnOnInvested Capital = NetProfit / (TotalBankDebts + TotalEquity)).

Typical uses

This ratio is used to measure the return on a company's invested capital, which includes total bank borrowing and the company's total equity. The higher the return the better.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRReturnOnInvestedCapital(23, 17, 33)

Returns 0.46.

FRReturnOnInvestedCapital(54, 23, 17)

Returns 1.35.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRReturnOnInvestedCapital is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. They can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRReturnOnCommonEquity (NetProfit, PreferredDividend, CommonEquity)

Basic and Crystal syntax.

Format

FRReturnOnCommonEquity(NetProfit, PreferredDividend, CommonEquity)

Arguments
  • NetProfit is a Number or formula. NetProfit is the amount of earnings a company earns during the year from the sale of its products or services minus all the expense items. It is the bottom line figure in a company's income statement. Some analysts may want to use the net profit before extraordinary items and/or income taxes for calculating this ratio.
  • PreferredDividend is a Number or formula. PreferredDividend is the total dividend paid out to the preferred shareholders during the accounting period being studied. This information can be found in a company's income statement and statement of change in financial position. It can also be derived in a company's balance sheet.
  • CommonEquity is a Number or formula. In general, CommonEquity is the sum of all common shares, contributed surplus, and retained earnings. All of these can be found in a company's balance sheet.
Action

FRReturnOnCommonEquity returns the ratio between the net profit distributable to common shareholders (NetProfit-PreferredDividend) and CommonEquity (for example, ReturnOnCommonEqutiy = (NetProfit - PreferredDividend) / CommonEquity).

Typical uses

This ratio is used to measure the return on common equity employed. Note that preferred dividend is deducted prior to doing the calculation. The higher the result the higher the return.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRReturnOnCommonEquity(340, 40, 600)

Returns 0.5.

FRReturnOnCommonEquity(245, 50, 150)

Returns 1.3.

Note:

  • None of the arguments can be negative; you may have to check for negative values before passing the arguments.
  • The Formula Editor will automatically check to see if NetProfit is smaller than PreferredDividend. If NetProfit is smaller than PreferredDividend, you will receive an error message.
Comment

FRReturnOnCommonEquity is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FREarningsPerCommonShare (NetProfit, PreferredDividend, NumOfCommonShare)

Basic and Crystal syntax.

Format

FREarningsPerCommonShare(NetProfit, PreferredDividend, NumOfCommonShare)

Arguments
  • NetProfit is a Number or formula. NetProfit is the amount of earnings a company earns during the year from the sale of its products or services minus all the expense items. It is the bottom line figure in a company's income statement. Some analysts may want to use the net profit before extraordinary items and/or income taxes for calculating this ratio.
  • PreferredDividend is a Number or formula. PreferredDividend is the total dividend paid out to the preferred shareholders during the accounting period being studied. This information can be found in a company's income statement and statement of change in financial position. It can also be derived in a company's balance sheet.
  • NumOfCommonShare is a Number or formula. In general, NumOfCommonShare is the number of common shares issued and outstanding. This information can be found in a company's balance sheet.
Action

FREarningsPerCommonShare returns the ratio between net profit distributable to common shareholders (NetProfit-PreferredDividend) and NumOfCommonShare (for example, EarningPerCommonShare = (NetProfit - PreferredDividend) / NumOfCommonShare).

Typical uses

This ratio is used to calculate how much profit that a common share is entitled to. This ratio is used side by side with dividend per common share to determine the dividend pay out ratio. Some analysts may want to perform a fully diluted earnings per share. In this case, they have to take into account of all the common shares that will be converted from all the convertible preferred shares.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FREarningsPerCommonShare(550000, 50000, 100000)

Returns 5.

FREarningsPerCommonShare(450000, 10000, 2000000)

Returns 0.22.

Note:

  • None of the arguments can be negative; you may have to check for negative values before passing the arguments.
  • NetProfit can not be smaller that PreferredDividend, otherwise you will receive an error message.
Comment

FREarningsPerCommonShare is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRAccRecTurnover (AccountReceivable, Sales, NumOfDays)

Basic and Crystal syntax.

Format

FRAccRecTurnover(AccountReceivable, Sales, NumOfDays)

Arguments
  • AccountReceivable is a Number or formula. AccountReceivable is the total accounts receivable in a company's balance sheet.
  • Sales is a Number or formula. Sales is the total sales during the period that appears in a company's income statement.
  • NumOfDays is a Number or formula. In general, it is the number of days in a year. Some analysts use 360 and some use 365. The default is 360 for this function.
Action

FRAccRecTurnover returns the average turnover of AccountReceivable in days (for example, AccRecTurnover = (AccountReceivable / Sales) * 360).

Typical uses

This ratio measures the turnover of accounts receivable in days. A smaller ratio represents higher turnover which means that accounts receivable is paid shortly after they are incurred. A higher turnover is generally preferable over a lower turnover which might be an indication of doubtful accounts.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRAccRecTurnover(100, 600, 360)

Returns 60.

FRAccRecTurnover(200, 300, 360)

Returns 240

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRAccRecTurnover is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRInventoryTurnover (Inventory, Sales, NumOfDays)

Basic and Crystal syntax.

Format

FRInventoryTurnover(Inventory, Sales, NumOfDays)

Arguments
  • Inventory is a Number or formula. Inventory is the total inventories in a company's balance sheet. In general, it includes all raw material, work in progress and finished goods.
  • Sales is a Number or formula. Sales is the total sales during the period that appears in a company's income statement.
  • NumOfDays is a Number or formula. In general, NumOfDays is the number of days in a year. Some analysts use 360 and some use 365. The default is 360 for this function.
Action

FRInventoryTurnover returns the average turnover of inventory in days (for example, InventoryTurnover = (Inventory/Sales) * 360).

Typical uses

This ratio measures the turnover of inventories in days. A smaller ratio represents higher turnover, which means that inventories are sold quickly and are not stuck in the warehouses. A high turnover is generally preferred over a low turnover, which might be an indication of stale or obsolete inventory.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRInventoryTurnover(40, 400, 360)

Returns 36.

FRInventoryTurnover(36, 90, 360)

Returns 144.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRInventoryTurnover is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRPriceEarningsRatio (MarketPrice, EarningsPerShare)

Basic and Crystal syntax.

Format

FRPriceEarningsRatio(MarketPrice, EarningsPerShare)

Arguments
  • MarketPrice is a Number or formula. MarketPrice is the current market price of a company's common share. This information is publicly available if the company's shares are traded in a stock exchange.
  • EarningsPerShare is a Number or formula. EarningsPerShare is the amount of earnings that is attributable to each common share. This information is available in a company's financial reports.
Action

FRPriceEarningsRatio returns the ratio between MarketPrice and EarningsPerShare (for example, PriceEarningsRatio = MarketPrice / EarningsPerShare (12 months)).

Typical uses

This ratio is used as a comparison between the share's market price and its earning ability. It is a convenient figure and it can be used easily to compare one company's earning ability with another.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRPriceEarningsRatio(3.5, 2)

Returns 1.75.

FRPriceEarningsRatio(27, 1.5)

Returns 18.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRPriceEarningsRatio is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


FRDividendYield (Dividend, MarketPrice)

Basic and Crystal syntax.

Format

FRDividendYield(Dividend, MarketPrice)

Arguments
  • Dividend is a Number or formula. Dividend is the indicated annual dividend per common share.
  • MarketPrice is a Number or formula. MarketPrice is the current market price of a company's common share. This information is publicly available if a company's shares are traded in a stock exchange.
Action

FRDividendYield returns the ratio between Dividend and MarketPrice (for example, DividendYield = Dividend / MarketPrice).

Typical uses

This ratio is used as an indication of the return on investment for a common share investor. It is a superficial comparison between shares of different companies. Some analysts may also want to use the same function for calculating yield for preferred share.

Examples

The following examples are applicable to both Basic and Crystal syntax:

FRDividendYield(3,25)

Returns 0.12.

FRDividendYield(5, 80)

Returns 0.0625.

Note: None of the arguments can be negative; you may have to check for negative values before passing the arguments.

Comment

FRDividendYield is one of the many financial analysis tools used in interpreting the financial position of a company. As in the case of all ratios, it has to be used with caution. It can just be used as a clue and not solid proof for forming a judgment on the financial status of a company.

Neither one of the ratios can be used alone for doing financial analysis and there are no fixed rules on the results of the ratios. Apart from differences between type of industries, result varies among different companies within the same industry and within different account periods. The results should only be used for relative comparison and trend analysis, rather than treating them as something absolute.


Now

Basic and Crystal syntax.

Returns

Text String

Action

Now prints the current time on a report. The time is taken from your computer's internal clock.

Typical Uses

Use Now any time you want to time-stamp your report.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Now

Returns 4:45:18 if you begin printing your report at 4:45:18.

Now

Returns 17:14:33 if you begin printing your report at 17:14:33.

Comments
  • The time format is determined by the settings in the International section of the Windows Control Panel.
  • The CurrentTime function is identical to the Now function, which was included with previous version of the program. Now is provided for compatibility with reports created with earlier versions of the program. New reports should use the CurrentTime function.


Picture (string, picture)

Basic and Crystal syntax.

Arguments
  • String is a text string to be formatted according to the picture format.
  • Picture is a text string representing the way you want the characters in the string to be printed.
Return

string

Action

Picture (string, picture) prints a string or values in a text string in a predetermined format.

Typical Uses

Picture can be used to print a string "2065555555" in a telephone number format "(206) 555-5555", or to print other strings in fixed formats.

Examples

The following examples are applicable to both Basic and Crystal syntax:

Picture ({customer.FAX},"(xxx) xxx-xxxx" )

Prints the values in the Fax field in the format (805) 555-5555, (313) 555-2555, etc.

Picture ({customer.REGION}, "[xx]")

Prints the values in the Region field in the format [AK], [CA], etc.

Comments
  • Picture must be enclosed in quotes.
  • Use the character "x" in the mask to designate characters from the string.
  • If the database field includes brackets or other formatting, for example (xxx) xxx-xxxx, you will not be able to convert it to xxxxxxx. The parentheses and hyphen will still appear.


LooksLike (string, mask)

Basic and Crystal syntax.

Arguments
  • string is the text string or field containing text string values that are being compared to the mask.
  • mask is a text string that provides a mask for comparing the value in the string argument.
Returns

Boolean Value

Action

Enables you to locate field values using a standard DOS wildcard (? = wildcard for single character, * = wildcard for any number of characters). It does this by comparing a string to a mask that contains one or more wildcards. The function returns True if the string matches the mask and False if the string does not match the mask.

Typical uses

Use this function whenever you want to locate records based on two or more field values that are spelled differently yet look alike (have an essentially similar structure).

Examples

The following examples are applicable to both Basic and Crystal syntax:

LooksLike ("Snyder","Sn?der")

Returns TRUE.

LooksLike ("Schneider","S?der")

Returns FALSE.

LooksLike ("Schneider", "S?????der")

Returns TRUE.

The following example is applicable to Crystal syntax:

If LooksLike ({customer.CONTACT FIRST NAME},"?ris" Then
{customer.CONTACT FIRST NAME}
Else
""

Returns Cris, Kris, and Iris, but not Chris (assuming all of these values are in the {customer.CONTACT FIRST NAME} database).


Soundex (string)

Basic and Crystal syntax.

Arguments

string is one of two or more strings that sound alike.

Returns

Text String

Action

Soundex (string) evaluates a text string and returns a four character value that symbolizes the way string sounds.

Typical uses

Use this function whenever you want to locate records based on two or more field values that are spelled differently yet sound alike.

This function can also be used to find customer names that have been misspelled.

Examples

The following examples are applicable to Crystal syntax:

If Soundex{customer.LAST NAME} = Soundex ("Snider") Then
{customer.LAST NAME}
Else
""

Runs a Soundex on each value in the Last Name field and prints only those values that have a Soundex value equal to the Soundex value of the name Snider. This formula returns the names Sneider, Schneider, Snyder, and Snider if they are all in the database.

Comments
  • The value string must be in quotes.
  • Soundex works only with values that begin with the same letter: For example, Soundex will return the same value for Chris and Cris (C620) but not for Kris (K620)
  • Soundex creates a code based on the first character in the string plus three characters based on the following:
      • Non-alpha characters (i.e. numbers and punctuation) become -1.
      • The characters a, e, i, o, u, y, h, and w are ignored (except when they are the first character in the original string).
      • The characters b, f, p, and v become 1.
      • The characters c, g, j, k, q, s, x, and z become 2.
      • The characters d and t become 3.
      • The character l becomes 4.
      • The characters m and n become 5.
      • The character r becomes 6.
  • If the resulting code is only 2 or 3 characters long, Soundex uses zeros to fill out the code to four characters. For example, in the name Lauren, only the L, r, and n are translated (Lrn), so the resulting Soundex code becomes L650.
  • If the resulting code is more than four characters long, all characters after the fourth character are ignored. For example, in the name Patrick, the P, t, r, c, and k can be translated (Ptrck), but the resulting Soundex code will only be four characters: P362.


DateTimeTo2000 (dateTime, number)

Basic and Crystal syntax.

Arguments
  • dateTime: accepts only valid date-time fields, with either 2 digit or 4 digit years.
      • a database field defined as a date-time field. File|Report Options should be set to Convert Date-Time fields to Date-Time Field. (This option only works for ODBC datasources in 6.0.)
      • the CDateTime function (CDateTime(yyyy, MM, dd, hh, mm, ss) ). A four digit year is required by this function. If two digits are entered it will assume 00xx, example: 98 AD.
  • Number: a number between 0 and 99 corresponding with the desired windowing year.
Returns

a date-time field with a four digit year

Action
  • 2 digit years (xx):

    If the Year value is greater than the windowing number, 19 is appended before the 2 digits (19xx). If the Year value is less than or equal to the windowing number, 20 is appended (20xx).

  • 4 digit years (19xx):

    If the last two digits in the Year value are greater than the windowing number, the Year is preserved as found in the date field (19xx). If the two digits in the Year value are less than or equal to the windowing number, the first two digits are changed to 20 (20xx). If the first two digits in the year field are 20, the Year is preserved as found in the date field (20xx).

Note: If the year is less than or equal to 1899 and greater or equal to 100, then there will be no change to the date.

Examples

The following examples are applicable to Basic and Crystal syntax:

Here the window value is greater than the year and so it will change it to 20XX.

DateTimeTo2000(CDateTime(1998,12,12,3,2,1), 99)

should return 2093/12/12 3:02:01

Here the window value is less than the year and so it will not change the year.

DateTimeTo2000(CDateTime(1995,1,2,3,2,1), 94)

should return 1993/01/02 3:02:01

Other Examples

These are examples of a date that will not be affected by the function.

DateTimeTo2000(CDateTime(1899,12,12,5,6,7), 99)

should return 1899/12/12 5:06:07

DateTimeTo2000(CDateTime(999,12,12,5,6,7), 99)

should return 999/12/12 5:06:07

Some databases maintain the year of a date as a two digit field and so these samples will simulate that date field.

DateTimeTo2000(CDateTime (93,12,12,5,6,7), 96)

should return 2093/12/12 5:06:07

DateTimeTo2000(CDateTime (98,12,12,5,6,7), 50)

should return 1998/12/12 5:06:07

DateTimeTo2000(CDateTime (9,12,12,5,6,7), 10)

should return 2009/12/12 5:06:07

DateTimeTo2000(CDateTime (2,12,12,5,6,7), 1)

should return 1901/12/12 5:06:07


DTSToDateTime (DateTimeString).

Basic and Crystal syntax.

Arguments

DateTimeString is a string including a date and a Time value.

Returns

DateTime value

Action

Evaluates the string specified and returns a DateTime data type.

Examples

DTSToDateTime ("2000/01/13 11:30:15")

Returns the Date value, January 13, 2000 11:30:15 am. The month must be entered as 01 rather than just 1.

Comments

For new formulas, use the CDateTime or DateTimeValue functions instead of DTSToDateTime. The CDateTime and DateTimeValue functions are able to convert more types of strings.


DTSToTimeField (DateTimeString)

Basic and Crystal syntax.

Arguments

DTSToTimeField is a string including a Date and a Time value.

Returns

Time value

Action

Evaluates the string specified and returns a Time data type.

Examples

DTSToTimeField ("2000/01/13 11:30:15")

Returns the Time value, 11:30:15 am. The month must be entered as 01 rather than just 1.

Comments

For new formulas, use the CTime or TimeValue functions instead of DTSToTimeField. The CTime and TimeValue functions are able to convert more types of strings.


DateTimeToDate (dateTime)

Basic and Crystal syntax.

Arguments

dateTime is a DateTime value.

Returns

Date value

Action

Evaluates the DateTime value specified and converts it to a Date value.

Examples

The following example is applicable to both Basic and Crystal syntax:

DateTimeToDate(#11/01/1998 11:15:00 AM#)

Returns the Date value 11/01/1998.

Comments

For new formulas, you can use the CDate or DateValue functions instead of DateTimeToDate when converting a DateTime value to a Date value. The CDate and DateValue functions are more efficient since they are not UFLs.


DateTimeToTime (dateTime)

Basic and Crystal syntax.

Arguments

dateTime is a DateTime value.

Returns

Time value

Action

Evaluates the DateTime value specified and converts it to a Time value.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DateTimeToTime(#11/01/1998 11:15:00 AM#)

Returns 11:15:00 AM.

Comments

For new formulas, you can use the CTime or TimeValue functions instead of DateTimeToTime when converting a DateTime value to a Time value. The CTime and TimeValue functions are more efficient since they are not UFLs.


DateTimeToSeconds (dateTime)

Basic and Crystal syntax.

Arguments

dateTime is a DateTime value.

Returns

Time value (in seconds)

Action

Evaluates the DateTime value and returns the number of seconds that have passed between 00:00:00 (12:00 midnight) and the specified time.

Examples

The following examples are applicable to both Basic and Crystal syntax:

DateTimeToSeconds(#11/01/1998 11:30:15 AM#)

Returns 41415.

Comments

Instead of using DateTimeToSeconds (dt), you can use:

DateDiff ("s", #12:00 am#, CDateTime (CDate(0,0,0), CTime (dt)))

The above expression does not use UFLs and can be more efficient.


Functions to duplicate group fields

Use these functions whenever you want to duplicate a group field in a formula.

Note: In order to use these functions, you must have already entered a group field in your report with identical parameters to those you plan to reproduce in the formula. For example, the same field, same sort-and-group-by field, same date/Boolean condition (if applicable), or same action (average, count).

Sort and group by field = character, number, or dollar value

Average (fld, condFld)

See Average (fld), Average (fld, condFld), Average (fld, condFld, cond), Average (x)

Count (fld, condFld)

See Count (fld), Count (fld, condFld), Count (fld, condFld, cond), Count (x)

DistinctCount (fld, condFld)

See DistinctCount (fld), DistinctCount (fld, condFld), DistinctCount (fld, condFld, cond), DistinctCount (x)

Maximum (fld, condFld)

See Maximum (fld), Maximum (fld, condFld), Maximum (fld, condFld, cond), Maximum (x)

Minimum (fld, condFld)

See Minimum (fld), Minimum (fld, condFld), Minimum (fld, condFld, cond), Minimum (x)

PopulationStdDev (fld, condFld)

See PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x)

PopulationVariance (fld, condFld)

See PopulationVariance (fld), PopulationVariance (fld, condFld), PopulationVariance (fld, condFld, cond), PopulationVariance (x)

StdDev (fld, condFld)

See StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x)

Sum (fld, condFld)

See Sum (fld), Sum (fld, fld), Sum (fld, condFld), Sum (fld, condFld, cond), Sum (x)

Variance (fld, condFld)

See Variance (fld), Variance (fld, condFld), Variance (fld, condFld, cond), Variance (x)

Sort and group by field = date or Boolean

Average (fld, condFld, cond)

See Average (fld), Average (fld, condFld), Average (fld, condFld, cond), Average (x)

Count (fld, condFld, cond)

See Count (fld), Count (fld, condFld), Count (fld, condFld, cond), Count (x)

DistinctCount (fld, condFld, cond)

See DistinctCount (fld), DistinctCount (fld, condFld), DistinctCount (fld, condFld, cond), DistinctCount (x)

Maximum (fld, condFld, cond)

See Maximum (fld), Maximum (fld, condFld), Maximum (fld, condFld, cond), Maximum (x)

Minimum (fld, condFld, cond)

See Minimum (fld), Minimum (fld, condFld), Minimum (fld, condFld, cond), Minimum (x)

PopulationStdDev (fld, condFld, cond)

See PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x)

PopulationVariance (fld, condFld, cond)

See PopulationVariance (fld), PopulationVariance (fld, condFld), PopulationVariance (fld, condFld, cond), PopulationVariance (x)

StdDev (fld, condFld, cond)

See StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x)

Sum (fld, condFld, cond)

See Sum (fld), Sum (fld, fld), Sum (fld, condFld), Sum (fld, condFld, cond), Sum (x)

Variance (fld, condFld, cond)

See Variance (fld), Variance (fld, condFld), Variance (fld, condFld, cond), Variance (x)


Grand total functions

Use these functions whenever you want to evaluate all the values in a given field for the entire report and return a calculated value. For example, a "grand total" average or a "grand total" count.

Average (fld)

See Average (fld), Average (fld, condFld), Average (fld, condFld, cond), Average (x)

Count (fld)

See Count (fld), Count (fld, condFld), Count (fld, condFld, cond), Count (x)

DistinctCount (fld)

See DistinctCount (fld), DistinctCount (fld, condFld), DistinctCount (fld, condFld, cond), DistinctCount (x)

Maximum (fld)

See Maximum (fld), Maximum (fld, condFld), Maximum (fld, condFld, cond), Maximum (x)

Minimum (fld)

See Minimum (fld), Minimum (fld, condFld), Minimum (fld, condFld, cond), Minimum (x)

PopulationStdDev (fld)

See PopulationStdDev (fld), PopulationStdDev (fld, condFld), PopulationStdDev (fld, condFld, cond), PopulationStdDev (x)

PopulationVariance (fld)

See PopulationVariance (fld), PopulationVariance (fld, condFld), PopulationVariance (fld, condFld, cond), PopulationVariance (x)

StdDev (fld)

See StdDev (fld), StdDev (fld, condFld), StdDev (fld, condFld, cond), StdDev (x)

Sum (fld)

See Sum (fld), Sum (fld, fld), Sum (fld, condFld), Sum (fld, condFld, cond), Sum (x)

Variance (fld)

See Variance (fld), Variance (fld, condFld), Variance (fld, condFld, cond), Variance (x)


Conditional formatting functions

GridRowColumnValue (name)

CurrentFieldValue

DefaultAttribute

RGB (red, green, blue)


GridRowColumnValue (name)

Basic and Crystal syntax.

Arguments

name is a String value which is an Alias for Formulas. The Alias for Formulas is a name you have specified for a level of dimension in an OLAP grid or a cross-tab. See Formatting the grid.

Returns

Value of a level of dimension in an OLAP grid or cross-tab, that has been specified by the argument, name. The type of the value thus depends on the type of the specified dimension.

Action

GridRowColumnValue returns the value of a specified level of dimension in an OLAP grid or cross-tab.

Typical uses

To format cells under a level of dimension in an OLAP grid or cross-tab, based on the value of that level of dimension. For instance, you can format the font color for cells in a level of dimension based on the value of that level of dimension. The attributes of a cell that you can format conditionally using a formula include: font, border, object positioning, etc. They are accessible through the Format Editor. See Conditional attribute properties.

Examples

The following example is applicable to both Crystal and Basic syntax:

Assume an OLAP grid with Products in the rows, and Regions in the columns.

Suppose you would like to use GridRowcolumnValue to conditionally format cells under Level 1 of the Regions dimension and Level 2 of the Products dimension. In particular, you want to format the font color of the total sales of individual products for all of Europe to be red, and that under North America to be blue.

  1. Set up an Alias for Formulas for Level 1 of the Regions dimension to be "Continent". (You can do so using the OLAP Report Expert or Format OLAP Grid Object command. See Formatting the grid.

    After setting up the necessary Alias for Formulas, you can then express the formatting condition as: if GridRowColumnValue("Continent") returns "Europe", then you would like the font color of the cells for each Level 2 input of the Products dimension to be red, otherwise, since there are only two continents in this scenario, the font color should be blue.

  2. Click in the OLAP grid on one of the cells representing total sales for Europe for a particular (Level 2) product.

    The cells for all Level 2 inputs for Products combined with all Level 1 inputs for Regions are also selected. Formatting done to one of these cells will be carried over to all other selected cells.

  3. Use the Format Field command to enter a conditional formatting formula for the selected cells. See Working with conditional formatting.

    In Crystal syntax, you can enter a formula like:

If GridRowColumnValue("Continent") = "Europe" Then crRed Else crBlue

In Basic syntax, the formula will be:

If GridRowColumnValue("Continent") = "Europe" Then formula = crRed Else formula = crBlue

You will see the total sales of individual products for Europe highlighted in red, and the total sales of individual products for North America highlighted in blue.


CurrentFieldValue

Basic and Crystal syntax.

Returns

Can return any field type

Action

CurrentFieldValue returns the current value of the field that is about to be printed.

Typical Uses

You can use CurrentFieldValue to help do conditional formatting on a field element, field object or cross-tab summary or label.

Examples

In Crystal syntax, you can enter a formula like:

if CurrentFieldValue = 0 then crRed

In Basic syntax, the formula will be:

If CurrentFieldValue = 0 Then formula = crRed

Formats the font color of the object to print red when the value of the field is zero.

Comments
  • CurrentFieldValue is only available when entering field formatting formulas.
  • The return type depends on the context of the formula. For example, if you are formatting a string field CurrentFieldValue returns a string type, if you are formatting a date field, CurrentFieldValue returns a date type.


DefaultAttribute

Basic and Crystal syntax.

Returns

Can return any field type

Action

The value returned by DefaultAttribute depends upon the value selected for the attribute being formatted in the attribute value interface.

Examples

DefaultAttribute can be used in conjunction with CurrentFieldValue to conditionally format fields based upon their values and default condition.

The following examples are applicable to Crystal syntax:

if CurrentFieldValue < 0 then DefaultAttribute else crBlack

In Basic syntax, the formula will be:

If CurrentFieldValue < 0 Then
formula = DefaultAttribute
Else
formula = crBlack
End If

Formats the font color of the object to print in the default color when the value of the field is less than zero and to print black when the value of the field is greater than zero.

Comments

DefaultAttribute is only available when entering formatting formulas.


RGB (red, green, blue)

RGB and Color are equivalent functions. However, RGB is preferred in Basic syntax and Color is preferred in Crystal syntax.

Arguments
  • red is a Number value representing the red component of the resultant color, value is between 0 and 255.
  • green is a Number value representing the green component of the resultant color, value is between 0 and 255.
  • blue is a Number value representing the blue component of the resultant color, value is between 0 and 255.
Returns

Font color attribute.

Action

RGB returns the color attribute as specified by the red, green and blue components.

Typical use

To specify a custom color when writing a conditional formatting formula for the font or background color of a report field.

Example

The following example is applicable to Basic syntax:

If CurrentFieldValue > 10000 Then
formula = RGB (150,230,150)
Else
formula = RGB (10,19,200)
End If

This formula formats a Number field to display in the color as specified by RGB (150,230,150) if its current value is greater than 10000, otherwise to display it in RGB (10,19,200).

Related topics

Color


Color

Color and RGB (red, green, blue) equivalent functions. However, RGB is preferred in Basic syntax and Color is preferred in Crystal syntax.

Arguments
  • red is a Number value representing the red component of the resultant color, value is between 0 and 255.
  • green is a Number value representing the green component of the resultant color, value is between 0 and 255.
  • blue is a Number value representing the blue component of the resultant color, value is between 0 and 255.
Returns

Font color attribute.

Action

Color returns the color attribute as specified by the red, green and blue components.

Typical use

To specify a custom color when writing a conditional formatting formula for the font or background color of a report field.

Example

The following example is applicable to Crystal syntax:

if CurrentFieldValue > 10000 then
Color (150,230,150)
else
Color (10,19,200)

This formula formats a Number field to display in the color as specified by Color (150,230,150) if its current value is greater than 10000, otherwise to display it in Color (10,19,200).

Related topics

RGB (red, green, blue)


Business Calendar

IsBusinessDay (date)

NextNBusinessDays (#days)

Note: These functions assume a Business Calendar has been set up for your system. Currently, the Business Calendar is only supported in Seagate Info but not in Seagate Crystal Reports. If you are using this function in Seagate Crystal Reports, or if you have not specified a Business Calendar for your Seagate Info system, this function assumes everyday is a business day.


IsBusinessDay (date)

Basic and Crystal syntax.

Note: This function assumes a Business Calendar has been set up for your system. Currently, the Business Calendar is only supported in Seagate Info but not in Seagate Crystal Reports. If you are using this function in Seagate Crystal Reports, or if you have not specified a Business Calendar for your Seagate Info system, this function assumes everyday is a business day.

Arguments

(date) is a Date value.

Returns

Boolean value

Action

Evaluates the date specified in the argument, and returns TRUE if the Date value falls on a business day.

Typical Uses

You can use this function in a record selection formula to limit the report to records for business days, or to records that are not for business days.

Examples

The following examples are applicable to both Basic and Crystal syntax:

IsBusinessDay({Customer.ORDER DATE})

Returns TRUE, where {Customer.ORDER DATE} has a value of 10/14/98, and is specified to be a business day according the Business Calendar for your system.

IsBusinessDay({Customer.ORDER DATE})

Returns FALSE, where {Customer.ORDER DATE} has a value of 10/18/98 which is a Sunday, and is specified to be a non-business day according to the Business Calendar for your system.

Comments

Currently, this function only accepts a date but not a dateTime field as an argument.


NextNBusinessDays (#days)

Basic and Crystal syntax.

Note: Currently only Seagate Info supports the Business Calendar, Since Seagate Crystal Reports does not support the Business Calendar, if you are using this function in Seagate Crystal Reports, or if you have not specified a Business Calendar for your Seagate Info system, this function assumes everyday is a business day.

Arguments

#days is a positive, whole number indicating the number of business days that you would like to know the dates for if you start counting from today.

Returns

An array of dates

Action

NextNBusinessDays (x) returns an array of dates, indicating the next x number of business days as of and including the current date, based on the Business Calendar you have specified for your system.

Typical Uses

You could pass a number of days to this function, and the function would return an array of dates indicating that number of business days as of the current day (according to the program's business calendar).

Examples

The following examples are applicable to both Basic and Crystal syntax:

Assuming the current date is Sept. 24, 1999, which is a Friday, and a Business Calendar specifies no holidays in the rest of September, and only Saturdays and Sundays are non-business days.

NextNBusinessDays(5)

Returns an array of 5 dates, including Sept. 24, 27, 28, 29 and 30, 1999.

Comments
  • (#days) can not exceed either +1000 or -1000.
  • This function assumes that a Business Calendar indicating the business days, weekends and holidays to have been set up.


Operators

Operators are special symbols or words that describe an operation or an action to take place between two or more values. Operators are used in formulas. The program reads the operators in a formula and performs the actions specified.


Arithmetic operators

Arithmetic operators are used to calculate number or dollar values.

Add operator

Subtract operator

Multiply operator

Divide operator

Percent operator

Integer divide (x \ y)

Modulus (x Mod y)

Negate operator

Exponentiate (x ^ y)


Add operator

Basic and Crystal syntax.

Usage

x+y

Adds values x and y.

Examples

The following examples are applicable to both Basic and Crystal syntax:

5 + 6

Returns 11: {file.QTY1} + {file.QTY2}.

Returns 1487 where {file.QTY1} = 366 and {file.QTY 2} = 1121.

{file.AMT1} + {file.AMT2} + {file.AMT3} + {file.AMT4}

Returns 20 where {file.AMT1} = 2, {file.AMT2} = 4, {file.AMT3} = 6, {file.AMT4} = 8.

{file.CLASS1} + 25

Returns 37 where {file.CLASS1} = 12.

CDate (1991, 04, 05) + 12

Returns the date value April 17, 1991.

Related topics

Formula 8

Formula 16


Subtract operator

Basic and Crystal syntax.

Usage

x-y

Subtracts value y from value x.

Examples

The following examples are applicable to both Basic and Crystal syntax:

244 - 112

Returns 132.

{file.SALES} - {file.COGS} - {file.S&A} = 214,972

Returns 132, where {file.SALES} = 455,031, {file.COGS} = 188,213, and {file.S&A} = 51846.

{file.ONHAND} - 877 = 114

Returns 114, where {file.ONHAND} = 991.

CDate (1991, 04, 15) - 12 = Apr 03 91

Returns Apr 03 91.

Related topics

Formula 1

Formula 2

Formula 4

Formula 5

Formula 7

Formula 12


Multiply operator

Basic and Crystal syntax.

Usage

x*y

Multiplies value x by value y.

Examples

The following examples are is applicable to both Basic and Crystal syntax:

2883 * 1999

Returns 5,763,117.

{file.AMOUNT} * {file.QTY} * {file.DISCOUNT}

Returns 26.25 where {file.AMOUNT} = 25.00, {file.QTY} = 7, and {file.DISCOUNT} = .15

{file.EXMPT} * 356.00

Returns 152,012 where {file.EXMPT} = 427.

Related topics

Formula 1

Formula 3

Formula 4

Formula 12

Formula 16


Divide operator

Basic and Crystal syntax.

Usage

x/y

Divides value x by value y.

Examples

The following examples are applicable to both Basic and Crystal syntax:

25/5

Returns 5

1/3

Returns .333333

{file.SALES} / {file.FORECAST}

Returns .875, where {file.SALES} = 52533, {file.FORECAST} = 60000

{file.DAYSDUE} / 5

Returns 22, where {file.DAYSDUE} = 110

Note: If the denominator = 0, the report will be halted with a divide by zero protection. If you want to avoid this type of problem, you should put a test in.

The following example is applicable to Crystal syntax:

If {file.FORECAST} = 0 Then
0
Else
{file.SALES} / {file.FORECAST}

Related topics

Formula 13


Percent operator

Crystal syntax.

Usage

x % y

Calculates value x as a percentage of value y. That is (x/y) * 100.

Examples

The following examples are applicable to Crystal syntax:

{file.BALANCE OUTSTANDING} % {file.CREDIT LIMIT}

Returns 30.00, where {file.BALANCE OUTSTANDING} = $1500 and {file.CREDIT LIMIT} = $5000.

{file.AMOUNT} % {file.CREDIT LIMIT}

Returns 32.26, where {file.AMOUNT} = 2257.87 and {file.CREDIT LIMIT} = 7000.

Note: If the denominator equals 0, the report will be halted with a divide by zero protection. If you want to avoid this type of problem, you should put a test in.

If {file.FORECAST} = 0 Then
0
Else
{file.SALES} % {file.FORECAST}

Related topics

Formula 6


Integer divide (x \ y)

Basic and Crystal syntax.

Usage

x \ y

Divides Number value x by Number value y and returns a quotient that is a whole number.

Note: If x or y is not a whole number, then it is first rounded before the operation.

Examples

The following examples are applicable to both Basic and Crystal syntax:

23 \ 5

Returns 4.

3 \ 2

Returns 1.


Modulus (x Mod y)

Basic and Crystal syntax.

Usage

x Mod y

Divides x by y and returns a remainder that is a whole number. The Number values x and y can be positive or negative, and they can be fractional. If x or y is fractional, it will be first rounded before the modulus is taken.

Examples

The following examples are applicable to both Basic and Crystal syntax:

83 Mod 10

Returns 3.

10 Mod 3

Returns 1.

-10 Mod 3

Returns -1.

10 Mod -3

Returns 1.

10 Mod 3.5

Returns 2 since 3.5 is first rounded to 4 before the modulus is taken.


Negate operator

Basic and Crystal syntax.

Usage

[-(x)]

Multiplies the value inside the parentheses by -1.

Examples

The following examples are applicable to both Basic and Crystal syntax:

-(-1)

Returns 1 since negative times negative equals positive.

-(1)

Returns -1 since negative times positive equals negative.

-(0-14)

Returns 14.

-({file.QTYONHND})

Returns 144 where {file.QTYONHND} = -144.

- (- (15-18)

Returns -3 since 15 - 18 = -3, -(-3) = +3, -(+3) = -3.

Related topics

Formula 5

Formula 8


Exponentiate (x ^ y)

Basic and Crystal syntax.

Usage

x ^ y

Raise x to the power of y.

Note: The Number value y can be fractional, and it can be positive or negative. The Number value x can be fractional, but can be negative only if y is a whole number.

Examples

The following examples are applicable to both Crystal and Basic syntax:

3 ^ 2

Returns 9.

3 ^ .5

Returns 1.73205....

(-3.5) ^ 2

Returns 12.25. Note that the Exponentiation operator has a higher precedence than Negation, so -3.5 ^ 2 is different from (-3.5) ^ 2.

3 ^ (-2)

Returns .111...

Note: To express a number to a negative power, enclose the power in parentheses.


Conversion operators

Conversion operators are used to convert one data type to another.

To currency operator


To currency operator

Crystal syntax.

Usage

$x

Converts x from number to currency.

Examples

The following examples are applicable to Crystal syntax.

Note: They all assume the following format (set in the Number tab of the Format Editor): Decimal places = (1.00), Negative sign = (345.00-), Currency symbol = (Float), and Thousands Separator = (1,000.00).

$12345678

Returns $12,345,678.00.

$(123 * 456)

Returns $56,088.00

$({file.QUANTITY} * 3)

Returns $42.00, where {file.QUANTITY} = 14.

$({file.MILES} * {file.PLEDGE})

$27.95, where {file.MILES} = 13 and {file.PLEDGE} = 2.15.

Note: $ * $ = error. You can not multiply a dollar with a dollar.

Related topics

Formula 5


Comparison operators

Comparison operators are used to compare data in a data field with a constant, with the content of another data field, or with a formula result.

Note: A constant is a fixed value (for example, a text string, date, or a number or dollar value you enter) that remains the same when a calculation is performed.

Equal operator

Not Equal operator

Less Than operator

Greater Than operator

Less or equal operator

Greater or Equal operator


Equal operator

Basic and Crystal syntax.

Usage

x = y

x is equal to y

The equal operator tells the program to evaluate an expression (x=y) and return a TRUE (if x is equal to y) or FALSE (if x is not equal to y).

Examples

The following examples are applicable to both Crystal and Basic syntax:

{file.QUANTITY} = 3

TRUE, where {file.QUANTITY} has a value of 3.

{file.QUANTITY} = 3

FALSE, in all other situations.

{file.YTD} = {file.LASTYEARYTD}

TRUE, where the value of the field {file.YTD} is identical to the value of the field {file.LASTYEARYTD}.

{file.YTD} = {file.LASTYEARYTD}

FALSE, in all other situations.

({file.SALES} - {file.COGS}) = 22,654

TRUE, where calculating the expression {file.SALES}-{file.COGS} produces the value 22,654, for example {file.SALES} = 109,986} and {file.COGS} = 87,332}.

({file.SALES} - {file.COGS}) = 22,654

FALSE, in all other situations.

{customer.LAST NAME} = "Johnson"

TRUE, where the text string in the {customer.LAST NAME} field is "Johnson".

{customer.LAST NAME} = "Johnson"

FALSE, in all other situations.

Comments

This operator is often used in expressions with If-Then-Else operators. For example in Crystal syntax:

If {file.PURCHASES} = 0 Then
"Your account had no activity this month."
Else
"";

Which prints the "Your account..." statement if the {file.PURCHASES} field has a zero value, and prints nothing (indicated by the empty string "") if the {file.PURCHASES} field has something other than a zero value.

Related topics

Formula 9

Formula 15

Formula 17


Not Equal operator

Basic and Crystal syntax.

Usage

x<>y

x is not equal to y.

The Not Equal operator tells the program to evaluate an expression (x<>y) and return a TRUE (if x is not equal to y) or FALSE (if x is equal to y).

Examples

The following examples are applicable to both Basic and Crystal syntax:

{orders.ORDER AMOUNT} <> 400

TRUE, where {orders.ORDER AMOUNT} is equal to 200 or {orders.ORDER AMOUNT} is equal to 401, etc.

{orders.ORDER AMOUNT} <> 400

FALSE, where {orders.ORDER AMOUNT} is equal to 400.

{file.DAY} <> "Thursday"

TRUE, when {file.DAY} = "Friday".

{file.DAY} <> "Thursday"

FALSE, when {file.DAY} = "Thursday".

{file.ONHAND} <>0

TRUE, where the value of {file.ONHAND} is 10 or -5.

{file.ONHAND} <>0

FALSE, where the value of {file.ONHAND} is zero.

{file.AVAILABLE} - {file.USED} <>10

TRUE, where the value of the {file.AVAILABLE} field less the value of the {file.USED} field gives a result other than 10.

{file.AVAILABLE} - {file.USED} <>10

FALSE, where it gives a value of 10.

Comments

This operator is often used with If-Then-Else operators. For example in Crystal syntax:

If {file.SEX} <> "M" Then
"FEMALE"
Else
"MALE"

Prints the word "FEMALE" if the value in the {file.SEX} field is not equal to "M", and prints the word "MALE" in all other situations.

Related topics

Formula 5

Formula 11

Formula 15


Less Than operator

Basic and Crystal syntax.

Usage

x < y

x is less than y

The less than operator tells the Formula Editor to evaluate an expression (x<y) and returns a TRUE (if x is less than y) or FALSE (if x is equal to or greater than y).

Examples

The following examples are applicable to both Basic and Crystal syntax:

{file.WEIGHT} < 200

TRUE, where {file.WEIGHT} = 150, or {file.WEIGHT} = 199.

{file.WEIGHT} < 200

FALSE, where {file.WEIGHT} = 200 or {file.WEIGHT} = 400.

{file.COST} < {file.PRICE}

TRUE, where {file.COST}=350, {file.PRICE} = 400.

{file.COST} < {file.PRICE}

FALSE, where {file.COST} = 350 and {file.PRICE} = 350, or where {file.COST} = 350 and {file.PRICE} = 325.

Related topics

Formula 2

Formula 5

Formula 8

Formula 16


Greater Than operator

Basic and Crystal syntax.

Usage

x > y

x is greater than y.

Examples

The following examples are applicable to both Basic and Crystal syntax:

{file.WEIGHT} > 200

FALSE, where {file.WEIGHT}= 150, {file.WEIGHT} = 199, or {file.WEIGHT} = 200.

{file.WEIGHT} > 200

TRUE, where {file.WEIGHT} = 400 or {file.WEIGHT} = 201.

{file.COST} > {file.PRICE}

FALSE, where {file.COST =350}, {file.PRICE} = 400, or where {file.COST} = 350 and {file.PRICE} = 350.

{file.COST} > {file.PRICE}

TRUE, where {file.COST} = 350 and {file.PRICE} = 325.

Related topics

Formula 4

Formula 6

Formula 7

Formula 12


Less or equal operator

Basic and Crystal syntax.

Usage

x <= y

x is less than or equal to y.

Examples

The following examples are applicable to both Basic and Crystal syntax:

{file.WEIGHT} <= 200

TRUE, where {file.WEIGHT} = 150, {file.WEIGHT} = 200, or {file.WEIGHT} = 199.

{file.WEIGHT} <= 200

FALSE, where {file.WEIGHT} = 400.

{file.COST} <= {file.PRICE}

TRUE, where {file.COST} =350, {file.PRICE} = 400, or where {file.COST} = 350 and {file.PRICE} = 350.

{file.COST} <= {file.PRICE}

FALSE, where {file.COST} = 350 and {file.PRICE} = 325.

Related topics

Formula 14


Greater or Equal operator

Basic and Crystal syntax.

Usage

x >= y

x is greater than or equal to y.

Examples

The following examples are applicable to both Basic and Crystal syntax:

{file.WEIGHT} >= 200

FALSE, where {file.WEIGHT} = 150 or {file.WEIGHT} = 199.

{file.WEIGHT} >= 200

TRUE, where {file.WEIGHT} = 400, {file.WEIGHT} = 200, or {file.WEIGHT} = 201.

{file.COST} >= {file.PRICE}

FALSE, where {file.COST} =350, {file.PRICE} = 400.

{file.COST} >= {file.PRICE}

TRUE, where {file.COST} = 350 and {file.PRICE} = 325, or where {file.COST} = 350 and {file.PRICE} = 350.

Related topics

Formula 4

Formula 6


String operators

String operators are used to concatenate (join) text strings, to extract substrings from text strings, or to test for the presence of substrings in text strings.

Note: Operators are case-sensitive. For example, "ABC" is not equal to "abc". Nor is "abc" in the string "ABCDEF".

Concatenate operator (x +y)

Concatenate (x & y)

Subscript for arrays and strings

In String operator


Concatenate operator (x +y)

Basic and Crystal syntax.

Concatenate (x & y) and Concatenate (x + y) are synonymous if both operands x and y are Strings.

Usage

x + y

Concatenates (combines) string x to string y to make one contiguous string.

Examples

The following examples are applicable to both Basic and Crystal syntax:

"Bread" + " and " + "butter"

Returns "Bread and butter".

"Your customer number is " + ({customer.CUSTOMER ID}) + " and your company contact person is " + ({customer.FIRST NAME}) + "."

Returns "Your customer number is 64 and your company contact person is Bob." Where CustomerID="64" and First Name = "Bob".

Comments
  • You can use this operator only if all the elements you are connecting are strings.
  • If you want to include a value from a numeric field (for example, an account balance), you must first convert that value to a text string using the ToText function:

"Your account balance is " + ToText({file.BALANCE}) + "."

Related topics

Concatenate (x & y)

Formula 2

Formula 5

Formula 13

Formula 15


Concatenate (x & y)

Basic and Crystal syntax.

Concatenate (x & y) and Concatenate operator (x +y) are synonymous if both operands x and y are strings.

Usage

x & y

Concatenates the values of x and y, and returns the result as a String. x and y can be of one of the types Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to both Crystal and Basic syntax:

10 & 20

Returns the String "10.0000020.00000", where the number formatting for this formula field specifies 5 decimal places. Use CStr if you want to specify how to format a String when converting from a different type. In this example, you can use CStr on the Number values a and b to convert and format each of them to a String, and then concatenate the resultant Strings.

True & False

Returns the String "TrueFalse".

"The meeting is " & #Nov 15. 1999#

Returns the String "The meeting is 11/15/99 12:00:00 AM".

"Boy" & "Girl"

Returns the String "BoyGirl".

Comments

The format of the returned value is determined by the format that has been set up for that formula field of the corresponding type of operands. However, if you want to convert to a String from a value of a different type and be able to specify formatting for the resultant string, you can use CStr.

Related topics

Concatenate operator (x +y)


Subscript for arrays and strings

Basic syntax (x(y))

Usage

x(y)

Extracts the y element from string x.

x(y To z)

Extracts the y to z range of elements from string x.

x(n)

Extracts the n element of array x.

Note: The subscript ranges are 1-based; they start at 1 rather than 0.

Subscript is used to extract one or more characters from a text string or to extract an element from an array.

Examples

The following examples are applicable to Basic syntax:

LNAME (1)

Returns "S", where LNAME = "Smith".

Postal (6)

Returns "V", where Postal Code = "T5A 9V2" (the space between A and 9 counts as an element).

{customer.POSTAL CODE} (5 to 7)

Returns "9V2", where Postal Code = T5A 9V2.

{file.ITEMNUMBER} (4 to 5)

Returns "40", where ItemNumber is A1/4020/B10.

Comments
  • You must subscript an array by first declaring an array, then referencing the array variable name in Basic syntax. For example:

'declare array MyName
Dim MyName () As String
MyName = Array ("Company A", "Company B", "Company C")
'reference array by its name
formula = MyName (1)

  • Do not confuse Subscript with the In String operator.

    While Subscript tests a target string for the presence of an element and extracts the element (if found) from the string, In String only tests the target string for the presence of the element.

Related topics

Crystal Syntax (x[y])

Crystal Syntax (x[y])

Usage

x[y]

Extracts the y element from string x.

x[y to z]

Extracts the y to z range of elements from string x.

x[n]

Extracts the n element of array x.

Note: The subscript ranges are 1-based; they start at 1 rather than 0.

Subscript is used to extract one or more characters from a text string or to extract an element from an array.

Examples

The following examples are applicable to Crystal syntax:

[100,233,466,998][3]

Returns 466; 466 is the third element in the array.

LNAME [1]

Returns "S", where LNAME = "Smith".

Postal [6]

Returns "V", where Postal Code = "T5A 9V2" (the space between A and 9 counts as an element).

{customer.POSTAL CODE} [5 to 7]

Returns "9V2", where Postal Code = "T5A 9V2".

{file.ITEMNUMBER} [4 to 5]

Returns "40", where ItemNumber is A1/4020/B10.

Comments

Do not confuse Subscript with In String operator.

While Subscript tests a target string for the presence of an element and extracts the element (if found) from the string, In String only tests the target string for the presence of the element.

Related topics

Basic syntax (x(y))

Formula 1

Formula 2

Formula 3

Formula 9

Formula 11


In String operator

Basic and Crystal syntax.

Usage

x in y

Tests for the presence of string x in string y.

Examples

The following examples are applicable to both Basic and Crystal syntax:

"Elm" in {customer.ADDRESS1}

TRUE, where {customer.ADDRESS1} is "1335 Elm Street".

"Elm" in {customer.ADDRESS1}

TRUE, where {customer.ADDRESS1} is "1335 Elmer Street".

"elm" in {file.MOTTO}

FALSE, where {file.MOTTO} = "Feel more energy".

(The "el" ending "feel" and the "m" beginning the word "more" are separated by a space which itself counts as an element.)

"el m" in {file.MOTTO}

TRUE, where {file.MOTTO} = "Feel more energy".

The search string "el m" this time contains the space between the l and the m, which allows for a perfect match.

Note: The "in" operator can also be used to test for the presence of a string in a text range. For example, "V5B" in "V0A" to "V9Z".


Range operators

Range operators are used to create ranges and to see if a value is within the range created. These operators test for consecutive values such as dates, text, or amounts which fall within a range.

In Range operator

Make Range operator (x To y)

Left end point excluded range (x _To y)

Right end point excluded range (x To_ y)

Both end points excluded range (x _To_ y)

Is > x

Is < x

Is >= x

Is <= x

Up from (upFrom x)

Up from but not including (upFrom_ x)

Up to (upTo x)

Up to but not including (upTo_ x)


In Range operator

Basic and Crystal syntax.

Usage

x in y

Tests a range of value (y) to see if a value (x) falls within the range specified.

Examples

The following examples are applicable to both Basic and Crystal syntax:

CurrentDate in CDate(1990, 09, 01) to CDate(1990, 09, 20)

Returns True, if today's date is September 15, 1990.

CurrentDate in CDate(1990, 09, 01) to CDate(1990, 09, 20)

Returns False, if today's date is September 21, 1990.

{file.QTY} in {file.ONHAND} to ({file.BACKORDER} + {file.ONORDER})

Returns True, where {file.QTY} = 20, {file.ONHAND} = 10, {file.BACKORDER} = 5, {file.ONORDER} = 25 (Is 20 in the range that begins with 10 and ends with the sum of 5 and 25?).

{file.QTY} in {file.ONHAND} to ({file.BACKORDER} + {file.ONORDER})

Returns False, where {file.QTY} = 31, {file.ONHAND} = 10, {file.BACKORDER} = 5, {file.ONORDER} = 25 (Is 31 in the range that begins with 10 and ends with the sum of 5 and 25?).

Comments

The combination of Make Range operator (x To y) and In Range operators is often used with the If-Then-Else operators operator. For example the Crystal syntax formula:

If ({file.AMOUNT} in (100.00 to 250.00)) Then
(.10 * {file.AMOUNT})
Else
0;

If the value of {file.AMOUNT} falls within the range 100.00 to 250.00, multiply .10 times {file.AMOUNT}. If it does not, it returns zero.

Related topics

Formula 9

Formula 10

DateTime function


Make Range operator (x To y)

Basic and Crystal syntax.

Usage

x to y

Create the range x to y.

Examples

The following examples are applicable to both Basic and Crystal syntax:

100.00 to 250.00

The range of consecutive numeric values beginning with 100.00 and ending with 250.00, including the end values.

CDate(1990, 09, 01) to CDate(1990, 09, 20)

The range of consecutive dates beginning with September 1, 1990, and ending with September 20, 1990. Both September 1 and September 20 are included in the range.

"Aaron" to "Lusk"

The range of consecutive text values beginning with "Aaron" and ending with "Lusk", including the beginning and end values.

Comments
  • You cannot create a formula that has a range as a result. Thus, Make Range is always used in conjunction with other operators such as the In Range operator. The combination of Make Range and In Range produces a formula that gives a single TRUE or FALSE value, not a range.
  • The program comes with a number of Date Range functions, such as YearToDate, preset for your convenience.
Related topics

Formula 2

Formula 3

Formula 9

Formula 10


Left end point excluded range (x _To y)

Basic and Crystal syntax.

Usage

x _To y

x _To y is used to specify a range of values greater than but not including the value x, and less than or equal to the value y. x and y can be of one of the types: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following example is applicable to Basic syntax:

Dim BlackoutDates As Date Range
Rem Blackout period is Jan. 1, 1999 to March 31, 1999, inclusive
BlackoutDates = CDate(#12/31/1998#) _To CDate(#3/ 31/1999#)
If CurrentDate In BlackoutDates Then
formula = "Blackout"
Else
formula = "Free to trade"
End If

If today's date is Dec. 31, 1998, then "Free to trade" is returned since it is before the Blackout period.

If today's date is Jan. 1, 1999, then "Blackout" is returned since it is within the Blackout period.

If today's date is March 31, 1999, then "Blackout" is returned since it is within the Blackout period.

If today's date is Oct. 30, 1999, then "Free to trade" is returned since it is after the Blackout period.


Right end point excluded range (x To_ y)

Basic and Crystal syntax.

Usage

x To_ y

x To_ y is used to specify a range of values greater than or equal to the value x, and less than but not including the value y. x and y can be of one of the types: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following example is applicable to Basic syntax:

Dim BlackoutDates As Date Range
Rem Blackout period is Jan. 1, 1999 to March 31, 1999, inclusive
BlackoutDates = CDate(#1/1/1999#) To_ CDate(#4/1/1999#)
If CurrentDate In BlackoutDates Then
formula = "Blackout"
Else
formula = "Free to trade"
End If

If today's date is Dec. 31, 1998, then "Free to trade" is returned since it is before the Blackout period.

If today's date is Jan. 1, 1999, then "Blackout" is returned since it is within the Blackout period.

If today's date is March 31, 1999, then "Blackout" is returned since it is within the Blackout period.

If today's date is April 1, 1999, then "Free to trade" is returned since it is after the Blackout period.


Both end points excluded range (x _To_ y)

Basic and Crystal syntax.

Usage

x _To_ y

x _To_ y is used to specify a range of values greater than but not including the value x, and less than but not including the value y. x and y can be of one of the types: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following example is applicable to Basic syntax:

Dim BlackoutDates As Date Range
Rem Blackout period is Jan. 1, 1999 to March 31, 1999, inclusive
BlackoutDates = CDate(#12/31/1998#) _To_ CDate(#4/1/1999#)
If CurrentDate In BlackoutDates Then
formula = "Blackout"
Else
formula = "Free to trade"
End If

If today's date is Dec. 31, 1998, then "Free to trade" is returned since it is before the Blackout period.

If today's date is Jan. 1, 1999, then "Blackout" is returned since it is within the Blackout period.

If today's date is March 31, 1999, then "Blackout" is returned since it is within the Blackout period.

If today's date is April 1, 1999, then "Free to trade" is returned since it is after the Blackout period.


Is > x

Basic and Crystal syntax.

Is > x is preferred in Basic syntax, whereas Up from but not including (upFrom_ x) is preferred in Crystal syntax.

Usage

Is > x

Is > x is used to specify a range of values greater than the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to Basic and Crystal syntax:

Is > 250

The range of all numbers greater than 250.

Is > CDate (2000, 3, 17)

The range of dates from March 18, 2000 onwards, including March 18, 2000.


Is < x

Basic and Crystal syntax.

Is < x is preferred in Basic syntax, whereas Up to but not including (upTo_ x) is preferred in Crystal syntax.

Usage

Is < x

Is < x is used to specify a range of values less than the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following example is applicable to Basic syntax:

Dim BlackoutDates() As Date Range
Rem Blackout period is any day before 1999 or any date within March 1999
BlackoutDates = Array (Is < CDate(1999, 1, 1), _
CDate(1999, 3, 1) To CDate (1999, 3, 31))
If CurrentDate In BlackoutDates Then
formula = "Blackout"
Else
formula = "Free to trade"
End If

If today's date is Dec. 30, 1998, then "Blackout" is returned since it is within the Blackout period before 1999.

If today's date is Jan. 1, 1999, then "Free to trade" is returned since it is not within any blackout period.

If today's date is March 31, 1999, then "Blackout" is returned since it is within the Blackout month of March.

If today's date is Oct. 30, 1999, then "Free to trade" is returned since it is not within any blackout period.


Is >= x

Basic and Crystal syntax.

Is >= x is preferred in Basic syntax, whereas Up from (upFrom x) is preferred in Crystal syntax.

Usage

Is >= x

Is >= x is used to specify a range of values greater than or equal to the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to Basic and Crystal syntax:

Is >= 250

The range of all numbers greater than or equal to 250.

Is >= CDate (2000, 3, 17)

The range of dates from March 17, 2000 onwards including March 17, 2000.


Is <= x

Basic and Crystal syntax.

Is <= x is preferred in Basic syntax, whereas Up to (upTo x) is preferred in Crystal syntax.

Usage

Is <= x

Is <= x is used to specify a range of values less than or equal to the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to Basic and Crystal syntax:

Is <= 250

The range of all numbers less than or equal to 250.

Is <= CDate (2000, 3, 17)

The range of dates before March 17, 2000, up to and including March 17, 2000.


Up from (upFrom x)

Basic and Crystal syntax.

upFrom x is preferred in Crystal syntax, whereas Is >= x is preferred in Basic syntax.

Usage

upFrom x

upFrom x is used to specify a range of values greater than or equal to the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to Basic and Crystal syntax:

upFrom 250

The range of all numbers greater than or equal to 250.

upFrom CDate (2000, 3, 17)

The range of dates from March 17, 2000 onwards including March 17, 2000.


Up from but not including (upFrom_ x)

Basic and Crystal syntax.

UpFrom_ x is preferred in Crystal syntax, whereas Is > x is preferred in Basic syntax.

Usage

upFrom_ x

upFrom_ x is used to specify a range of values greater than but not including the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to Basic and Crystal syntax:

upFrom_ 250

The range of all numbers greater than 250.

upFrom_ CDate (2000, 3, 17)

The range of dates from March 18, 2000 onwards, including March 18, 2000.


Up to (upTo x)

Basic and Crystal syntax.

upTo x is preferred in Crystal syntax, whereas Is <= x is preferred in Basic syntax.

Usage

upTo x

upTo x is used to specify a range of values less than or equal to the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to Basic and Crystal syntax:

upTo 250

The range of all numbers less than or equal to 250.

upTo CDate (2000, 3, 17)

The range of dates before March 17, 2000, up to and including March 17, 2000.


Up to but not including (upTo_ x)

Basic and Crystal syntax.

upTo_ x is preferred in Crystal syntax, whereas Is < x is preferred in Basic syntax.

Usage

upTo_ x

upTo_ x is used to specify a range of values less than but not including the value x. x can be of any type: Number, Boolean, Currency, Date, Time, DateTime, and String.

Examples

The following examples are applicable to Basic and Crystal syntax:

upTo_ 250

The range of all numbers less than 250.

upTo_ CDate (2000, 3, 17)

The range of dates before March 17, 2000, not including March 17, 2000.


Boolean operators

Boolean operators are used to create conditions that require a logical relationship between two or more values. Conditions that use Boolean operators are called Boolean expressions.

  • A and B means that both A and B must be true for the condition to be satisfied (to return a TRUE value)
  • A or B means that either A or B (or both) must be true for the condition to be satisfied (to return a TRUE value)

Not operator

And operator

Or operator

Xor (Logical exclusion)

Eqv (Logical equivalence)

Imp (Logical implication)


Not operator

Basic and Crystal syntax.

Usage

not (x)

Reverses the True or False value of x.

Value of x | Not x
True | False
False | True

  • Not (Not(False)) = False
  • Not (Not(True)) = True
Examples

The following examples are applicable to both Basic and Crystal syntax:

not (A>B and B>C)

If A=5, B = 4, C = 3, the expression (A>B and B>C) is TRUE. Both conditions tied together by the Boolean operator And are TRUE; thus, the entire statement has a value of TRUE. The Not operator changes the value of the expression to FALSE.

not (A>B and B>C)

If A=3, B = 4, C = 3, the expression (A>B and B>C) is FALSE. One of the two conditions tied together by the Boolean operator And is FALSE; thus, the entire statement has a value of FALSE. The Not operator changes the value of the expression to TRUE.

not ({file.ONHAND} - {file.ORDER} > 0)

Returns TRUE if {file.ONHAND} = 10 and {file.ORDER} = 11.

not ({file.ONHAND} - {file.ORDER} > 0)

Returns FALSE if {file.ONHAND} = 10 and {file.ORDER} = 9.

Related topics

Formula 10


And operator

Basic and Crystal syntax.

Usage

x And y

Value of x | Value of y | x And y
True | True | True
True | False | False
False | True | False
False | False | False

Examples

The following example is applicable to Crystal syntax:

If {file.CREDIT LIMIT} = 5000 and {file.SALESMAN} = "SP" Then
{file.AMOUNT}
Else
0

If the credit limit is 5000 and the salesman is SP (both conditions true), then returns the value in the {file.AMOUNT} field, otherwise return zero.

A > B and B > C

Returns TRUE, where A = 10, B = 6, and C = 3 (both conditions are true).

Returns FALSE, where A=10, B=6, and C=7 (only one of the two conditions are true).

(A>B) and (A * C - D > E) and (E / D <= B)

Returns TRUE, where A = 7, B = 5, C = 3, D = 2, E = 10 (all three of the conditions are true).

Related topics

Order of precedence (Basic syntax)

Order of precedence (Crystal syntax)

Formula 6

Formula 15


Or operator

Basic and Crystal syntax.

Usage

x Or y

Value of x | Value of y | x Or y
True | True | True
True | False | True
False | True | True
False | False | False

Examples

The following example is applicable to Crystal syntax:

If {file.CREDIT LIMIT} = 5000 or {file.SALESMAN} = "SP"
Then
{file.AMOUNT}
Else
0;

This means that if the credit limit is 5000, or, if the salesman is SP, (either of the conditions are true), then it returns the value in the {file.AMOUNT} field; otherwise it returns nothing.

The following examples are applicable to both Basic and Crystal syntax:

A > B or B > C

TRUE, where A = 10, B = 6, and C = 3 (both conditions true).

A > B or B > C

TRUE, where A=10, B=6, and C=7 (either one of the two conditions true).

A > B or B > C

FALSE, where A=5, B=6, and C=7 (neither of the two conditions true).

(A>B) or (A * C - D > E) or (E / D<= B)

TRUE, where A = 5, B = 5, C = 3, D = 2, E = 12 (At least one of the three conditions is true. In this case only (A * C - D > E) is true).

Related topics

Formula 6


Xor (Logical exclusion)

Basic and Crystal syntax.

Usage

x Xor y

Value of x | Value of y | x Xor y
True | True | False
True | False | True
False | True | True
False | False | False

Examples

The following example is applicable to both Basic and Crystal syntax:

{Customer.SELL} Xor {Customer.GOVT_APPROVE}

Returns True if one of {Customer.SELL} and {Customer.GOVT_APPROVE} is True, and the other is False.


Eqv (Logical equivalence)

Basic and Crystal syntax.

Usage

x Eqv y

Value of x | Value of y | X Eqv y
True | True | True
True | False | False
False | True | False
False | False | True

Examples

The following example is applicable to Basic and Crystal syntax:

{Customer.SELL} Eqv {Customer.GOVT_APPROVE}

Returns True if both {Customer.SELL} and {Customer.GOVT_APPROVE} are True, or both {Customer.SELLS} and {Customer.GOVT_APPROVE} are False.


Imp (Logical implication)

Basic and Crystal syntax.

Usage

x Imp y

Value of x | Value of y | X Imp y
True | True | True
True | False | False
False | True | True
False | False | True

Examples

The following example is applicable to both Basic and Crystal syntax:

{Customer.SELL} Imp {Customer.GOVT_APPROVE}

Returns True if both {Customer.SELL} and {Customer.GOVT_APPROVE} are in agreement (that is, both are True or both are False), or only {Customer.GOVT_APPROVE} agrees (that is, only {Customer.GOVT_APPROVE} is True) and overrides.


Array operators

Array operators are used to build a list of data fields, constants, or text string. These lists can then be used for checking to see if a field exists in the list, or for extracted elements by their position. Whereas the Range operators are used to see if an item exists in a range of values, these array operators allow you to see if an item exists in a set of non-contiguous values.

Make Array operator

In Array operator

Redim

Redim Preserve


Make Array operator

Crystal syntax.

The Make Array operator can be used with Crystal syntax only; the Array function can be used with Basic syntax only. See Arrays (Basic Syntax).

Usage

[x,y,z,...n]

Build an array containing the elements x, y, z,...n.

Examples

The following examples are applicable to Crystal syntax:

[100,200,300,400]

[{file.QTYA}, {file.QTYB}, {file.QTYC}]

[({file.AMT1} * .5),({file.AMT2} * .5), ({file.AMT3} * .25)]

[500, ({file.QTY} / 3)]

Note: You cannot have more than one data type in an array.


In Array operator

Basic and Crystal syntax.

Usage

x in [y]

Is x in the array y?

Examples

The following example is applicable to both Basic and Crystal syntax:

Rem Basic syntax
{customer.REGION} In Array ("CA", "HI", "AK")

//Crystal syntax
{customer.REGION} in ["CA", "HI", "AK"]

Is the value of the {customer.REGION} field in the array of state abbreviations?

The following examples are applicable to Crystal syntax:

{file.COLOR} in ["Red", "White", "Blue"]

Is the value of the {file.COLOR} field in the array of colors listed in the brackets?

DayofWeek({file.DATE}) in [2, 4, 6]

Is the value of the {file.DATE} field, converted to a number that represents the DayOfWeek in the array of numbers listed in the brackets? (Sunday = 1, Saturday = 7)

Related topics

Formula 2

Formula 3

Formula 8

Formula 11


Redim

Basic syntax x(n)

Use Redim x[n] (with the square brackets) only in Crystal syntax, and Redim x(n) (with the round brackets) only in Basic syntax.

Usage

Redim x(n)

Re-dimension the array x to size n, where x is an array and n is a positive whole number specifying the new size of n.

Examples

The following example is applicable to Basic syntax:

Dim x() As String
'Initialize first three array elements
x = Array ("a", "bb", "ccc")
'Re-size x to 4; old values are ignored
'x is now equal to Array ("", "", "", "")
Redim x(4)
'x is now equal to Array ("", "", "", "dddd")
x(4) = "dddd"
formula = x(4)

Comments

When an array is re-dimensioned with Redim, elements in the array are filled with default values for that type. See Default values for the simple types (Basic syntax).

Related topics

Array data types (Basic syntax)

Using array variables (Basic syntax)

Crystal syntax x[n]

  • Use Redim x[n] (with the square brackets) only in Crystal syntax, and Redim x(n) (with the round brackets) only in Basic syntax.
  • Unlike Redim x(n) in Basic syntax, a Redim statement in Crystal syntax cannot have not have multiple arrays.
Usage

Redim x[n]

Re-dimension the array x to size n, where x is an array and n is a positive whole number specifying the new size of n.

Examples

The following example is applicable to Crystal syntax:

Local StringVar array x:= ["a", "bb", "ccc"];
// resize the array to size 4; old values are ignored
// and filled with default values of empty strings
Redim x [4];
x [4] := "dddd"; // only x[4] is initialized

Comments

When an array is re-dimensioned with Redim, elements in the array are filled with default values for that type. See Default values for the simple types (Crystal syntax).

Related topics

Array data types (Crystal syntax)

Using array variables (Crystal syntax)


Redim Preserve

Basic syntax x(n)

Usage

Redim Preserver x(n)

Re-dimension the array x to size n, while preserving the initial values in x. x is an array and n is a positive whole number specifying the new size of n.

Examples

The following example is applicable to Basic syntax:

Dim x() As String
'Initialize first three array elements
x = Array ("a", "bb", "ccc")
'Re-size x to 4; old values are retained
Redim Preserve x(4)
'initialize x(4)
x(4) = "dddd"
'return "dddd"
formula = x(4)

Related topics

Array data types (Basic syntax)

Using array variables (Basic syntax)

Crystal syntax x[n]

  • Use Redim Preserve x[n] (with the square brackets) only in Crystal syntax, and Redim Preserve x(n) (with the round brackets) only in Basic syntax.
  • Unlike Redim Preserve x(n) in Basic syntax, you may not have multiple arrays in one Redim Preserve statement in Crystal syntax.
Usage

Redim Preserver x[n]

Re-dimension the array x to size n, while preserving the initial values in x. x is an array and n is a positive whole number specifying the new size of n.

Examples

The following example is applicable to Crystal syntax:

Local StringVar array x := ["a", "bb", "ccc"];
// resize the array to size 4 while preserving the old values.
Redim Preserve x [4];
// now x = ["a", "bb", "ccc", "dddd"]
x [4] := "dddd";
x[4] // returns "dddd"

Related topics

Array data types (Crystal syntax)

Using array variables (Crystal syntax)


Pattern operators

Pattern operators allow you to compare strings to a given pattern. They are useful operators for selecting records based on part of a string (Like pattern operator) or based on a partly unknown string (Starts with operator).

Starts with operator

Like pattern operator


Starts with operator

Basic and Crystal syntax.

The startsWith operator is useful for selecting records to include or exclude from your report.

Usage

x startsWith y
{fieldname} startsWith "abc"

This operator tests to see if the contents of {fieldname} start with a character string that you specify: "abc". If the contents of the field do start with "abc", then the formula returns the value True. If the field starts with anything else, the formula returns False.

Examples

The following examples are applicable to both Basic and Crystal syntax:

{customer.CUSTOMER NAME} startsWith "A"

TRUE, where {customer.CUSTOMER NAME} = ABC Ltd.

{customer.CUSTOMER NAME} startsWith "C"

FALSE, where {customer.CUSTOMER NAME} = ABC Ltd.

{customer.CUSTOMER NAME} startsWith "ABC"

TRUE, where {customer.CUSTOMER NAME} = ABC Inc. or ABC Ltd.

{customer.CUSTOMER NAME} startsWith "ABC"

FALSE, where {customer.CUSTOMER NAME} = XYZ Inc.


Like pattern operator

Basic and Crystal syntax.

The Like operator is useful for selecting records to include or exclude from your report.

Usage

x like y
{fieldname} like "c?n*"

This operator tests to see if the contents of {fieldname} matches a pattern that you specify in a character string "c?n*". If the contents of the field do fit the pattern "c?n*", then the formula returns the value True. If the field starts with anything else, the formula returns False.

Use the wildcard symbols ? and * to stand for variable characters. The ? stands for a single character. The * symbol stands for any number of characters.

Examples

The following examples are applicable to both Basic and Crystal syntax:

{customer.FIRST NAME} like "D?n"

TRUE, where {customer.FIRST NAME} = Dan or Don.

{customer.FIRST NAME} like "D?n"

FALSE, where {customer.FIRST NAME} = Doug or Rob.

{customer.LAST NAME} like "*s?n*"

TRUE, where {customer.LAST NAME} = Johnson or Olson or Olsen.

{customer.LAST NAME} like "*s?n*"

FALSE, where {customer.LAST NAME} = Johnston or Smith.


Control structure operators

Control structures control the flow of logic in a formula. You can use them to build formula setting conditions that, if met, trigger specific consequences or repeat a sequence of actions under certain conditions.

If-Then-Else operators

Related topics
Basic syntax

If statements

Select statements

For/Next loops

Using the Exit For statement

While loops

Do Loops

Crystal syntax

If expressions

Select expressions

For loops

While Loops


If-Then-Else operators

Basic Syntax

Usage

There are 2 kinds of If statements, the multi-line If, and the single-line If. Generally, it is better to use the multi-line If since it results in clearer formulas.

Multi-line If statements

If x Then
statementsA
End If

If x is True then evaluate stamentsA.

If x Then
statementsA
Else
statementB
End If

If x is True then evaluate statementsA otherwise evaluate statementsB.

If x Then
statementsA
ElseIf y Then
statementsB
Else
statementsC
End If

If x is True then evaluate statementsA; otherwise if y is True, evaluate statementsB; otherwise evaluate statementsC.

Note:

  • There can be 0 or more ElseIf clauses and either 0 or 1 Else clause.
  • The Else clause must be last.
  • ElseIf is one word.
  • Multi-line If statements must end in an End If.
Single-line If statements

If x Then y Else z

If x is true then do y. If x is not true (Else), do z.

Examples

The following example is applicable to Basic syntax:

If {Employee.Dept} = "Sales" Then
formula = {Employee.Salary} * 0.06
Else
formula = {Employee.Salary} * 0.04
End If

Assigns rate of salary increase based on an employee's department

Comments

The If part of the expression can include text, numbers, (Cust#<"10000"), and formulas ({@Formula}), where @Formula is Boolean.

Related topics

For full details on how to use the If statement, see:

If statements (Basic syntax)

Single-line and multi-line If statements (Basic syntax)

Crystal Syntax

Usage

If x Then y Else z

If x is true then do y. If x is not true (Else), do z.

Examples

The following example is applicable to Crystal syntax:

If {customer.POSTAL CODE} <= "49999" Then
"Blue Label"
Else
"Ground"

Assigns method of shipping based on distance from ship point.

If ToNumber ({file.ITEM}) >= 2500 and ToNumber({file.ITEM}) < 2600 Then
"Seasonal"
Else
""

If statement includes an and operator for the ToNumber (numeric), ToNumber (string) function.

If {file.COUNT} >= 25 Then
{file.DISTRIBUTOR} * {file.COUNT}
Else
{file.DEALER} * {file.COUNT}

Quantity ordered determines price list used.

If {file.ONHAND}>10 Then
{file.ORDERED}
Else
If {file.ORDERED} < 5 Then
{file.ORDERED}
Else
2

Allocation based on quantity ordered using If-Then-Else nesting.

If PageNumber = 1 Then
PrintDate
Else
CDate(0,0,0)

Prints the print date (from the PrintDate function on the first page, and prints nothing [as designated by the empty date CDate(0,0,0)] on the remaining pages.

Comments
  • The If part of the expression can include text, numbers, (Cust#<"10000"), and formulas ({@Formula}), where @Formula is Boolean.
  • The Then and the Else parts, however, must both be of the same data type: (Then text, Else text; Then number, Else number). Mixing text and number actions will result in an error message.
Related topics

For full details on how to use the If statement, see:

If expressions (Crystal syntax)

More details on If expressions (Crystal syntax)

Most formula examples use this operator. Select the formula of interest from the Formulas In Action index.


Other operators

Other operators are used to assign values to variables, indicate an order of precedence in which calculations are to be performed, separate comments from formulas, define date constants, or call a function.

Parentheses operators

Assignment operators

Comments

Date-time literal (#...#)


Parentheses operators

Basic and Crystal syntax.

Usage

(x + y) * z

Performs the calculations inside the parentheses first.

Parentheses are used to control the order of precedence in which the Format Editor calculates a formula. In Basic syntax, they are also used as a string and array subscript.

Examples

The following examples are applicable to both Basic and Crystal syntax:

8 + 6 * 3 - 6 / 2

Returns 23.

(8 + 6) * 3 - 6 / 2

Returns 39.

(8 + 6) * (3 - 6 / 2)

Returns 0.

(8 + 6 * 3 - 6) / 2

Returns 10.

{file.SALES} - {file.COGS} - {file.T&E} * .8

Returns 1000, where SALES=25,000, COGS=12,000, and T&E=15,000.

{file.SALES} - (({file.COGS} - {file.T&E}) * .8)

Returns 27,400, where SALES=25,000, COGS=12,000, and T&E=15,000.

({file.SALES} - {file.COGS} - {file.T&E}) * .8

Returns -1,600, where SALES=25,000, COGS=12,000, and T&E=15,000.

Related topics

Most formula examples use this operator. Select the formula of interest from the Formulas In Action index.


Assignment operators

Basic syntax (x = y)

You can use the assignment operator (=) and the assignment keyword "Let" (Let x=y) with only Basic syntax. Crystal syntax uses the other assignment operator (:=).

Usage

x = y

Assigns y to the variable x. x must have already been declared before the assignment. y must be of the same type as x, or of a type compatible with x.

Let x = y

Assigns y to the variable x. x must have already been declared before the assignment. y must be of the same type as x, or of a type compatible with x.

Examples

The following example is applicable to Basic syntax:

Dim n As Number
Dim b As Boolean
Dim c As Currency
Dim d As Date
Dim t As Time
Dim s As String
Dim numArray () As Number
'n is assigned 100
n = 100
'b is assigned the Boolean value True
b = True
'c is assigned the Currency value 5000
c = CCur (5000)
'd is assigned the Date value of Oct. 10, 1999
d = CDate ("10, 10, 1999")
't is assigned the Time value 12:50am
t = CTime ("12:50am")

' s is assigned a string which is a concatenation of 2 substrings and a
field value
s = "The total sales is " & {Orders.Order Amount} & " billion."

' numArray is assigned an array of Number values
numArray = Array (10, 20, 30)

formula = s

Comments
  • A variable must be declared in a separate statement before it is assigned any value in Basic syntax.
  • Assignment only assigns a value to a variable. When a formula returns, the value assigned to the variable Formula is then formatted according to the format specified for that formula field of the corresponding type.

Crystal syntax (x := y)

You can use the assignment operator (:=) with only Crystal syntax. For more details, see Variable declarations.

Usage

x := n

Assigns the value n to the variable x. (x must have already been declared in the same formula.)

Examples

The following examples are applicable to Crystal syntax:

Amount:= 0

Initializes (sets to zero) the variable named Amount.

Amount:= 100

Assigns the value 100 to the variable named Amount.

Amount:= Amount + {file.QTY}

Assigns the result of a calculation to the variable named Amount. The calculation adds the value of the quantity field ({file.QTY}) to the current value of the Amount variable.

Amount:= {file.QTY1} + {file.QTY2} + {file.QTY3}

Totals the three quantity fields and assigns the total to the variable named Amount.

Customer:= "Westside Motors"

Assigns the string "Westside Motors" to the variable named Customer.

Customer:= {customer.FIRST NAME} + {customer.LAST NAME}

concatenates two fields and assigns the concatenated value of both fields to the variable named Customer.

Customer:= TrimRight({customer.FIRST NAME}) + {customer.LAST NAME}

Trims the trailing blanks from the first name field ({customer.FIRST NAME}), concatenates that field to the last name field ({customer.LAST NAME}), and assigns the concatenated value of both fields to the variable named Customer.

Customer:= "Mr. " + {customer.LAST NAME}

Concatenates the string "Mr. " with the value of the last name field {customer.LAST NAME} and assigns the concatenated value to the variable named Customer.

Amount:= 100; Customer:= "Westside Motors"

Assigns the constant 100 to the number variable named Amount and assigns the string "Westside Motors" to the string variable named Customer. You can assign values to multiple variables by separating the assignment statements with semicolons.


Comments

Formula comments are notes that are included with a formula to explain its design and operation. Comments do not print, and they do not affect the formula; they appear only in the Formula Editor.

Basic syntax (Rem)

Usage

Rem text

The text that follows the operator is a comment.

Examples

The following examples are applicable to Basic syntax:

Rem This formula returns the total number of days worked in a year.

Comment is on a new line on its own.

formula = TotalDays : Rem Total number of days worked in a year.

Comment follows a formula statement and a colon.

formula = TotalDays : Rem This formula returns the total number of days _
worked in a year.

Comment follows a formula statement and a colon, and it uses the line continuation character to continue onto the next line.

Comments
  • The comment can be above or below the formula. It can begin on a new line on its own, or it can follow the formula on the same line if it is preceded by a colon (:).
  • Can use a line continuation character ("_") within comment to carry on to next line.
  • You can use the comment operator (//) only with Crystal syntax, and the other comment operators (') and (Rem) with Basic syntax.
Related topics

Comments (Basic syntax)

Basic syntax (')

Usage

' text

The text that follows the operator is a comment.

Examples

The following examples are applicable to Basic syntax:

' This formula returns the total number of days worked in a year.

Comment is on a new line on its own.

formula = TotalDays 'Total number of days worked in a year.

Comment follows a formula statement.

formula = TotalDays 'This formula returns the total number of days _
worked in a year.

Comment follows a formula statement, and it uses the line continuation character to continue onto the next line.

Comments
  • The comment can be above or below the formula. It can begin on a new line on its own, or it can follow the formula on the same line if it is preceded by the apostrophe (').
  • Can use a line continuation character ("_") within comment to carry on to next line.
  • You can use the comment operator (//) only with Crystal syntax, and the other comment operators (') and (Rem) with Basic syntax.
Related topics

Comments (Basic syntax)

Crystal syntax (//)

Usage

// text

The text that follows the operator is a comment; it is not treated as part of a formula, and it does not print.

Examples

The following examples are applicable to Crystal syntax:

{file.SALES} - {file.COST}
// calculates the gross profit

{file.SALES} - {file.COST} is the formula; the Formula Editor ignores everything else.

({file.SALES} - {file.QUOTA}) *.06
// calculates sales commission

({file.SALES} - {file.QUOTA}) * .06 is the formula; the Formula Editor ignores everything else.

//what follows is
//a formula. Note that when
//we force the line break we have
//to begin each new line with a
//comment operator.
If {file.COST} > {file.SELL PRICE} Then "Loss" Else "";
//That was a formula

All commented lines that appear before or after the formula are ignored.

Comments
  • The comment can be above or below the formula, or it can follow the formula on the same line if it is preceded by two slashes.
  • You can use the comment operator (//) with only Crystal syntax, and the other comment operators (') and (Rem) with only Basic syntax.
Related topics

Comments (Crystal syntax)


Date-time literal (#...#)

Basic and Crystal syntax.

Usage

# alpha-numeric string #

This operator converts the enclosed alpha-numeric string to a DateTime value. The alpha-numeric should contain a date, a time, or a date and time representation that can be commonly recognized. Many formats are supported.

Examples

The following examples are applicable to both Basic and Crystal syntax:

#10:10am#

Returns a DateTime value of 10:10:00am.

#Oct. 19, 1999 #

Returns a DateTime value of October 19, 1999 12:00:00am.

#Oct. 19, 1999 10:10am#

Returns a DateTime value of October 19, 1999 10:10:00am.

Comments

If a formula returns a DateTime value, the format of the returned DateTime value is determined by the DateTime formatting applicable to that formula field.

Related topics

Date, Time, and DateTime under Simple data types (Basic syntax)

Date, Time, and DateTime under Simple data types (Crystal syntax)


Variable declaration operators

All variable names in the formula language must be declared before you can use them in a formula.

Variable declarators for Basic syntax

Variable declarators for Crystal syntax


Variable declarators for Basic syntax

Variable declarators let you define a variable by giving the variable a name. You can also assign a value to a variable when you declare it by using the Assignment operator. The following are variable declarators in Basic syntax.

Usage
  • Dim x
  • Dim x ()
  • Dim x As Boolean
  • Dim x As Number
  • Dim x As Currency
  • Dim x As Date
  • Dim x As Time
  • Dim x As DateTime
  • Dim x As String
  • Dim x As Number Range
  • Dim x As Currency Range
  • Dim x As Date Range
  • Dim x As Time Range
  • Dim x As DateTime Range
  • Dim x As String Range
  • Dim x () As Boolean
  • Dim x () As Number
  • Dim x () As Currency
  • Dim x () As Date
  • Dim x () As Time
  • Dim x () As DateTime
  • Dim x () As String
  • Dim x () As Number Range
  • Dim x () As Currency Range
  • Dim x () As Date Range
  • Dim x () As Time Range
  • Dim x () As DateTime Range
  • Dim x () As String Range.

    Declares a variable x that can hold data of a type corresponding to the variable declarator used.

Comments
  • A variable declarator must be used to declare a variable before the variable can be used in a formula.
  • Dim specifies a variable with local scope. You can use the keywords Local, Global, and Shared instead of Dim to specify different scopes. Local and Dim are equivalent keywords. See Variable Scope and Variable scopes for Basic syntax.
Related topics

Variable declarations using Dim (Basic syntax)

Declaring array variables (Basic syntax)


Variable declarators for Crystal syntax

Variable declarators let you define a variable by giving the variable a name. Optionally, you can also assign a value to a variable when you declare it by using the Assignment operator. The following are variable declarators in Crystal syntax.

Usage
  • Local BooleanVar x
  • Local NumberVar x
  • Local CurrencyVar x
  • Local DateVar x
  • Local TimeVar x
  • Local DateTimeVar x
  • Local StringVar x
  • Local NumberVar range x
  • Local CurrencyVar range x
  • Local DateVar range x
  • Local TimeVar range x
  • Local DateTimeVar range x
  • Local StringVar range x
  • Local BooleanVar array x
  • Local NumberVar array x
  • Local CurrencyVar array x
  • Local DateVar array x
  • Local TimeVar array x
  • Local DateTimeVar array x
  • Local StringVar array x
  • Local NumberVar range array x
  • Local CurrencyVar range array x
  • Local DateVar range array x
  • Local TimeVar range array x
  • Local DateTimeVar range array x
  • Local StringVar range array x.

    Declares a local variable x that can hold data of a type corresponding to the variable declarator used.

    Local variables retain their value only for the given evaluation of the formula in which they occur.

Comments
  • A variable declarator must be used to declare a variable before the variable can be used in a formula.
  • Local specifies a variable with local scope. You can use the keywords Global, and Shared instead of Local to specify different scopes. You can also omit the scope keyword and start the variable declaration with the type name. This is the same as declaring a Global variable. See Variable Scope and Variable scopes for Crystal syntax.
Related topics

Variable declarations (Crystal syntax)

Declaring array variables (Crystal syntax)


Scope operators

The scope of a variable is an attribute of that variable specifying where you can use or reference it, e.g., within the same formula where it is defined, or within and outside of the formula where it is defined.

Variable scopes for Basic syntax

Variable scopes for Crystal syntax


Variable scopes for Basic syntax

Declaring a scope for your variable regulates its availability through different parts of your report. See Variable declarations using Dim and Variable Scope (Basic syntax).

The variable scopes available are:

  • Dim
  • Local
  • Global
  • Shared.

Dim specifies a variable with local scope. Local and Dim are equivalent keywords.

Related topics

Variable overview (Basic syntax)


Variable scopes for Crystal syntax

Declaring a scope for your variable regulates its availability through different parts of your report. See Variable Scope (Crystal syntax).

The variable scopes available are:

  • Global
    The variable is available to formulas throughout the entire current report.
  • Shared
    The variable can be shared with a subreport as well as the entire current report.
  • Local
    The variable is specific and can only be used in the formula in which it is defined.

To use variable scopes you add the scope that you want to declare with your variable at the beginning of your variable declaration statement. You can also omit the scope keyword and start the variable declaration with the type name. This is the same as declaring a Global variable.

Examples

NumberVar Amount;

Declares a global variable named Amount that can hold any value of an integer or decimal data type.

Global NumberVar Amount;

Declares a global variable named Amount that can hold any value of an integer or decimal data type. This variable would be available to formulas throughout the current report

BooleanVar Outstanding;

Declares a global variable named Outstanding that can hold a TRUE or FALSE value.

Shared BooleanVar Outstanding;

Declares a shared variable named Outstanding that can hold a TRUE or FALSE value. This variable would be available in both the main report and any subreports contained within the main report.

StringVar LastName := "Adams";

Declares a global variable named LastName that can hold a string value and assigns the string "Adams" to that variable.

Local StringVar LastName : = "Adams";

Declares a local variable named LastName that can hold a string value and assigns the string "Adams" to that variable. This variable would be available only within the formula which it was declared.

Comments
  • Your variable declaration statement is used to set aside a block of memory to hold the value assigned to the variable, and to assign a default value to that memory block. The default value assigned depends on the data type stored by the particular variable declarator used and on whether or not a value was assigned when the variable was declared.
  • A variable declared in two formulas uses the same block of memory (that is, it refers to the same value.) For example:

//Formula #1
NumberVar x;
x:=5

//Formula #2
NumberVar x;
x:=x+15

x now has the value of 20.

Related topics

Variable declarations (Crystal syntax).


Expression separator

Crystal syntax.

Operator (Symbol/Word)

;

Usage

1+1; "abc"

1+1 and "abc" are two different formula expressions in a multiple expression formula. The semicolon between the expressions specifies where one expression ends and the next one begins. Without the semicolon, the two expressions would be treated as an individual expression.

Comments

This operator is used in only Crystal syntax to separate consecutive expressions. In Basic syntax, a line break or a colon is used to separate consecutive statements.

Related topics

Expressions


Constants

These constants can be used in the formula language with:

  • date functions
  • conditional date formatting
  • conditional font formatting
  • text interpretation in the Crystal Report Designer.
Constants used with Date functions

Day of Week constants

First Week of Year constants

Constants used in conditional formatting formulas

Day of Week enclosure constants

Font-formatting constants

Text Interpretation constants

Mathematical constants

Text Interpretation constants


Day of Week constants

The following constants are defined with the corresponding numeric values. You may use them with date functions which accept firstDayOfWeek as a parameter:

Constant | Description
crUseSystem | 0 (Use the NLS API setting.)
crSunday | 1
crMonday | 2
crTuesday | 3
crWednesday | 4
crThursday | 5
crFriday | 6
crSaturday | 7


First Week of Year constants

The following constants are defined with the corresponding numeric values. You may use them with date functions that accept firstWeekOfYear as a parameter:

Constant | Value | Description
crUseSystem | 0 | Use the NLS API setting.
crFirstJan1 | 1 | Start with week in which January 1 occurs (default).
crFirstFourDays | 2 | Start with the first week that has at least four days in the new year.
crFirstFullWeek | 3 | Start with first full week of the year.


Day of Week enclosure constants

The following constants are defined to support international formatting of day of the week, such as enclosing the day of the week in round or square brackets, or not enclosing it.

Constant | Description
crDayOfWeekNotEnclosed | Do not enclose the day of a week in a Date or DateTime field with brackets.
crDayOfWeekInParentheses | Enclose the day of a week in a Date or DateTime field with round brackets. This is the default with English fonts.
crDayOfWeekInFWParentheses | Enclose the day of a week in a Date or DateTime field with full-width round brackets which are available in Japanese fonts.
crDayOfWeekInSquareBrackets | Enclose the day of a week in a Date or DateTime field with square brackets. This is the default with English fonts.
crDayOfWeekInFWSquareBrackets | Enclose the day of a week in a Date or DateTime field with full-width square brackets which are available in Japanese fonts.


Font-formatting constants

Constant | Description
crRegular | Format font in regular type face.
crBold | Format font in bold type face.
crItalic | Format font in italic type face.
crBoldItalic | Format font in bold italic type face.


Text Interpretation constants

The following constants are defined to support importing data which is pre-formatted in Rich Text Format or HTML, and inserting it into a report as string or memo fields.

Constant | Description
crUninterpretedText | Interpret data as plain text.
crRTFText | Interpret data as Rich Text Format data.
crHTMLText | Interpret data as HTML data.


Mathematics constant

crPi - the Mathematical value pi which is 3.14 (if rounded to 2 decimal places).


Parameter Fields

This section explains what parameter fields are and how they can be applied to create a single report that can be used to access different types of data depending on the user's needs.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

Two sample reports installed with Seagate Crystal Reports that contain parameter fields are:

  • Account Statement.rpt
  • Employee Sales.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


Parameter overview

Parameters prompt the user of a report to enter information. Think of a parameter as a question that the user needs to answer before the report is generated. The information users enter, or the way they respond, determines what appears in the report. For example, in a report used by salespeople, there might be a parameter that asks the user to choose a region. The report would return the results for the specific region, instead of returning the results for all of the regions.

By using parameter fields in formulas, selection formulas, and in the report itself, you can create a single report that you can modify whenever your needs change. Parameter fields can also be used in subreports.


Parameter field considerations

There are a number of things to keep in mind when working with parameter fields:

  • Parameter fields support the following data types:

    Boolean: Requires a yes/no or true/false answer.
    Example: Include planned budget numbers in the summary?

    Currency: Requires a dollar amount.
    Example: Display customers with sales over XXXXX.

    Date: Requires an answer in a date format.
    Example: Enter the start and end dates of the quarter.

    DateTime: Requires both date and time.
    Example: Display statistics for 07/04/1999 between 1:00pm-2:00pm.

    Number: Requires a numeric value.
    Example: Enter the customer identification number.

    String: Requires a text answer.
    Example: Enter the region.

    Time: Requires an answer using a time format
    Example: Display the total number of calls from 1:00pm-2:00pm.

  • Parameter field prompting text can be up to four lines long with approximately 60-70 characters per line (depending on character width, up to the 254 character limit). Text over one line in length will automatically word wrap.
  • You can create a pick list for the user to choose the parameter value rather than having them enter it manually.
  • A parameter field does not have to be placed in a report in order to be used in a record or group selection formula. You create the parameter field and then enter it in your formula as you would any other field.


Creating a parameter field

Use the following steps to create a parameter that enables the user to specify a list of customers for a specific country. This procedure is made up of two sets of steps. The first is creating the parameter, and the second is using the Select Expert to incorporate the parameter.

To create a parameter field
  1. Check to make sure your report is open in the Design tab.

    This procedure uses Group.rpt, a sample report that is included with the Seagate Crystal Reports Software.

  2. On the Insert menu, click Parameter Field.

    The Field Explorer appears with Parameter Fields selected.

  3. Click New.

    The Create Parameter Field dialog box appears.

  4. Enter a name for the parameter in the Name field (up to 255 alphanumeric characters).

    This example uses Country.

  5. Enter the desired prompting text in the Prompting Text field (up to 255 alphanumeric characters).

    This is the text that appears in the Enter Parameter Values dialog box when the report is refreshed. This example uses Select a Country.

  6. Use String as the Value Type.

  7. Click Set Default Values.

    The Set Default Values dialog box appears.

  8. Check to make sure the Browse table is set to Customer.
  9. From the Browse field drop-down list, select Country.
  10. Click >> to move all of the countries to the Default Values area.

    This example will enable the user to choose from any of the countries. If you want to limit the selection, move only the countries you would like the user to choose from.

  11. Click OK.

    The Create Parameter Field dialog box appears.

  12. Click OK.

    The Field Explorer dialog box appears with the Country parameter selected.

  13. Click Close.
  14. Drag and drop the Country parameter into your report.


To incorporate the parameter into the selection

  1. On the Report menu, click Select Expert.

    The Choose Field dialog box appears.

  2. Select Country from the Customer table, then click OK.

    The Select Expert appears.

  3. Choose is equal to from the drop-down list.
  4. Choose the parameter from the adjacent drop-down list.

    This example uses {?Country}.

  5. Click OK.
  6. Click the Preview tab.

    The Enter Parameter Values dialog box appears.

  7. Select the country to base the report on.

    This example uses Brazil.

  8. Click OK.

    The Change in Record Selection Formula Detected dialog box appears.

  9. Click Refresh Data.

    The report appears with the information for Brazil.

With parameter fields, you can create a single report that can be customized quickly to meet a variety of needs.


Deleting parameter fields

There are two methods for deleting parameters within a report. The type of parameter you are deleting determines the method you can use.

To delete a parameter that is not used in a formula
  1. On the Insert menu, click Parameter Field.
  2. Click the Parameter to be deleted.
  3. Click Delete.

    A Seagate Crystal reports dialog box appears confirming whether you want to delete the parameter.

  4. Click Yes.

    This parameter is removed from the Parameter Fields: directory and from your report.

To delete a parameter used with the Select Expert
  1. On the Report menu, click Select Expert.

    The Choose Field dialog box appears.

  2. From the drop-down list choose the parameter.
  3. Click Del to delete the parameter.
  4. Close the Select Expert.
  5. On the Insert menu, click Parameter Fields.
  6. Select the parameter.
  7. Click Delete.
To delete a parameter that is used in a formula
  1. Click the Design tab.
  2. Click the Parameter field on the report to be deleted.
  3. Press the Delete key.

Note: If the parameter is used in more than one formula in the report, the parameter field must be deleted from each formula.


Responding to parameter field prompts

Previewing a report for the first time

When you preview a report for the first time, the Enter Parameter Values dialog box appears, prompting you for a value.

  • If you specified a default value when you created the parameter field, the program will use that value unless you specify a new one.
  • If you did not specify a default value, the program will not refresh the data until you supply a new value.

Note: If the parameter is a string value type, without a default value, and nothing is entered into the discrete value field, an empty string appears.


Refreshing report data

When you refresh data from the Preview tab, the Refresh Report Data dialog box appears.

Select the Use current parameter values option to use the current parameter value.

Select the Prompt for new parameter values option to enter a new parameter value. When you select this option and click OK, the Enter Parameter Values dialog box appears.

  • Enter String values exactly as they will appear in the field. If the parameter field allows multiple values, you can enter additional parameter values using the Add.
  • Enter Boolean values using the following format: TRUE or FALSE.
  • Enter Number values exactly as they will appear in the field.
  • Enter Currency values exactly as they will appear in the field.
  • Enter Date values using the following format: Date (Year, Month, Day). For example, Date (1997, 5, 21). To access the calendar, click the drop-down arrow beside the date.
  • Enter Time values using the following format: Time (Hour, Minutes, Seconds AM/PM). For example, Time (4:32:12 PM). You can also select the unit of time and then use the up and down arrows to scroll through the numbers.
  • Enter DateTime values using the following format: Date (Year, Month, Day), Time (Hour, Minutes, Seconds AM/PM). For example, Date (1997, 5, 21), Time (4:32:12 PM). You can also enter DateTime values by using the associated drop-down arrow to access the calendar, and the up and down arrows to scroll through the time.

    Note: The drop-down arrow to access the calendar for dates and the up and down arrows to scroll for times will only be available if you have the correct version (4.70 or later) of comctl32.dll (there is a separate install program for this on Seagate Crystal Reports installation disk).

To use a different value than the default displayed, type a new value in the text box, and click OK.

To use the default value, click OK.

  • If the parameter field is range limited, then you can only enter values within a certain range. The range limit is specified in the Set Default Value dialog box when creating or editing a parameter.
  • If the parameter is a string value type, you can limit the values the user is able to enter by using the length limit option or by using an edit mask to restrict the format.

The program now runs the report using the new value(s) you specified.


Advanced parameter features

There are a variety of ways that parameters can be used within a report. This section covers some of the advanced methods of using parameters. These include:

  • using multiple values
  • applying conditional formatting using parameter fields
  • creating a report title using a parameter fields
  • specifying single or ranges of values
  • incorporating a parameter into a formula
  • defining sort order using parameter fields
  • using the Edit Mask to define entry type and format.
To create a parameter with multiple values
  1. On the Insert menu, click Parameter field.
  2. Click New.
  3. Enter a Name and Prompting text.
  4. Select a Value type.
  5. Select the Allow multiple values check box to enable more than one value to be entered into the parameter.
  6. Click Set default values to determine the type of entries that are allowed to be entered.

    The Set Default dialog box appears.

  7. From the Browse table drop-down list, select the table for the default values.
  8. From the Browse field drop-down list, select the field for the default values.

    The values associated with this table and field appear in the Select or enter value to add: area.

  9. Select the values listed, or create you own, and move them to the Default Values area using the arrow buttons.
  10. Adjust the display, order, and length limit as required.
  11. Click OK.


To apply conditional formatting using parameter fields

Parameter fields can be used to create conditional formatting formulas. You can customize these formulas whenever you refresh the report data. A conditional formatting formula could be used for color-flagging data that meets certain conditions. For example:

  • Sales representatives who sell more than 10% over quota.
  • Customers who have not ordered in the last quarter.
  • Inventory items that have not had any movement in the last month.

If the conditions under which you flag these items never change, you do not need to use parameter fields. You can just use formulas (for text flags) or conditional formatting (for border flags). However, to change the conditions from report to report, you need to use parameter fields in formulas and conditional formatting formulas.

  1. Create the parameter field in the data type you need for the formula.
  2. Create the formula and use the parameter field in place of the fixed value you would normally use.
  3. For example, to be prompted for all the customers whose last year's sales were over a certain value and to print their names in red, then select the Last Year's Sales field and click Object Properties from the Supplementary toolbar.

    The Format Editor appears.

  4. Click the Conditional formula button next to the Color property on the Font tab, and format the field using a conditional formatting formula like this:
If {customer.LAST YEAR'S SALES} > {?SalesTarget} Then
    Red
Else
    Black

Now, when you refresh the data, the program will prompt you for the value that triggers the color flag (known as the threshold value). It then runs the report and flags all the customers that had sales last year above the threshold figure. You can change the figure each time you run the report and the program will flag a different set of Customer Names.

For more information see Conditional formatting functions.


To create a report title using parameter fields

Seagate Crystal Reports allows you to use parameter fields to create a report title that can be changed each time the report is refreshed.

  1. On the Insert menu, click Parameter Field.

    The Field Explorer appears.

  2. Click New.

    The Create Parameter Field dialog box appears.

  3. Type a name for the parameter field in the Name field.
  4. Type in any prompting text you wish in the Prompting Text field.
  5. Select String from the Value Type drop-down list.
  6. Click Set default values.

    The Set Default Values dialog box appears.

  7. To specify a default title, type the desired text into the Select or enter value to add field and click > to add the title to the Default Values area.

    Note: Continue adding titles as required.

  8. Click OK.

    The Create Parameter Field dialog box appears.

  9. Click OK.

    The Field Explorer appears with the new parameter selected.

  10. Place the parameter field in the Page Header section of the report to have the title appear on every page, or in the Report Header section if you want the title to appear on only the first page of the report.

Now, when you refresh the data, the program will prompt you for a report title. If you wish, you can change the title each time you run the report.


To specify single or ranges of values

  1. Select the Discrete value(s) option or the Range value(s) option to specify whether the parameter field will accept a range of values.
  • If you select Discrete value(s), the parameter field will accept single values (rather than ranges of values).
  • If you select Range value(s), then when you are prompted for parameter values, you can enter a start value and an end value, and the report will then display all records within that range. For example, if you enter the values "5" and "10", the range is 5-10, and the report will display all records with values between 5 and 10. This also works for string parameter fields. With a start value of "A" and an end value of "E", the report will display all records within an alphabetical range
    of A-E.

    Note: If the Allow multiple values and the Discrete value(s) options are selected, the parameter field will accept multiple single values. In this case, you can enter more than one value, but these values will be evaluated individually and will not be interpreted as a range. If the Allow multiple values and Range value(s) options are selected, the parameter field will accept multiple ranges.

  2. If applicable, click Set default values to select the Length limit check box to designate the length of the field. If you select Length limit:
  • for a Currency or Number parameter field, the Min Value and Max Value fields appear
  • for a DateTime parameter field, the Start Date-time and End Date-time fields appear
  • for a Date parameter field, the Start Date and End Date fields appear
  • for a Time parameter field, the Start Time and End Time fields appear.


To incorporate a parameter into a formula

  1. Create the parameter.
  2. Check to make sure you are working in the Design tab.
  3. On the Insert menu, click Formula Field.

    The Field Explorer appears.

  4. Click New.

    The Formula Name dialog box appears.

  5. Enter the name of the formula, then click OK.
  6. Create a formula using the parameter field as you would any constant value. For example, rather than creating a formula that hard-codes the country name:

    {customer.COUNTRY} = "USA"

    Use a parameter field instead of "USA".

    {customer.COUNTRY} = {?Country}

    To do this double-click the database field, press =, then double-click the parameter.

  7. Click Save, then Close.

    The Field Explorer dialog box appears. The name of the formula you have just created is highlighted in the Formula list box.

  8. Drag and drop the formula into the report.
  9. Click Close to exit the Field explorer dialog box.
  10. Click Refresh to generate the report.

    A dialog box appears, prompting you for values.


To define sort order using parameter fields

To set the sort order using parameter fields, you need to first create a formula that includes a parameter field and then sort based on that formula. For example, assume that you have a customer list report based on the Customer table. For each customer, you show the Customer Name, City, Region, Country, and Phone Number. You want to be able to sort the report by Country, by Region, or by City, depending on your needs at the time.

  1. Create a parameter field and call it SortField.
  2. In the Prompting Text edit box, enter a prompt similar to this:

Type R to sort by Region or C to sort by City; otherwise, data will be sorted by Country.

  3. Select String from the Value Type drop-down list.
  4. You may want to limit the number of characters the user can type to one. To do this, select the Length Limit check box, and type the numeral 1 into the Max Length text box. Now the parameter field will only accept single-character values. The field will accept "C" as a value, but not "City."
  5. Create a formula similar to this and call it Sort:
If {?SortField} = "C" Then
    {customer.CITY}
Else
    If {?SortField} = "R" Then
        {customer.REGION}
    Else
        {customer.COUNTRY}

This formula prompts for a value for the parameter field {?SortField}. If you enter "C", the formula will sort by the City field. If you enter "R" it will sort by the Region field. If you enter anything else, or do not enter anything at all, the formula will sort by the Country field.

For more information see If statements.

  6. Place the formula in the Report Header section of the report and select Suppress in the Section Expert so that it does not print.
  7. Click Sort Records.
  8. Choose your formula.

Now when you run the report, the program will prompt you for a sort field, the formula will return a value based on your selection, and the sort facility will use that value as your sort field.


To define entry type and format using the Edit Mask

  1. On the Insert menu, click Parameter Field.
  2. Click New.
  3. Enter the Name, Prompting text, and Value type.
  4. Click Set Default values.
  5. For a string parameter field that you are setting the default values for, you can choose to enter an Edit Mask in the Edit Mask field, rather than specifying a range. An Edit Mask can be any of a set of masking characters used to restrict the values you can enter as parameter values (the Edit Mask also limits the values you can enter as default prompting values).

    You can enter any of the following masking characters, or any combination of them:

      • "A" (allows an alphanumeric character and requires the entry of a character in the parameter value)
      • "a" (allows an alphanumeric character and does not require the entry of a character in the parameter value)
      • "0" (allows a digit [0 to 9] and requires the entry of a character in the parameter value)
      • "9" (allows a digit or a space, and does not require the entry of a character in the parameter value)
      • "#" (allows a digit, space, or plus/minus sign, and does not require the entry of a character in the parameter value)
      • "L" (allows a letter [A to Z], and requires the entry of a character in the parameter value)
      • "?" (allows a letter, and does not require the entry of a character in the parameter value)
      • "&" (allows any character or space, and requires the entry of a character in the parameter value)
      • "C" (allows any character or space, and does not require the entry of a character in the parameter value)
      • ". , : ; - /" (separator characters). Inserting separator characters into an Edit Mask is something like hard coding the formatting for the parameter field. When the field is placed on the report, the separator character will appear in the field object frame, like this: LLLL/0000. This example depicts an edit mask that requires four letters followed by four numbers.
      • "<" (causes subsequent characters to be converted to lowercase)
      • ">" (causes subsequent characters to be converted to uppercase)
      • "\" (causes the subsequent character to be displayed as a literal). For example, the Edit Mask "\A" would display a parameter value of "A." If the Edit Mask is "00\A00," then a valid parameter value would consist of two digits, the letter "A," and then two additional digits.
      • "Password". Allows you to set the Edit Mask to "Password," you can create conditional formulas specifying that certain sections of the report become visible only when certain user passwords are entered.

        Note: Some of the Edit Mask characters require that you enter a character in their place (when entering a parameter value), while others allow you to leave a space, if needed. For example, if the Edit Mask is 000099, you can enter a parameter value with four digits, five digits, or six digits, since the '9' Edit Mask character does not require the entry of a character. However, since '0' does require such an entry, you could not enter a parameter value with less than four digits.

  6. Enter the default prompting values by adding to or highlighting values on the "Select or enter value to add" list and using the Add (>) and Add All (>>) buttons to add these values to the Default Values list. You can use the Remove (<) and Remove All (<<) buttons to remove prompting values from the list. The items you add appear in a drop-down list on the Enter Parameter Values dialog box with the default prompting values you specify.
  7. When you have more than one item in the Default values list box, the Allow Editing of default values check box appears. This check box is selected by default to specify that you can edit or enter new values when prompted for parameter values. Select or clear this check box as needed.

    Note: This check box is inactive until you enter at least two default prompting values.

  8. Click OK.

    The Create Parameter Field dialog box appears.

  9. Click OK.

    The Field Explorer appears with the parameter selected.

  10. Drag and drop the parameter into the report.


Subreports

A subreport is a report within a report. With subreports, unrelated reports can be combined into a single report. You can coordinate data that otherwise cannot be linked and present different views of the same data in a single report. This section shows you how to create and use subreports.


Sample Reports

The samples installed with Seagate Crystal Reports give you an idea of the different types of reports that can be created and how they look in the Report Designer.

The sample reports installed with Seagate Crystal Reports that contain subreports are:

  • Customer Profile.rpt
  • Sales With OnDemand Sub1.rpt
  • Sales With OnDemand Sub2.rpt

Sample reports are located in the Crystal Reports directory under \Samples\Reports.

Additional Sample reports are available from Seagate Software's Community web site:
http://community.seagatesoftware.com/samples/default.asp


What are subreports?

A subreport is a report within a report. The process for creating a subreport is similar to the process of creating a regular report. A subreport can have most of the characteristics of a report, including its own record selection criteria. The only differences between a subreport and a primary report are that a subreport:

  • is inserted as an object into a primary report; it cannot stand on its own (although a subreport can be saved as a primary report)
  • can be placed in any report section and the entire subreport will print in that section
  • cannot contain another subreport.

There are four instances in which a subreport would typically be used:

  • To combine unrelated reports into a single report. See Combining unrelated reports by using subreports.
  • To coordinate data that cannot otherwise be linked. See Using subreports with unlinkable data.
  • To present different views of the same data within a single report. See Showing different views of the same data in a report.
  • To perform one-to-many lookups from a field that is not indexed on the lookup field. See One-to-many links.


Unlinked vs. linked subreports

Unlinked

Unlinked subreports are free-standing; their data is not in any way coordinated with the data of the primary report.

In unlinked subreports, there is no attempt to match up the records in one report with records in the other. An unlinked subreport does not have to use the same data as the primary report; it can use the same data source or a different data source entirely. In addition, the subreport is not limited to reporting on a single table. An unlinked subreport can be based on a single table or on multiple tables. Regardless of the underlying data sources, the reports are treated as unrelated.

Linked

Linked subreports are just the opposite; their data is coordinated. The program matches up the records in the subreport with records in the primary report. If you create a primary report with customer information and a subreport with order information and link them, the program creates a subreport for each customer and includes in that subreport all the orders for that customer.


How subreport linking works

When you link a subreport to a primary report, the program creates the link by using a parameter field.

When a subreport link field is selected, the program creates:

  • a parameter field in the subreport which is then used to retrieve values passed to it by the primary report
  • a record selection formula for the subreport using the parameter field
  • the selection formula limits the subreport to those records in which the link field is equal to the parameter field value.

When the report is run, the program finds the first primary field record it needs and passes the value in the link field to the parameter field in the subreport. The program then creates the subreport with record selection based on the parameter field value. Here is an example:

  • You create a report that shows customer data and a subreport that shows order data and then you link the two reports using the Customer ID field.
  • When you run the report, the program finds the first customer record it needs and passes the Customer ID value from that record to the subreport parameter field.
  • The program runs the Orders subreport. Since the subreport selection formula selects only those records in which the Customer ID value is equal to the parameter field value, and since that parameter field value is equal to the Customer ID in the first record in the primary report, the subreport contains only those records that have the same customer ID. Namely, those records that are orders for the first customer.
  • When the subreport is finished, the program locates the second record it needs in the primary report, prints the customer data, and then passes this customer's ID number to the parameter field.
  • The program then runs a subreport including only those order records for the second customer.
  • The process continues until the report is finished.
  • All of this parameter field manipulation takes place behind the scenes. You simply pick the fields that will link the primary report with the subreport and the program does the rest. The values are passed without the parameter field prompting you for a value.

Note: If you have a linked subreport and you click the Print Preview button on the Standard toolbar (from the Subreport Design Tab), the program runs the subreport on its own, without waiting to receive a parameter field value from the primary report and without evaluating the tab text formula. In this case, the program displays the Enter Parameter Values dialog box and prompts you for a value.

The value entered in the drop-down box is the value the program uses to run the subreport.


Database links vs. subreports in one-to-many situations

When two tables in a report have a one-to-many relationship, the program retrieves the data in different ways depending on:

  • data source
  • index situation
  • record selection criteria
  • whether you are creating a single report based on linked tables or a primary report that contains a subreport.

When you are considering whether to use a subreport or linked tables, you need to understand the ramifications of each. These issues are discussed fully in Performance considerations in one-to-many links.

As a general rule, if you have:

  • indexed tables
  • linked indexed fields
  • range limiting record selection criteria based on the indexed fields

the program needs to read the same number of records whether you are linking tables in a single report or using subreports. Since each subreport is run as a separate report, linked tables may have a performance advantage. See Indexed tables.


Inserting subreports

  1. On the Insert menu, click Subreport.

    The Insert Subreport dialog box appears.

  2. To choose an existing subreport, click Choose a report and type the name. If you do not know the name, click the Browse button and locate it in the dialog box that appears.

    To create a new subreport, click Create a subreport and type a name. If you would like assistance in creating the subreport, click the Report Expert button.

  3. Choose On-demand subreport to have the ability to retrieve the data on the subreport when needed. Otherwise, all the subreport data will appear with the report.
  4. Click OK.

    The program displays an object frame.

  5. Move the frame where you want it to appear in the report and click once to place it.

    If you imported the subreport, the program creates a Subreport Design tab, which is labeled with the subreport name.

      • To edit the report, click the Subreport Design tab and make your modifications.
      • If you do not want to edit the report, you are finished.

    If you are creating a new subreport, the program creates a Subreport Design tab labeled with the subreport name.

        • To edit the subreport further, after exiting the Report Expert, click the Subreport Design tab and finish modifying the subreport as you would with any other report.
        • If you do not want to edit the report, you are finished.

  6. Click the Preview tab to see your report.
  7. If you chose the On-demand subreport option, click the subreport preview tab to see your subreport.

    This tab is labeled with the name of your subreport.

For information about creating a custom caption for the Subreport Preview Tab, see Adding captions to on-demand subreports.


Previewing subreports

There may be times when you want to preview a subreport on its own instead of previewing it as a part of the main report. For example, you may want to preview the subreport in order to view and analyze the data for a particular set of parameter values.

To preview a subreport
  1. Click the subreport design tab.

    This tab is labeled with the name of your subreport.

  2. Click Print Preview on the Standard toolbar.

    The program displays a preview of the selected subreport.


Saving a subreport as a primary report

You may find it advantageous to save a subreport as a primary report for the sake of distributing the information to a variety of audiences. For example, the primary report containing the subreport may be relevant for a stockholders meeting at the end of the fiscal year; however, the data contained in the subreport may be relevant for everyday use by your managers. In such cases, it is easy to save a subreport as a primary report.

To save a subreport as a primary report
  1. In the Design tab, right-click the subreport and click Save Subreport As from the shortcut menu.

    The Save As dialog box appears.

  2. Highlight the appropriate directory in the list box.
  3. Type a new name for the subreport.
  4. Click Save.

    The program saves the subreport as a primary report so that you can open it separately when necessary.


Updating subreports

In order to maintain the most up-to-date subreports, you may want to re-import a subreport automatically when opening the main report. Re-importing is available for subreports that were created from a report file.

Re-importing not only updates the data, but updates the formatting, grouping, and structure of the subreport if any changes have been made. If you change the report the subreport was originally based on, you can have these changes reflected in the report containing the subreport.

You can either globally specify that all subreports should be re-imported, or set the automatic re-import for an individual subreport.

To globally update subreports when loading a main report
  1. On the File menu, click Options.
  2. In the Options dialog box, click the New Report tab.
  3. Click Re-import Subreports When Loading Reports.
  4. Click OK.

    Any subreport will be updated when its main report is opened and refreshed.

To update a specific subreport when loading a main report
  1. On the Design tab, from the Format menu, click Format Subreport.
  2. In the Format Editor dialog box, click the Subreport tab.
  3. Click Re-import when loading.

    The current subreport will be updated when the main report is opened and refreshed.

Manually updating subreport data

You can update your subreport data at any time.

  1. On the Design tab, right-click the subreport.
  2. Click Re-import subreport from the shortcut menu.
  3. Click Yes to update the subreport data.


Linking a subreport to the data in the primary report

Frequently, the data in a subreport supplements the data in the primary report. You might, for example, have customer data in a primary report and then use subreports to show the orders for each customer.

In such cases, you will need to coordinate the data in the primary report with the data in the subreport so that the orders in each subreport match up with the correct customer.

To do this, you need to specify a field that is common to both the subreport and the primary report. With the Subreport Links dialog box, you create a link between the two common fields. Seagate Crystal Reports uses the link to match up records from the primary report to those in the subreport. The link makes certain that the "orders" data in the subreport sits on the same row as the corresponding "customer" data in the primary report.


To link a subreport to the data in the primary report

  1. If you are creating a new subreport or importing an existing report as a subreport, from the Insert menu, click Subreport. Choose or create a report and click the Link tab.

    - or -

    If you have already placed a subreport in the primary report, but did not create a link at setup, navigate to the Subreport Links dialog box by choosing Subreport Links from the Edit menu.

    The Subreport Links dialog box appears.

  2. Choose the subreport you want to link from the For subreport list (if it is not already selected).
  3. Select the field you want used as a link field in the primary (containing) report from the Available fields list.
  4. Click the arrow (>) button.

The field is added to the Field(s) to link to list box, and is now selected as a link field.

  5. Repeat steps 3 and 4 for each additional link, as desired.
  6. Use the Field link section (which will only appear if you have selected a link field) to set up the link for each link field:
      • select the field you want linked to the primary report from the Subreport parameter field to use,
      • select the Select data based on field check box on and select a field from the adjacent drop-down list to organize the subreport data based on a specific field (this is the quick equivalent of using the Select Expert). If nothing is specified here, the subreport will adopt the organization of the primary report.
  7. Click OK.

When you run the report, the program will coordinate the data in the primary report with the data in the subreport.

Note: The field type of the Containing Report field determines which subreport fields are visible. Because the Report Designer reads dates as either strings, dates, or date/time fields, you must make sure your subreport parameter field type matches the field type set up in Report Options in the main report for the field you want linked.


Linking a subreport to the main report without modifying the selection formula

Seagate Crystal Reports uses a parameter field mechanism for linking subreports to main reports.

When linking a main report field that is not a parameter field to a subreport field, the program:

  • automatically creates a parameter field to complete the link
  • modifies the subreport record selection formula to select those records in which the subreport field is equal to the parameter field value.

The need for a parameter field is implied; it is called an "Implicit Link" situation.

At times, you may wish to use a linked parameter field in a subreport without using it as part of the selection formula for the subreport. For instance, you may want the main report to pass in a summary value that can be used in calculations by the subreport, or you may want the main report to pass in the title of the subreport.

When you link a field in the main report to a parameter field that you have created in the subreport, the program:

  • checks the link you have specified
  • does not create any additional parameter fields
  • does not modify the subreport record selection formula.

Specifying a link is called an "Explicit Link" situation.

To link a subreport to a main report without modifying the selection formula
  1. Create a parameter field in the subreport.
  2. Link a field in the main report to that parameter field.


Combining unrelated reports by using subreports

At times, you may wish to combine unrelated reports into a single report. For example, you may want to create a single report that presents:

  • sales grouped by sales representative
  • sales grouped by item.

While both reports deal with sales data, there is no real linear relationship between the reports.

Subreports can be used to combine unrelated reports into a single report like this. While the reports could be based on the same data set, they do not have to be. They could each be based on entirely different data sets.

Each of these reports is free-standing; the data in any of the reports is not linked in any way to data in another report. This is the easiest of the subreport options to work with.


Combining two unrelated reports

  1. Create the report you want printed first as the primary report.
  2. Import an existing report for use as a subreport or create a new subreport.

  3. Place the subreport into the Report Footer and it will print immediately after the primary report.

Combining three or more unrelated reports

  1. Create the report you want printed first as the primary report.
  2. Import or create each of the other reports you want to use as subreports.
  3. Use the Section Expert to insert enough Report Footer sections to match the number of subreports that you are using.

    For example, if you want to use three subreports, insert two new Report Footer sections so that you have a total of three Report Footer sections.

  4. In Report Footer A, place the subreport you want printed immediately after the primary report. In Report Footer B, place the subreport you want printed next, and so forth.

    The primary report will print first and then the subreports in the order that you placed them in the report.

    Note: Subreports can be placed side-by-side in the same Report Footer section. They will print next to each other at the end of the report.

  5. Place the subreports into the Report Footer sections and they will print sequentially after the primary report.
Related topics

Working with sections.


Using subreports with unlinkable data

Tables can be linked in a report as long as the following criteria are met:

  • the link fields are both database fields
  • the link fields contain similar data
  • the link fields are the same length
  • the link field in the link to (lookup) table is indexed (PC databases only).

Linking tables is rarely a problem. However, there are some circumstances in which you cannot coordinate data from different tables because the data does not meet the linking criteria.

For example, linking to or from a formula field, or linking two unindexed tables cannot be done in a single report. Subreports must be used.


Linking to/from a formula field

There are situations in which you may need to link to or from a formula (calculated) field. For example, an employee ID could be an 11 character value that consists of a two-character department code followed by the employee's nine-character Social Security Number (for example, HR555347487).

The formula language makes it easy to extract the Social Security Number from this field:

{employee.EMPLOYEE ID} [-9 to -1]

- or -

{employee.EMPLOYEE ID} [3 to 12]

For the value HR555347487, either formula would return the value 555347487.

While the return value is a valid Social Security Number, the fact that it comes from a formula prevents you from using the field to link to a Social Security Number field in another table. You can report on and coordinate the values in the two tables, however, by using a subreport.

To link to/from a formula field
  1. Create the primary report using a table that includes the Social Security Number field.
  2. Create (or import) a subreport using the formula that extracts the Social Security Number from the Employee ID field (for this example, {@EXTRACT}).

    See Inserting subreports.

  3. Place the subreport where you want it to appear in the primary report.
  4. Link the subreport to the primary report by linking the Social Security Number field in the primary report ({file.SSN}) to the formula that extracts the number in the subreport ({@EXTRACT}). See Linking a subreport to the main report without modifying the selection formula.


Linking unindexed tables

When using PC (not SQL or ODBC) databases, the link field in the lookup database needs to be indexed in order to create a valid link. You can not link the tables in a single report when two tables contain related data yet neither is indexed on the field which you want to use as a link field, or when the primary table is indexed but the lookup table is not. You must use subreports if you want to coordinate the data in both tables.

Note: It is important to note that linking unindexed tables or linking from an indexed primary table to an unindexed lookup table may cause inefficient reporting. If your data set is large, this kind of report will take considerable time to run. Use this technique only if you do not have other options.

To link unindexed tables
  1. Create the primary report.
  2. Create (or import) the subreport and insert it into the primary report.

    See Inserting subreports.

  3. Use the unindexed fields (or the indexed field in the primary table and the unindexed field in the lookup table) to link the subreport to the primary report. See Linking a subreport to the data in the primary report.


Creating an on-demand subreport

On-demand subreports can be especially useful when you want to create a report that contains multiple subreports. In this case, you can choose to have these subreports appear only as hyperlinks.

The actual data is not read from the database until the user drills down on the hyperlink. This way only data for on-demand subreports that are actually viewed will be retrieved from the database. This makes the subreports much more manageable.

Note: Data for an on-demand subreport is not saved unless the subreport is actually open in a preview window.

To create an on-demand subreport
  1. Place an ordinary subreport in your primary report.
  2. Click the Object Properties button on the Supplementary toolbar.

    The Format Editor dialog box appears.

  3. Click the Subreport tab and select the On-demand subreport check box on.
  4. Click OK.


Adding captions to on-demand subreports

To further organize a report, captions can be created for the Subreport Preview tab and for the placeholder frame of an on-demand subreport.

Captions are written by using formulas. Both placeholder frame captions and Subreport Preview tab captions can include field names from the main report.

Note: Placeholder frame captions only apply to on-demand subreports, while tab text captions apply to both on-demand subreports and regular subreports. Since the data from a regular subreport is visible on the Preview tab, there is no need for a frame caption when you format a regular subreport.

A tab text caption replaces the subreport file name caption on the Subreport Preview tab.

To add a caption
  1. Select the subreport and click the Object Properties button on the Supplementary toolbar.

    The Format Editor dialog box appears.

  2. Click the Subreport Tab.
  3. You can enter either an on-demand subreport caption or a tab text caption by clicking the appropriate Formula button and opening the Format Formula Editor.
  4. Enter your formula in the Formula text box.

    Crystal syntax formula example:
    "More Information About " + {Customer.Customer Name}

    Basic syntax formula example:
    formula = "More Information About" + {Customer.Customer Name}

    Using the Xtreme.mdb sample database, these formulas would give you a caption like "More Information About Pathfinders" or "More Information About Rockshocks for Jocks".

  5. Click Check to check the formula for errors. If the program finds an error, it will prompt you with a message box detailing the nature of the error.
  6. After fixing any errors, click Save and Close.
  7. Click OK to return to the report.

Note: A tab text formula is only evaluated when you drill-down on a subreport. If you preview a subreport separately from the primary report, the formula will not be evaluated.


Showing different views of the same data in a report

Subreports can be used to provide a different view of the data in the primary report. For example, assume you want to show summary values at the top of a report and details at the bottom, like this:

This can be done in a variety of ways. The two easiest methods are:

  • By creating the summary report as the primary report and the details report as the subreport. In this method, the details subreport would be placed in the Report Footer section.
  • By creating the details report as the primary report and the summary report as the subreport. In this method, the summary report would be placed in the Report Header section.

Use the appropriate link fields to link the report and coordinate the data.


Understanding Databases

This section describes the essentials you'll need to know to understand database design and use. After describing relational databases (including those from ODBC data sources), indexing, and table linking, the section introduces the concepts of server-side processing (pushing report processing to the server level) and field mapping (re-establishing report and database field mappings after a database changes). Finally, the section focuses on common database-related tasks such as changing a database driver and creating an ODBC data source.


Databases overview

Though there are hundreds of Database Management Systems (DBMS) available, Seagate Crystal Reports eliminates many of the differences once it connects to the actual database files. The process of working with database files, tables, fields, and records is much the same, regardless of the actual type of data being accessed.

This section discusses several concepts and tasks common to working with database files. Using database aliases, locating moved or renamed database files, working with indexed tables, and linking tables are subjects common to anyone who designs reports in Seagate Crystal Reports. Using SQL and SQL databases, is especially important for anyone who accesses data in SQL databases and other database formats that are accessed through ODBC.


Relational database basics

The most popular architecture for database files used in the corporate world is based on the relational model. Applications that allow you to create databases with the relational model are, therefore, often referred to as Relational Database Management Systems (RDBMS).

In a relational database, data is organized in a system of rows and columns. The rows are called records, and the columns are called fields. Each record contains a collection of related data, all information relating to a specific customer, for example. Each field refers to a common type of data that exists in all records, the names of the customers, for example. Records and fields are stored in a database table.

Often, data in two different tables can be related by a common field. For example, a Customers table will have a Customer ID for each customer, and an Orders table will have the Customer ID of each customer who placed an order, demonstrating a relationship between tables. The two tables can be linked by a common field see Linking tables.


Aliases

For a variety of reasons, database names and locations get changed. If you create a report, then change the name or location of a table or file, the Report Designer must be able to find the new name or location. This is especially important when you create formulas in your report that access a table that has been renamed or moved. To fix the reference for a single field would not be difficult, but to find every formula that uses that field could be a difficult and time consuming task.

To solve this problem, the Report Designer uses aliases to refer to database tables and files. Aliases are pointers, internal devices that tell the program where it should look for a database field. Now, if you change the name or location of the database, you simply reset the pointer. See Locating files. The name of the alias does not change, so your formulas are not affected. The report designer looks to the alias for the location and name, goes to the new location for the database field, and executes the formula without a problem.

The Report Designer automatically assigns default alias names to database tables when you first select the table or file. By default, an alias matches the original name of the table. In databases where the database table is a separate file (for instance, dBASE), the name of the database file is used without the file name extension. For example, if you are using the dBASE database file Company.dbf, the program will assign a default alias name of Company to the file. You can accept the default alias or assign a new one to the database table.

You can change an alias at any time using the Set Alias command on the Database menu. However, if you have already created formulas in your report using the original alias name, you will need to edit the formulas to use the new alias.


Locating files

When a database file is moved or renamed, Seagate Crystal Reports will not be able to find the data the next time the report is printed. On other occasions, a report may be created on one machine where all of the database data is stored in a certain directory, then the report is copied or moved to another machine that stores the same data in a different directory. In any of these events, you need to verify the location of the database files accessed by the report and reset the alias pointers to the new database location or name.

The Verify Database command on the Database menu checks the alias pointers stored in a report file to verify that the database files expected are located in the indicated directories. If the databases are not found in the specified location, the program notifies you of the discrepancies.

Use the Set Location command on the Database menu to change the alias pointers stored by Seagate Crystal Reports. The Set Location command provides a simple way to indicate the new name or location of database files. In addition, the Set Location command automatically converts your database driver to the data source you have chosen. For example, you can automatically convert a direct access data source to an ODBC data source using the Set Location command. The following guidelines apply:

  • If you are moving only one table, the Set Location command can convert it to the same type or any other type of data source.
  • If you are moving more than one table, the Set Location command can convert all of the tables to the same type of data source. To move more than one table to a different data source, use the Convert Database Driver option.
Related topics

Changing the ODBC data source accessed by a report.


Indexed tables

Creating indexes for database tables can increase the speed of data access and reduce the time it takes for the program to evaluate data. Some DBMS applications automatically index your database tables, while others require that you create an index yourself. For the best report generation performance, make sure each of your database tables has a corresponding index.

Note: Some DBMS applications do not support indexed tables. Refer to the documentation for your DBMS to find out if it supports indexes and how to create them. If your DBMS documentation does not mention indexed tables, it may not support them, and you should link tables based on common fields. The Visual Linking Expert can also help you determine if your tables include indexes.

Indexes organize the records in a relational database table so that data can be located easier. For example, assume you have a table with the following data:

Order# | Customer | Amount
10444 | Allez Distribution | 25141.50
10470 | BG Mountain Inc. | 19164.30
10485 | Sierra Mountain | 8233.50
10488 | Mountain Toad | 24580.50
10495 | SFB Inc. | 7911.80
10501 | La Bomba de Bicicleta | 1956.20
10511 | BG Mountain Inc. | 1683.60
10544 | Sierra Bicycle Group | 19766.20
10568 | Mountain Tops Inc. | 29759.55
10579 | Sierra Bicycle Group | 12763.95

The information in this table is organized according to the Order# field. This is fine anytime you want to look up information in the table based on order numbers. However, what if you want to look up information specific to a certain customer?

Say you want to look up all orders made by Sierra Bicycle Group. The database engine must begin by looking at the first order number in the list and checking to see if the customer name matches the request. If not, it goes to the second order number, and checks that customer name. When an order number is reached that contains the correct customer name, the database engine retrieves the information, then continues to the next order number. Using this technique, both the Order# field and the Customer field must be read for every single record in the table. This takes a long time and a large amount of computer processing effort for examining extensive database tables with thousands, or even millions of records.

Instead, you can create an index for the table based on the Customer field. Such an index might look like this:

Customer | Pointer to Order#
Allez Distribution | 10444
BG Mountain Inc. | 10470
BG Mountain Inc. | 10511
La Bomba de Bicicleta | 10501
Mountain Toad | 10488
Mountain Tops Inc. | 10568
SFB Inc. | 10495
Sierra Bicycle Group | 10544
Sierra Bicycle Group | 10579
Sierra Mountain | 10485

In this index, information is organized by customers, not order numbers. Also, notice that the second column actually contains pointers to specific order numbers in the original table. By using this index, the database engine can search just the information in the Customer column until it finds the customer you are interested in, Sierra Bicycle Group.

For each correct customer entry the database engine finds in the index, it looks up the matching order in the table according to the pointer in the second column of the index. Only the orders for the correct customer are read. Finally, since information in the index is organized according to the customer names, the database engine does not need to continue searching through the index or the table as soon as it finds an index entry that does not match the requested customer.

The advantage of this highly organized search through a database table according to an index is speed. Using indexes speeds up data retrieval and report generation, important factors when reporting on large database files.


Linking tables

You link tables so records from one table will match related records from another. For example, if you activate an Orders table and a Customers table, you link the tables so that each order (from the Orders table) can be matched up with the customer (from the Customer table) that made the order.

When you link, you are using a field that is common to both tables. Seagate Crystal Reports uses the link to match up records from one table with those from the other. In this example, the link assures that the data in each row of the report refers to the same order.

Link from and link to

When you link two tables, you link from one table to another table. The from table is used as a primary table, while the to table acts as a lookup table where records are looked up by the primary table. In a simple link, the Report Designer examines the first record in the primary table and finds all matching records in the lookup table. Once all matches have been found in the lookup table for the first record in the primary table, all matches in the lookup table for the next record in the primary table are found.

Note: Seagate Crystal Reports can link two records based on a partial match of string data. This is called a partial link. To enable partial linking in Seagate Crystal Reports, select the Allow partial text matches check box on the Link Options dialog box. As an example of a partial link, a record with a field value of "Chris" can link to a record with a field value of "Christopher." However, partial linking works only when the value in the lookup table is longer than the value in the primary table. In other words, the value "Chris" can link to the value "Christopher," but the value "Christopher" cannot link to the value "Chris."


Link relationships

When you link records from one table to another table, the records will typically fall under one of two relationship types:

  • one-to-one
  • one-to-many.
One-to-one relationships

In a one-to-one relationship between records in two linked tables, for every record in the primary table there is only one matching record in the lookup table (based on the linked fields). For example, in the Xtreme.mdb database, the Employee table can be linked to the Employee Addresses table based on the Employee ID field in each table. The Employee table contains information about employees at the company, the positions they hold, their salaries, hiring information, etc. The Employee Addresses table contains each employee's home address. There is only one record for each employee in each of these tables. Therefore, if the Employee table is linked to the Employee Addresses table, only one record will be found in the Employee Addresses table for each record in the Employee table. This is a one-to-one relationship.

One-to-many relationships

In a one-to-many relationship between records in two linked tables, for every record in the primary table, there may be more than one matching record in the lookup table, based on the linked fields. In the Xtreme.mdb database, the Customer table can be linked to the Orders table based on the Customer ID field in each table. The Customer table contains information about each customer that has placed an order with the company. The Orders table contains information about orders that customers have placed. Since customers can place more than one order, there may be more than one record in the Orders table for each customer record in the Customers table. This is a one-to-many relationship.


Performance considerations in one-to-many links

The information provided in this section is intended to help you maximize processing time and minimize network traffic when you are running your reports. You will learn about the best ways to use selection formulas and indexes in one-to-many situations to make your reporting more efficient. If you do not use the information in this section, your reports may end up processing dozens or even hundreds more records than necessary.

When a one-to-many situation exists between two database tables and the program matches up records from the tables, there are a number of factors that determine how many records the program reads and evaluates.

The tables that follow show the effects of the different factors on the number of records the program ultimately has to read. The charts are based on these assumptions:

  • Table A contains 26 records (one for each letter in the alphabet).
  • Table B contains 2600 records (100 matching records for every record in Table A).
  • The scenario is to produce a report that finds two specific records in Table A and the 200 records (100+100) in Table B that match those two records in Table A.

    In a best case scenario, the program would only have to read about 200 records to accomplish the task.

    In a worst case scenario the program would have to read about 67,600 records to accomplish the same task.

Note: The performance considerations for data files are different from the considerations for SQL databases. A data file is any non-SQL database that is accessed directly from Seagate Crystal Reports. For the purpose of this discussion, an SQL database is any SQL database accessed directly from Seagate Crystal Reports or through ODBC as well as any other database types that are accessed through ODBC. For a better understanding of the difference between direct access databases and ODBC data sources, see Accessing Data Sources.

Extended descriptions of chart columns

The performance charts use the following columns:

  • Linking or Subreport
    Are you creating a report from linked databases or are you inserting a subreport and binding it to the data in your primary report?
  • Selection Formula
    Does your primary report include a record selection formula that sets range limits on the key (indexed) field in Table A?
  • Index A
    Is Table A on the field you are going to use indexed to match up the records?
  • Index B
    Is Table B on the field you are going to use indexed to match up the records?
  • Reads A
    How many records does the program have to read out of Table A to find the two records it is looking for?
  • For each A reads in B
    How many records does the program have to read in Table B to find the 200 records it is looking for?
  • Total Records Read
    What is the total number of records the program has to process to complete the task?

    PC Data
    Linking/ Subreport Selection Formula Index A Index B Reads A For each A reads in B Total Records Read

    Linking

    No

    Yes or No

    Yes

    26

    100 (26*100)

    2600

    Linking

    Yes

    No

    Yes

    26

    100 (26*100)

    2600

    Linking

    Yes

    Yes

    Yes

    2

    100 (2*100)

    200

    Subreport

    No

    No

    No

    26

    2600 (26*2600)

    67,600

    Subreport

    No

    Yes

    No

    2

    2600 (26*2600)

    67,600

    Subreport

    No

    Yes

    Yes

    26

    100 (26*100)

    2600

    Subreport

    Yes

    No

    No

    2

    2600 (2*2600)

    5200

    Subreport

    Yes

    No

    Yes

    26

    100 (26*100)

    2600

    Subreport

    Yes

    Yes

    Yes

    2

    100 (2*100)

    200

    SQL Data
    Linking/ Subreport Selection Formula Reads A For each A reads in B Total Records Read

    Linking

    No

    26

    100 (26*100)

    2600

    Linking

    Yes

    2

    100 (2*100)

    200

    Subreport

    No

    26

    100 (26*100)

    2600

    Subreport

    Yes

    2

    100 (2*100)

    200


Data file considerations

When working with data files, one-to-many links can occur when you link tables in a single report or when you add a subreport to your report.

Linking data files

When retrieving data from linked data files in one-to-many situations, the program uses the following process:

  • If there is a selection formula, the program parses the selection formula and passes what it can down to the database DLL. This is generally range limit information. Consider the following record selection formula:

    {customer.REGION} in "CA" to "IL" AND
    Remainder ({customer.CUSTOMER ID},2)=0

In this formula, the part before the "and" operator contains range selection criteria for the Region field. The region must fall alphabetically between "CA" and "IL." The program passes this kind of condition down to either the database DLL (for PC data) or the server (for SQL data). See Record Selection.

The second half of the selection formula, however, requires processing that must be done in the Report Engine. It uses a built-in function to manipulate and evaluate a field value and it cannot be done in the database DLL or the server. The program does not pass this condition to the database DLL.

  • If there is an index on Table A, and the range limit selection condition is based on the indexed field ({customer.REGION} in this example), the program goes directly to the record it is seeking in Table A (the first CA record) and reads it.
      • For that record, the program locates the first matching record in Table B, using the Table B index.
      • The program passes this merged record (A+B) back to the Report Designer, which tests the record against the entire selection formula.
      • The program then reads the second matching record and passes the merged record on, and then reads the third matching record, and so on, until it has read all of the matching records.
      • The program then returns to Table A and reads the next record. There is no need to test the record to see if it meets the CA condition; the field is indexed and the records are in alphabetic order. But the program tests the record to see if it goes beyond the "IL" condition (for example, could the next record be from Mississippi or Tennessee?). If the record is still within the specified range, the program begins the matching process again for that record.
      • The program continues the process until it has located all targeted Table A records and the matching Table B records.

        To find two records in Table A and the 100 records in Table B that match the Table A records, the program reads 200 records.

Note: The lookup table in a link (Table B) must always be indexed; otherwise, you will not be able to link the tables.

  • If there is no index on Table A, or if there is an index but the range limit selection condition is not based on the indexed field, the program reads the first record it finds.
      • For that record, the program uses the Table B index to locate the first matching record in Table B.
      • The program passes this merged record (A+B) back to the Report Engine, which tests it against the entire selection formula.
      • The program then locates the second matching record in Table B and passes that merged record back, then the third record, and so on, until it has located, merged, and passed back all the records in Table B that match the first record in Table A.
      • The program then moves on to the next record in Table A and begins the matching and merging process all over again.

        To find two records in Table A and the 100 records in Table B that match the Table A records, the program reads 2600 records.

Subreports and data files

If your primary report is based on Table A, the subreport is based on Table B, and the records are linked, your primary considerations are as follows:

  • The number of subreports that are run by the program is determined by the index and the selection formula situation in the primary report.
      • If Table A is indexed, and if the primary report has a selection formula that passes down range limit conditions for the indexed field, the program runs two subreports.
      • If Table A is not indexed, or if Table A is indexed but the selection formula does not pass down range limit conditions for the indexed field, the program runs 26 subreports.
  • The number of records read for each subreport is determined by the index situation on Table B.
      • If you have an index on Table B, the program will read only the matching records (100) when it runs a subreport.
      • If you do not have an index on Table B, the program will always read every record in Table B (2600) when it runs a subreport.


SQL database considerations

Since indexes are not critical with SQL data, the primary concern with both linked tables and subreports is whether or not there is a selection formula in the primary report that puts range limits on Table A. See Linking data files.

Linked SQL tables

If there are range limit conditions in the selection formula, the program passes those conditions down to the server.

  • If there is a selection formula that puts range limits on Table A, the server locates the records in Table A that satisfy the selection criteria (2), matches them up with the appropriate records in Table B (100), and returns 200 merged records to the Report Engine.
  • If there is no selection formula, or if there is a selection formula that does not put range limits on Table A, the server matches up each record in Table A (26) with the appropriate records in Table B (100), and returns 2600 merged records to the Report Engine.

In either case, the Report Engine will then apply the entire selection formula to the merged records.

Subreports and SQL databases

If you are creating a primary report based on Table A and a subreport based on Table B:

  • The number of subreports that are run is determined by the selection formula situation in the primary report.
      • If there is a selection formula and it passes down range limits on Table A, the program runs a subreport only for those records that satisfy range limit conditions (2).
      • If there is no selection formula, or if the selection formula does not pass down range limits on Table A, the program runs a subreport for every record in Table A (26).
  • The number of records read by each subreport remains the same regardless of whether there was range limit selection on Table A. Each subreport will read only those records in Table B that match each record read in Table A (100).


Performance considerations for all reports

Consideration #1

With both data files and SQL databases, the program parses the entire selection formula and passes down whatever parts of the criteria it is able to translate (pass), wherever they may physically appear in the formula. Thus, if the formula finds criteria it can pass, then criteria that it cannot, then criteria that it can, it passes down the first part, skips the second, and then passes down the third.

  • In the case of data files, the program passes down the criteria that it can to the database translation layer.
  • In the case of SQL databases, the program passes down to the server the criteria that it can in the form of a WHERE clause.

While there are exceptions, as a general rule the program can pass down any part of the record selection formula that compares a field with a constant. Typically, this means that it can pass down any kind of record selection criteria that can be set up in the Select Expert (equal to, one of, less than, greater than, less than or equal, greater than or equal, between, starting with, or like constant).

There are two special selection formula situations that you need to consider. In these situations, the record selection formula includes multiple conditions, some of which can be passed down while others cannot.

  • AND situations
{customer.REGION} = "CA" and
{customer.CUSTOMER ID}[3 to 5] = "777")

In this situation, the program sees that it can pass down the condition before the And operator but not the condition after. Since the only records that will meet the second condition will have to meet the first as well, the program passes down the first condition, retrieves the data set that satisfies the condition, and then applies the second condition only to the retrieved data. The rule for AND situations is that the program passes down whatever conditions it can.

Note: If all of the conditions in an AND situation can be satisfied on the server or in the database DLL, the program passes them all down.

  • OR situations
{customer.REGION} = "CA" or
{customer.CUSTOMER ID}[3 to 5] = "777")

In this situation, the program also sees that it can pass down the condition before the Or operator but not the condition after. Since there are records that can satisfy the second condition without satisfying the first, passing the first condition down does not make any sense because it will retrieve an incomplete data set. In other words, even if it retrieves all the data that satisfies the first condition, it will still have to retrieve all the data in the table(s) before it can apply the second condition in the Report Designer. Thus, instead of duplicating parts of the data retrieval, the program passes nothing down. It retrieves all the data and then runs both tests in the Report Designer. The rule for OR situations is that the program either passes down all the tests, or none of the tests.

Note: If all the tests in an OR situation can be performed on the server or in the database DLL, the program passes them all down.

Consideration #2

To make certain the program can use the index on Table A to enhance performance, make certain:

  • There is a selection formula.
  • There are range limits in the selection formula on the key (indexed) field in Table A.
  • Use Indexes is selected in the Options dialog box.
Consideration #3

If the fields you are using from Table A are not indexed, but there is an indexed field that you can use in your record selection request, use that field. For example, assume that you have three products (Product 1, Product 2, and Product 3) and you want to identify all sales of Product 2 in the U.S. There is no index on the Product field but there is an index on the Order Date field. Since you know that Product 2 did not begin shipping until July of 1995, you can improve speed by limiting your report to orders placed in and after July 1995 using the selection formula. In such a case, the program uses the Order Date index to retrieve only those orders from July 1995 and afterward (a small subset of the entire database) and then searches for the occurrences of Product 2 in that subset, not in the entire database.


The Visual Linking Expert

The Visual Linking Expert lets you easily link two or more tables. When you choose Add Database To Report from the Database menu and select an additional database table, the Visual Linking Expert appears and displays that database table.

The easiest way to link database tables is to select Smart Linking in the Visual Linking Expert. Smart Linking automatically chooses links for your tables based on common fields in tables or indexed fields (if your database supports indexed fields).


Linking indexed tables

When you are linking direct-access database tables, you must link from the primary table to an indexed field in the lookup table. The link field in the primary table can be indexed, but does not have to be. The link field in the lookup table, however, must be indexed.

In addition, the fields used to link two tables must have the same data type. For example, you can link a string field in one table to a string field in another table, or a numeric field in one table to a numeric field in another table, but you cannot link a numeric field in one table to a string field in another table.

Note:

  • Some DBMS applications allow you to convert the field value to another data type in the index. For instance, the field in the table can be numeric, while the index converts the field value to a string. However, if you choose to use that field to link to another table, you must link to a field of the original data type. You cannot link a string value to a numeric field that has been converted to a string in the index.
  • If you are linking tables from two different ODBC data sources, MS SQL Server and Oracle, for example, you can only use string fields to link the tables. String fields are stored in databases in the same manner, regardless of the data source. Other types of values, however, may not be stored the same way in different data sources, so you cannot link different data sources in Seagate Crystal Reports using anything other than string values.
  • When using non-SQL, direct access database types, the only join type that can be used to link two tables is a Left Outer join.
Changing the index used in linking

When using the Smart Linking feature to link tables using a field that is a component of multiple indexes (two or more), Seagate Crystal Reports selects one of the indexes for the link. That index may or may not be the one you want to use. To determine the index in use and to change it, use the Index section of the Link Options dialog box.

To call up the dialog box, use one of the following methods:

  • double-click the link line of interest
  • select the link line of interest and choose Options at the bottom of the Visual Linking Expert
  • right-click the link line of interest and choose Options from the shortcut menu.

The Index section of the Link Options dialog box has two parts:

  • The Index In Use text box.
    This text box displays the index that is currently in use. If you click the arrow, it lists the other indexes that are available for the link, as well as the option No specific index. If you are using an indexed database table and you do not see a particular index that you would expect to see on this list, use the Add Index button.
  • The Fields in Index text box.
    This text box displays the fields that are included in the index that is currently selected in the Index In Use list box.

If you select the No specific index option, the program will select an index for you the next time you print the report to the Preview tab.

Note: Not all DBMS applications support indexed tables. Verify that your database uses indexes before trying to select an index for linking. Refer to your DBMS documentation to find out if your DBMS can use indexes, and to learn how to create them.


Methods of looking up tables (direct access databases)

When a single table is linked to two or more tables, Seagate Crystal Reports needs to know in what order it should look up and link data from the primary table to data in the second, third, etc., lookup table.

Seagate Crystal Reports offers three options for looking up records in two or more lookup tables from a single primary table:

  • Look up both at the same time
  • Look up all of one, then all of others (A to B, A to C)
  • Look up all the combinations of the two files.

Note: These options are not available if you are using data from an ODBC data source.

These options are available only when you have a single table (a primary table) that is linked to two or more lookup tables. The primary table must be the link from table in each of the links. For instance, if you link from the Customer table to the Orders table and from the Customer table to the Credit table, these lookup options are available. However, if you link from the Customer table to the Orders table and from the Credit table to the Customer table, these options are not available.

In this example, for each method demonstrated, three fields from three different linked tables will be shown. In each case, the Customer table is linked to the Credit table and the Orders table. The fields displayed are the Customer Name field from the Customer table, the Amount field from the Credit table, and the Order Amount field from the Orders table. These are not necessarily actual link fields for the tables, but the data in these fields illustrates how data is retrieved using each of the three lookup methods.


Look up both at the same time

For each record in the Customer table, this option looks for a matching record in the Credit table and a matching record in the Orders table. Then it looks for the next matching record in the Credit table and the next matching record in the Orders table, etc. Once it finds all the matching records, it repeats the process with the next record in the Customer table.

Customer Table | Credit Table | Orders Table
Customer Name | Amount | Order Amount
Cyclists Incorporated | ($1088.56) | $1529.70
Cyclists Incorporated | ($1260.12) | $23.50
CyclePath Corp. | ($1958.03) | $49.50
CyclePath Corp. | ($1076.43) | $1702.60
CyclePath Corp. | ($75.04) |
The Great Bike Shop | ($138.98) | $3269.70
The Great Bike Shop |  | $5219.55
The Great Bike Shop |  | $1538.20

Notice that for each line in the report, the value in the Amount field of the Credit table does not necessarily have any connection to the value in the Order Amount field of the Orders table. However, for each record in the Customer table, one record is selected from the Credit table, and one record is selected from the Orders table at the same time.

Also notice that when the Credit table runs out of records for a given record in the Customer table, blanks are left in place of values until all related records from the Orders table are found. The same holds true if the Orders table runs out of records.


Look up all of one, then all of others (A to B, A to C)

For each record in the Customer table, this option looks for all the matching records in the Credit table (Table B) and then looks for all the matching records in the Orders table (Table C). Then it repeats the process with the next record in the Customer table, and continues with the rest of the records.

Customer Table | Credit Table | Orders Table
Customer Name | Amount | Order Amount
Cyclists Incorporated | ($1088.56) |
Cyclists Incorporated | ($1260.12) |
Cyclists Incorporated |  | $1529.70
Cyclists Incorporated |  | $23.50
CyclePath Corp. | ($1958.03) |
CyclePath Corp. | ($1076.43) |
CyclePath Corp. | ($75.04) |
CyclePath Corp. |  | $49.50
CyclePath Corp. |  | $1702.60
The Great Bike Shop | ($138.98) |
The Great Bike Shop |  | $3269.70
The Great Bike Shop |  | $5219.55
The Great Bike Shop |  | $1538.20

Note: If you want Table C data (the Orders table in this example) to appear in the report before Table B data (Credit table), you need to change the links so that the A to C link comes first, followed by the A to B link. You do this in the Visual Linking Expert. To change the order of the links, delete the existing links and set up new links in the desired order.


Look up all the combinations of the two files

For each record in the Customer table, this option looks for a matching record in the Credit table, and then finds all the matching records in the Orders table. Once it finds all the matching records in the Orders table, it repeats the process with the next record in the Credit table, then the next, etc. When it finds matching Orders records for all the Credit records that match the first Customer record, it moves to the next Customer record and repeats the process.

Customer Table | Credit Table | Orders Table
Customer Name | Amount | Order Amount
Cyclists Incorporated | ($1088.56) | $1529.70
Cyclists Incorporated | ($1088.56) | $23.50
Cyclists Incorporated | ($1260.12) | $1529.70
Cyclists Incorporated | ($1260.12) | $23.50
CyclePath Corp | ($1958.03) | $49.50
CyclePath Corp | ($1958.03) | $1702.60
CyclePath Corp | ($1076.43) | $49.50
CyclePath Corp | ($1076.43) | $1702.60
CyclePath Corp | ($75.04) | $49.50
CyclePath Corp | ($75.04) | $1702.60
The Great Bike Shop | ($138.98) | $3269.70
The Great Bike Shop | ($138.98) | $5219.55
The Great Bike Shop | ($138.98) | $1538.20

Note: If you want the program to look up the first matching record in Table C (the Orders table in this example), and then find all matching records in Table B (Credit table), the reverse of the current process, you will need to change your links so that the A to C link comes first, followed by the A to B link. You do this in the Visual Linking Expert. To change the order of the links, delete the existing links and set up new links in the order you want.


SQL join types (ODBC data sources)

Seagate Crystal Reports enables you to specify the type of join you want to use when linking SQL tables. An SQL join indicates how linked fields in two SQL tables are compared when records are read. The SQL Join Type options can be specified in the Link Options dialog box.

Note: When you link fields using SQL joins, no indexed fields are required.

The join types are:

  • Equal [=] join
  • Left Outer [=(+), *=] join
  • Right Outer [(+)=, =*] join
  • Greater Than [>] join
  • Less Than [<] join
  • Greater Than Or Equal [>=] join
  • Less Than Or Equal [<=] join
  • Not Equal [!=, <>] join.


Equal [=] join

The result set from an Equal join includes all the records where the linked field value in both tables is an exact match. In the following example, the Customer table is linked to the Orders table by the Customer ID field. When the program finds a Customer ID in the Orders table that matches a Customer ID in the Customer table, it displays information for the corresponding records in both tables.

SQL uses the following syntax to describe an Equal join:

SELECT Customer.'Customer ID',
    Customer.'Customer Name',
    Orders.'Order Amount'
FROM 'Customer' Customer,
    'Orders' Orders
WHERE Customer.Customer ID =
    Orders.Customer ID

This statement produces the following data:

Customer Table | Customer Table | Orders Table
Customer ID | Customer Name | Order Amount
52 | Allez Distribution | 25141.50
53 | BG Mountain Inc. | 19164.30
53 | BG Mountain Inc. | 1683.60
57 | Hansen MTB Inc. | 15716.40
58 | La Bomba de Bicicleta | 1956.20
60 | Mountain Toad | 24580.50
62 | SFB Inc. | 7911.80
63 | Sierra Bicycle Group | 19766.20
63 | Sierra Bicycle Group | 12763.95
64 | Sierra Mountain | 8233.50


Left Outer [=(+), *=] join

The result set from a Left Outer join includes all the records in which the linked field value in both tables is an exact match. It also includes a row for every record in the primary (left) table for which the linked field value has no match in the lookup table. For instance, you can use a Left Outer join to view all customers and the orders they have placed, but you also get a row for every customer who has not placed any orders. These customers appear at the end of the list with blanks in the fields that would otherwise hold order information:

Customer Table | Customer Table | Orders Table
Customer ID | Customer Name | Order Amount
52 | Allez Distribution | 25141.50
53 | BG Mountain Inc. | 19164.30
53 | BG Mountain Inc. | 1683.60
57 | Hansen MTB Inc. | 15716.40
58 | La Bomba de Bicicleta | 1956.20
60 | Mountain Toad | 24580.50
62 | SFB Inc. | 7911.80
63 | Sierra Bicycle Group | 19766.20
63 | Sierra Bicycle Group | 12763.95
64 | Sierra Mountain | 8233.50
54 | Bicicletas Aztecas |
55 | Deely MTB Inc. |

Note: Left Outer and Right Outer joins are handled differently in the SQL language from other join types. If the database is accessed through ODBC, Seagate Crystal Reports uses ODBC syntax in the SQL statement. If you are connecting to an SQL database directly (not through ODBC), Seagate Crystal Reports uses a syntax native to the database. For more information about what an Outer join looks like in an SQL statement, refer to Microsoft ODBCTM documentation or to the documentation for your SQL database.


Right Outer [(+)=, =*] join

The result set from a Right Outer join includes all the records in which the linked field value in both tables is an exact match. It also includes a row for every record in the lookup (right) table for which the linked field value has no match in the primary table. If you link the Customer table to the Orders table, you get one row in the table for each order a customer has placed, as with an Equal join. You also get a row for every order found that cannot be linked to a customer. Theoretically, this should not happen, but if an inexperienced sales person forgot to assign a customer ID to an order, you can quickly locate that order with a Right Outer join. The resulting table leaves a blank in any of the Customer fields for the order without a customer.

:
Customer Table | Orders Table | Orders Table
Customer ID | Order ID | Order Amount
52 | 6 | 25141.50
53 | 11 | 19164.30
53 | 21 | 1683.60
57 | 4 | 15716.40
58 | 20 | 1956.20
60 | 16 | 24580.50
62 | 19 | 7911.80
63 | 28 | 19766.20
63 | 32 | 12763.95
64 | 14 | 8233.50
 | 25 | 10320.87

Note: Left Outer and Right Outer joins are handled differently in the SQL language from other join types. If the database is accessed through ODBC, Seagate Crystal Reports uses ODBC syntax in the SQL statement. If you are connecting to a SQL database directly (not through ODBC), Seagate Crystal Reports uses a syntax native to the database. For more information about what an Outer join looks like in an SQL statement, refer to Microsoft ODBC documentation or to the documentation for your SQL database.


Greater Than [>] join

The result set from a Greater Than join includes all records in which the linked field value from the primary table is greater than the linked field value in the lookup table. As an example, a company may want to compare the salaries made by all their sales representatives to the salaries made by all their sales managers. The company executives want to make sure no sales representative is making more money than any manager. With this in mind, you can link the SalesRep table to the Manager table by the Salary field in each table using a Greater Than join:

SELECT SalesRep.'Last Name',
    SalesRep.'Salary',
    Manager.'Last Name',
    Manager.'Salary'
FROM 'SalesRep' SalesRep,
    'Manager' Manager
WHERE SalesRep.'Salary' >
    Manager.'Salary'

This SQL statement might produce data similar to this:

SalesRep Table | SalesRep Table | Manager Table | Manager Table
Last Name | Salary | Last Name | Salary
Davolio | $35,000.00 | Fuller | $32,000.00
Davolio | $35,000.00 | Brid | $30,000.00
Davolio | $35,000.00 | Buchanan | $29,500.00
Dodsworth | $48,300.00 | Hellstern | $45,000.00
Dodsworth | $48,300.00 | Fuller | $32,000.00
Dodsworth | $48,300.00 | Brid | $30,000.00
Dodsworth | $48,300.00 | Buchanan | $29,500.00
Dodsworth | $48,300.00 | Martin | $35,000.00
Patterson | $30,000.00 | Buchanan | $29,500.00

In this table, there is no relationship established between sales representatives and sales managers. Since all managers have seniority over all sales representatives, a company might find it necessary to check if any representatives make more money than any managers, evidence of a salary problem that needs to be remedied.


Less Than [<] join

The result set from a Less Than join includes all records in which the linked field value in the primary table is less than the linked field value in the lookup table. Using the Less Than join, you can compare sales representative and manager salaries in a different direction. Once again, the Salary field in each table is used as the link field. This time, though, you link from the Manager table to the SalesRep table using a Less Than join on the linked Salary fields:

SELECT Manager.'Last Name',
    Manager.'Salary',
    SalesRep.'Last Name',
    SalesRep.'Salary'
FROM 'Manager' Manager',
    SalesRep' SalesRep
WHERE Manager.'Salary' <
    SalesRep.'Salary'

This SQL statement produces a slightly different table than that produced by the Greater Than join:

Manager Table | Manager Table | SalesRep Table | SalesRep Table
Last Name | Salary | Last Name | Salary
Fuller | $32,000.00 | Davolio | $35,000.00
Fuller | $32,000.00 | Dodsworth | $48,300.00
Brid | $30,000.00 | Davolio | $35,000.00
Brid | $30,000.00 | Dodsworth | $48,300.00
Buchanan | $29,500.00 | Davolio | $35,000.00
Buchanan | $29,500.00 | Dodsworth | $48,300.00
Buchanan | $29,500.00 | Patterson | $30,000.00
Martin | $35,000.00 | Dodsworth | $48,300.00
Hellstern | $45,000.00 | Dodsworth | $48,300.00


Greater Than Or Equal [>=] join

The result set from a Greater Than Or Equal join includes all records in which the linked field value in the primary table is greater than or equal to the linked field value in the lookup table. The example here is identical to the example for the Greater Than join, except that it uses the Greater Than Or Equal join:

SELECT SalesRep.'Last Name',
    SalesRep.'Salary',
    Manager.'Last Name',
    Manager.'Salary'
FROM 'SalesRep' SalesRep,
    'Manager' Manager
WHERE SalesRep.'Salary' >=
    Manager.'Salary'

This statement might produce data such as this:

SalesRep Table | SalesRep Table | Manager Table | Manager Table
Last Name | Salary | Last Name | Salary
Davolio | $35,000.00 | Fuller | $32,000.00
Davolio | $35,000.00 | Brid | $30,000.00
Davolio | $35,000.00 | Buchanan | $29,500.00
Davolio | $35,000.00 | Martin | $35,000.00
Dodsworth | $48,300.00 | Hellstern | $45,000.00
Dodsworth | $48,300.00 | Fuller | $32,000.00
Dodsworth | $48,300.00 | Brid | $30,000.00
Dodsworth | $48,300.00 | Buchanan | $29,500.00
Dodsworth | $48,300.00 | Martin | $35,000.00
Patterson | $30,000.00 | Brid | $30,000.00
Patterson | $30,000.00 | Buchanan | $29,500.00


Less Than Or Equal [<=] join

The result set from a Less Than Or Equal join includes all records in which the linked field value in the primary table is less than or equal to the linked field value in the lookup table. The example here is identical to the example for the Less Than join, except that it uses the Less Than Or Equal join:

SELECT Manager.'Last Name',
    Manager.'Salary',
    SalesRep.'Last Name',
    SalesRep.'Salary'
FROM 'Manager' Manager',
    SalesRep' SalesRep
WHERE Manager.'Salary' <=
    SalesRep.'Salary'

This SQL statement produces data similar to the following:

Manager Table | Manager Table | SalesRep Table | SalesRep Table
Last Name | Salary | Last Name | Salary
Fuller | $32,000.00 | Davolio | $35,000.00
Fuller | $32,000.00 | Dodsworth | $48,300.00
Brid | $30,000.00 | Davolio | $35,000.00
Brid | $30,000.00 | Dodsworth | $48,300.00
Brid | $30,000.00 | Patterson | $30,000.00
Buchanan | $29,500.00 | Davolio | $35,000.00
Buchanan | $29,500.00 | Dodsworth | $48,300.00
Buchanan | $29,500.00 | Patterson | $30,000.00
Martin | $35,000.00 | Davolio | $35,000.00
Martin | $35,000.00 | Dodsworth | $48,300.00
Hellstern | $45,000.00 | Dodsworth | $48,300.00


Not Equal [!=, <>] join

The result set from a Not Equal join includes all records in which the linked field value in the primary table is not equal to the linked field value in the lookup table. This type of join can be used to find possible combinations of items when a table is joined to itself (a self-join). For example, a company can have a table listing all products they sell. When they decide to hold a sale where their customers buy one item and get the second item half price, they may need a list of all possible two item combinations:

SELECT Product1.'Product Name',
    Product2.'Product Name',
FROM 'Product' Product1
    'Product' Product2
WHERE Product1.'Product Name' !=
    Product2.'Product Name'

In this SQL statement, the Product table is opened twice. The first time, it is given the alias name Product1. The second time, it is given the alias name Product2. Then the Product Name field is used to link from the Product1 table to the Product2 table. This is the same table, but since it has been opened twice using different aliases, Seagate Crystal Reports considers it two separate tables. A Not Equal join is used to link the tables by the Product Name field. As a result, each product is paired with every other product offered, but is not paired with itself:

Product1 | Product2
Product Name (check names) | Product Name
Xtreme Adult Helmet | Xtreme Mtn Lock
Xtreme Adult Helmet | InFlux Lycra Glove
Xtreme Adult Helmet | Roadster Micro Mtn Saddle
Xtreme Mtn Lock | Xtreme Adult Helmet
Xtreme Mtn Lock | InFlux Lycra Glove
Xtreme Mtn Lock | Roadster Micro Mtn Saddle
InFlux Lycra Glove | Xtreme Adult Helmet
InFlux Lycra Glove | Xtreme Mtn Lock
InFlux Lycra Glove | Roadster Micro Mtn Saddle
Roadster Micro Mtn Saddle | Xtreme Adult Helmet
Roadster Micro Mtn Saddle | Xtreme Mtn Lock
Roadster Micro Mtn Saddle | InFlux Lycra Glove

Note: The symbol != is used to represent a Not Equal join, if the ODBC data source driver for the data being accessed supports this symbol. If not, the default symbol <> is used to represent a Not Equal join.


Using SQL and SQL databases

Perhaps the most popular and most powerful database formats are DBMS applications based on the Structured Query Language (SQL). SQL databases usually work over a client/server network architecture, providing an SQL Server to create, store, and manipulate database files, tables, fields and records, and an SQL Client interface allowing workstation users not only to design and work with database files, but also to retrieve useful and meaningful data that will help them in their everyday work.

What is SQL?

SQL is a query language designed for organizing, managing, developing and querying large relational databases over computer networks. SQL is a common language in the Information Science (IS) and Information Management industry. The language has been standardized by the American National Standards Institute (ANSI) and the International Standards Organization (ISO), meaning that there are specific features that must be present in any version of SQL produced by a software company in order for that version to be officially called SQL. Many software vendors add more advanced features to their version of SQL in an effort to improve the language and attract customers, but it must retain the original standards established by ANSI and ISO.

SQL is not a true computer language. It cannot be used to create stand-alone computer applications or operating systems. SQL is often referred to as a sub-language, since it can be used within other languages or applications. Most importantly, the purpose of the SQL language is specific to working with relational databases.

The syntax of the SQL language is built on a system of sending SQL statements to the SQL database server. Each statement is a request to perform a database operation, such as creating a database file, adding tables and fields to a database, adding records to tables, or retrieving data from databases. The SQL server analyzes the SQL statement and performs the required operation. For example, if the statement is a request for data, the server gathers the data and returns it to the client workstation for the user to view.

An SQL query is an SQL statement designed specifically to request data from one or more SQL databases. Some SQL applications require that you type in an SQL query directly using a text editor, while others provide graphical user interfaces that lead you through the process of querying an SQL database. In the latter case, the application must create an SQL statement based on the information you provide. This statement is the actual SQL query, and it is the SQL query that is used to request the data. Seagate Crystal Reports falls into this second category of SQL-compliant applications.

Client/server architecture

One of the most powerful features of SQL DBMS applications is their ability to efficiently use the client/server architecture of a network.

A simple network structure consists of one or more network servers that provide a common location where all users on the network can obtain data and applications. Many network servers also provide network security, automated services such as backing up data, and network resource monitoring to provide the best service possible to all workstations on the network. Because of the high processing demands required by a network server, the computer used as the server is often a high-powered, fast machine that may contain multiple processors, multiple hard drives, and multiple CD-ROM drives.

A network client is a single computer workstation that is used regularly by one or more company employees. A user works on the client and accesses data and applications from the server over the network. Large processing jobs that require a lot of time and resources are handled by the server, and the finished results are sent back to the client. This provides more efficient time management for users because the local workstation has less processing time and more "up" time available to the user.

Many modern computer applications are based on this client/server architecture. A simple client/server application has two parts: a server-based application that is located on a network server machine, and a client-based application that is located on a user's workstation. The server application handles complex, time-consuming, or power-demanding processes, taking advantage of the network server's power and resources, while the client application provides an easy-to-use user interface designed to help get the work done faster and better than it could otherwise be done.

Often, a client/server application will be available with a certain number of seats, depending on the cost of the application. Each seat represents either a single client workstation, or a single client user (depending on the software vendors' specifications) that can be connected to the client/server software. Software vendors often sell additional seats for their applications, each seat coming with a complete set of client application software.

Do not confuse server applications with network server computers. Both are often referred to as servers. However, a server application resides on a network server, taking advantage of the hardware and operating system capabilities of the server machine, while a network server is a physical machine to which network clients are connected by cables or some other connection device.


SQL DBMS

An SQL Database Management System is a common example of a client/server software package. A standard SQL DBMS will include an SQL server application that handles all the actual work of building and working with databases and database data. The DBMS will also include at least one set of SQL client software (one seat) that can connect to the SQL server over your network. SQL client software usually consists of, at the very least, an SQL statement editor that you can use to write and execute SQL statements, and an underlying communications layer that works with the SQL server application over the network.

When you execute an SQL statement, the client software passes the statement to the communications layer, which sends the statement over the network to the server software. The SQL server analyzes the statement, performs the requested operation, and returns any data requested to the client software. If the server returns any data, the client software displays the data to the user.

Stored procedures

In addition to the common relational database attributes (tables, fields, records, etc.) many SQL DBMS systems support stored procedures. A stored procedure is a compiled SQL program consisting of one or more SQL statements. A stored procedure can be used to define an SQL query that you can use over and over again. Furthermore, variables, conditional expressions, and variable arguments can be defined in the stored procedure so that you are prompted to provide information before the procedure is executed.

Since stored procedures can return a result set, they can provide a specific set of data when executed. In fact, Seagate Crystal Reports allows you to execute a stored procedure on an SQL database and use the returned data to design a report. If the stored procedure is designed to prompt a user for information to base its query on, Seagate Crystal Reports will prompt you for that information when you select the stored procedure for your report. See Selecting an SQL stored procedure and changing parameters.

Note:

  • Only one stored procedure can be used per report or subreport (a report containing subreports can have a different stored procedure for the main report and each subreport).
  • Stored procedures cannot be used in combination with other database objects.
  • Linking is not possible for stored procedures.


How does Seagate Crystal Reports use SQL?

When you connect to an SQL database, Seagate Crystal Reports acts as an SQL client application, connecting to your SQL server through your network.

When you design a report that accesses SQL data, Seagate Crystal Reports builds an SQL query. This query can be edited if you know SQL and you feel that the query can be further optimized. If you choose Show SQL Query from the Database menu, the Show SQL Query dialog box displays the SQL query that Seagate Crystal Reports has built.

This SQL query is a representation of the SQL statement that Seagate Crystal Reports sends to the SQL server. By interpreting as much as possible from the report design into an SQL query, Seagate Crystal Reports can off-load much of the report processing onto the server machine. Rather than having to sift through an entire database to find the data you requested, Seagate Crystal Reports lets the server do the sifting and gets back a much smaller set of data, thus reducing the time and resources your workstation must use in order to finish the report.


The SQL language

Since Seagate Crystal Reports uses the SQL language to access client/server databases through ODBC, you can better understand the report generating process by understanding some of the SQL clauses (commands) used:

SELECT

The SELECT clause indicates specific data items to retrieve from the database tables. The item retrieved may be the values in a database field (column), or it may be the result of a calculation performed while gathering the data. For example:

SELECT
    TABLEA.'CUSTNAME',
    TABLEA.'STATE'
DISTINCT

The DISTINCT clause forces the query to retrieve only unique (distinct) sets of data. When using the DISTINCT clause, a row of results will be retrieved only once. The previous SELECT statement can be modified to use the DISTINCT clause:

SELECT DISTINCT
    TABLEA.'CUSTNAME',
    TABLEA.'STATE'
FROM

The FROM clause indicates the sources of the database fields specified in the SELECT clause. FROM lists actual database tables that include the fields and records containing the requested data. The FROM clause generated by Seagate Crystal Reports precedes the name of each table with the alias it uses to identify the table in your report. The following example illustrates the FROM clause used with the SELECT clause:

SELECT
    TABLEA.'CUSTNAME',
    TABLEA.'STATE'
FROM
    'TABLEA' TABLEA
WHERE

The WHERE clause has two purposes:

  • to specify record selection criteria
  • to show how two database tables are joined.

When WHERE is used to specify record selection criteria, it includes a search condition in order to determine which records (rows of data) are to be retrieved. For example:

SELECT
    MYTABLE.'SALESPERSON',
    MYTABLE.'SALESTOTAL'
FROM
    'MYTABLE' MYTABLE
WHERE
    MYTABLE.'SALESTOTAL' < 10000.00

When WHERE is used to specify how two tables are linked, an SQL join operator sits between the two table names. See SQL join types (ODBC data sources).

The following is an example of the WHERE clause joining two tables:

SELECT
    CUSTOMER.'CUST_ID',
    CUSTOMER.'CUST_NAME',
    ORDERS.'AMOUNT'
FROM
    'CUSTOMER' CUSTOMER,
    'ORDERS' ORDERS
WHERE
    CUSTOMER.'CUST_ID' = ORDERS.'CUST_ID'
ORDER BY

The ORDER BY clause specifies that the database records retrieved be sorted according to the values in a specific field. If you do not use the ORDER BY clause, the program retrieves records in the order in which they appear in the original database. If you specify more than one field after the ORDER BY clause, the program sorts the records according to the values in the first field specified, then, within that sort, the program sorts the records by the values in the second field specified, and so on. The following SQL statement uses the ORDER BY clause:

SELECT
    MYTABLE.'COMPANY',
    MYTABLE.'CITY',
    MYTABLE.'STATE'
FROM
    'MYTABLE' MYTABLE
ORDER BY
    MYTABLE.'STATE' ASC,
    MYTABLE.'CITY' ASC

Note: ASC indicates that the values in the field are sorted in ascending order rather than descending order (DESC). Ascending order sorts letters from A to Z and numbers from 0 to 9.

GROUP BY

The GROUP BY clause retrieves a set of summary data. Instead of retrieving the data itself, GROUP BY groups the data and summarizes each group with an SQL aggregate function. The server returns only the summarization information for each group to Seagate Crystal Reports.

For example:

SELECT
    MYTABLE.'STATE',
    MYTABLE.'ZIPCODE',
    SUM (MYTABLE.'SALES')
FROM
    'MYTABLE' MYTABLE
GROUP BY
    MYTABLE.'STATE',
    MYTABLE.'ZIPCODE'


Server-side processing

Server-side processing allows you to set up a report that performs the majority of its processing on the server and pushes only relevant details to your computer.

Server-side processing provides you with a number of benefits:

  • less time connected to the server
  • less memory needed to process the report on your computer
  • lower transfer time from the server to the client.

Here's how server-side processing works: by using SQL pass-through technology to send an SQL statement to the database server and retrieve an initial set of data, Seagate Crystal Reports off-loads much of the data retrieval and sorting work onto the server system, thus freeing up local memory and resources for more important tasks. That is why server-side processing works only for reports that have been sorted and grouped; if a report has not been sorted and grouped (for example, if it is a simple list report), then there is no processing to push to the server. You should also note that server-side processing works only for reports based on SQL data sources (you could not, for example, use server-side processing for a report based on a query, since a query is not an SQL data source).

Keep in mind that in order to perform the grouping on the server, your report must conform to the following conditions:

  • The Perform Grouping on Server option (in the Options dialog box) is enabled. For more information, see Enabling server-side processing.
  • The report uses some form of grouping.
  • The report is at least partially hidden (at the very least, the Details section must be hidden). Since the server will process those sections that are hidden, the greater the portion of the report that is visible, the greater the amount of processing that must take place on the client side. If the Details section is shown, server-side processing will not be possible.
  • In some cases, formula fields must be processed on the client side. If grouping is based on a formula field, or if a formula is used in a summary field, then all the records must be transferred to the client side before the formula can be evaluated. This will increase the amount of time required to run the report. Therefore, you may want to use SQL expressions as an alternative to formulas.

    Note: Formulas used for record selection are an exception and can be pushed down to the server.

  • In order for a report to be processed on the server, any running totals appearing in the report must be based on summary fields (since the data needed for the running totals will be pulled over to the client side).
  • In order for a report to be processed on the server, the report must not contain Average or Distinct count summaries.
  • The report does not contain specified value grouping.

Note:

  • When you drill-down on a hidden section of a report, with the processing being done on the server, connection to the server will be automatically initiated. If the client is disconnected from the server (for example, if you download a report onto your laptop and you work on it from a remote location), then drilling-down on data will produce an error since the database is not available.
  • If you save a report that has been partially processed on the server using the Save Data with Report option, the program will save only those records that have been transferred to the client side. In other words, if you have drilled-down on a hidden section and there is a tab for that data in Seagate Crystal Reports (indicating the data has been transferred), those records will be saved with the report.


How server-side grouping affects the SQL query

When a report pushes most of its processing to the server, this by necessity alters the SQL query. Thus, when the Perform Grouping on Server option is enabled, individual aspects of server-side processing will modify the SQL statement in different ways.

  • If you select Use Indexes Or Server For Speed (in the Report Options dialog box), the program adds an ORDER BY clause to the SQL statement and a WHERE clause for the record selection formula, if possible.
  • If you group on a linkable data type in the DBMS, the program adds a GROUP BY clause to the SQL statement. The program uses the GROUP BY clause to perform the grouping on the server.
  • If you summarize on a linkable data type, the program adds a summary field to the SELECT clause of the SQL statement.
  • If you drill-down on a linkable data type, the program adds a WHERE clause to the SQL statement.
  • If you group in descending order on a linkable data type, the program adds an ORDER BY clause to the SQL statement.

The statement also varies between tabs:

  • If you are working in the Preview tab, the statement includes the GROUP BY clause, as well as any aggregates that the report is pushing to the server.
  • If you are drilling-down, the statement varies depending on the underlying data and the level of drill-down. With each drill-down, the WHERE criteria changes. Also, if you drill-down to the details, the statement will not include a GROUP BY clause (since you no longer have any groups on that drill-down tab).

To view the current SQL statement for the active tab, choose Show SQL Query from the Database menu. The Show SQL Query dialog box appears, displaying the SQL statement.

Note:

  • You can use the SQL Expression editor to edit SQL expressions to be processed on the server.
  • SQL statements that have been edited in the Show SQL Query dialog box, disable server-side processing as GROUP BY is no longer pushed down.


Enabling server-side processing

  1. On the File menu, click Report Options.
  2. Select Perform Grouping on Server on the Report Options dialog box.

    This check box is inactive if Use Indexes or Server for Speed is not selected.

  3. Click OK.

Note: You can also enable or disable this option quickly by selecting or deselecting Perform Grouping on Server on the Database menu as needed. If Use Indexes or Server for Speed is not selected in the Report Options dialog box, this command is inactive.


Mapping database fields

The Map Fields dialog box allows you to link report fields to their corresponding database fields when you have made changes to the structure of the database, or when you have created a report based on one database from a template of another report based on some other database that has the same table and field structure. In this way, the dialog box helps you to make sure your reports print with the current version of the active database.

When you first create a report, the report draws its fields from the database as it exists at the time. If you change the structure of the database after you create the report, the program needs to adapt the report to the new structure.


About the Map Fields dialog box

The Map Fields dialog box contains four list boxes:

  • The upper-left box displays the names of all unmapped report fields (for which the program detects a change in the active database). The top name is selected by default.
  • The upper-right box displays the names of unmapped database fields (in which the program detects a change). Since the Match Type box is selected by default, this box displays only the names of unmapped database fields of the same type as the unmapped report field you selected in the upper-left box. To display all unmapped database fields, regardless of type, clear the Match Type box.
  • The lower-left box displays the names of mapped report fields. When you map fields in the upper boxes, they appear in the lower boxes.
  • The lower-right box displays the names of mapped database fields. When you map fields in the upper boxes, they appear in the lower boxes.

For each database field that you have changed, highlight the report field and the database field in the upper sections and click Map. The field names move from the upper boxes to the lower boxes.

You do not have to remap every report field. For example, if you delete a database field, it is not necessary to remap its corresponding report field, since you will not need that field in your report. You can click OK to close the dialog box without remapping each field listed in the upper-left box.

On some occasions, you might want to unmap or unlink report and database fields that you have already mapped. For example, you might mistakenly map the wrong fields or want to map a report field to a database field that you already mapped. In these cases, you can select a report field in the lower boxes (the program then automatically selects the database field) and click Unmap. The field names will move from the lower boxes to the upper boxes.

Note: Seagate Crystal Reports does not automatically refresh the report data when you close the Map Fields dialog box. To refresh your data, click Refresh on the Standard toolbar.


Remapping processes

If you make changes to the active database fields that require you to remap the corresponding report fields, you can display the Map Fields dialog box by choosing any of these commands from the Database Menu:

  • Verify Database
  • Verify on Every Print
  • Set Location
  • Convert Database Driver.

You can use each of these commands for a specific function; however, any of these commands will open the Map Fields dialog box if the program detects a mismatch between the field names in the report and the field names in the database. In order to detect any possible mismatches, the program checks each field name in the report against the field names in the database. If one of the field names does not match any of the field names in the database, the Map Fields dialog box appears.

Note: Report fields that are left unmapped are removed from the report.


Using the Verify Database process

When you choose Verify Database from the Database menu, the program checks the active databases and reports whether it detected any changes. If it detects changes, the report must be adapted to prevent errors. If you click Yes, the program attempts to adapt the report to the new database structure.

The program displays the Map Fields dialog box when it detects either of these types of changes to the database:

  • the name of a database field that is used in the report has changed
  • the database has been upsized from a PC data source to an SQL data source.

For a tutorial on the Map Fields dialog box, see Remapping altered database fields. Seagate Crystal Reports automatically adapts the report (and does not display the Map Fields dialog box) if it detects any of these changes:

  • fields have been added to the database
  • fields that are not used in the report have been deleted from the database
  • field positions have changed in the database
  • data types have changed for fields in the database.


Using the Verify on Every Print process

Verify on Every Print triggers the Verify Database command every time you print your report.

  • If there is a check mark beside Verify on Every Print, the option is active. It triggers Verify Database every time you print. See Using the Verify Database process.
  • If there is no check mark beside it, the option is inactive. The option is inactive by default.


Using the Set Location process

When you choose Set Location from the Database menu and specify a new location for the active database, the program checks the database for changes.

Set Location displays the Map Fields dialog box when it detects any of the following changes in the database structure:

  • a database field has been deleted
  • a database field has been renamed
  • the database is completely new.

Note: The program checks for these changes only if the databases have different names or if the database name has changed. If the databases have the same name, the Map Fields dialog box does not appear, and you need to verify the database when you have finished setting the location. For more information, see Using the Verify Database process.

Remapping altered database fields

Use the Map Fields dialog box to remap existing report fields in the active database if they have been altered.

To remap an altered database field
  1. With the report active in the Design tab, choose Verify Database from the Database menu.

    The Verify Database message box appears.

      • If the program detects no changes in the active database, the message box displays this message: "The database is up to date." In this case, click OK and return to your work.
      • If the program detects a change(s) in the active database, the message box displays this message: "The database file ["database name"] has changed. Proceed to fix up the report?"
  2. Click Yes.

    If the program detects that a field name has been altered in the active database, the Map Fields dialog box appears.

    Note: The program automatically adapts the report to changes in other data within the database (number of fields, field position, data type, etc.). It is not necessary to remap fields in which these changes have been made.

  3. Highlight the first report field that you want to remap in the upper-left box.
  4. In the upper-right box, highlight the unmapped database field to which you want to remap the selected report field.
  5. Click Map.

    The highlighted report and database fields no longer appear in the upper boxes. Instead, they appear in the corresponding lower boxes.

  6. Repeat Steps 3 through 5 for each unmapped report field you want remapped.

    Note: If the names of any report fields remain in the upper-left box when you exit the dialog box, the program removes them from your report.

  7. Click OK.

    The program remaps the report fields to the altered database fields.


Remapping when converting database drivers

When you choose Convert Database Driver from the Database menu and specify the database driver to use when running your report, the program checks the database for changes. It displays the Map Fields dialog box when it detects changes in the database structure.


Working with databases

This section introduces several common procedures related to accessing database files from within Seagate Crystal Reports. Where practical, step-by-step instructions are provided.

Using Access queries

Opening Access queries through DAO

Microsoft Access queries can be used in Seagate Crystal Reports as separate data sets, just like Access tables. When you open an Access database through the DAO engine (see Microsoft Access), any queries in the database can automatically be read.

To open an Access query through DAO
  1. On the Standard toolbar, click New.

    The Seagate Crystal Report Gallery appears.

  2. Click As a Blank Report and then OK.
  3. In the Data Explorer dialog box, locate, highlight, and then expand the Microsoft Access database (*.mdb) file that contains the query you want to use in your report.

    Note: If your database requires a user name and password, or any other log on information, a log on dialog box appears.

  4. Highlight the query and any tables you want to include in your report and click Add.
  5. Click Close when you are finished with the Data Explorer dialog box.

    The Field Explorer dialog box appears with Database Fields selected and expanded.

    Note: The Visual Linking Expert dialog box appears first if you have selected several queries and tables.

    All of the queries and tables you highlighted from your Access database appear in the Field Explorer dialog box.

  6. Locate your query in the Database Fields list, and double-click its name.

    The query expands to display all the fields it contains.

  7. Highlight any fields you want to use in your report and add them to the Design tab.

Note: You cannot use Access Action queries or Update queries in Seagate Crystal Reports. However, you can use Access Select queries and Cross-tab queries.


Opening Access queries through ODBC

ODBC gives you more control over which parts of a database you can use. For this reason, using an Access query through ODBC may require a few extra steps.

To open an Access query through ODBC
  1. On the File menu, click Options.
  2. Click the Database tab.

  3. Select the Views and/or Reprompt user when connecting check box(es).
      • Selecting Views automatically displays any available queries in your Access database.
      • Selecting Reprompt user when connecting displays the Allow Reporting On dialog box every time you select an ODBC data source. This dialog box provides the same options as the Allow Reporting On section on the SQL tab of the Options dialog box, but provides those options for every ODBC data source you select.
  4. In addition, you can specify Table name LIKE and Owner LIKE options, if you wish.
      • Table name LIKE is based on the SQL LIKE clause. This option allows you to specify the kinds of table names you want to appear in the Choose SQL Table dialog box. You can use the underscore character (_) or the percent sign character (%) as wildcards with this function. The underscore character specifies any single character, while the percent sign signifies any character string. For example, DAV_ matches DAVE only, while DAV% matches DAVE and DAVID. Table name LIKE C% displays only those tables that have a table name beginning with the letter C.
      • Owner LIKE is also based on the SQL LIKE clause. Owner LIKE allows you to select the Owner (or Creator or Alias) of the table, not the table name itself. For example Owner LIKE C% displays only those tables that have an owner beginning with the letter C.
  5. Click OK to exit the Options dialog box.
  6. Create a new report and choose ODBC as the data source for your Access database.

    If you did not specify a particular Access database file with your Access ODBC data source, the Select Database dialog box appears.

    Note: If your database requires a user name and password, or any other log on information, a log on dialog box appears.

  7. Locate and select the database that contains the Access query you want to use and then expand it.

    If you selected the Reprompt user when connecting check box in the Options dialog box, the Allow Reporting On dialog box appears. Otherwise, skip to Step 9.

  8. Make sure the Views check box is selected and click OK when finished.
  9. Highlight your query, click Add and then Close.

    The Design tab appears along with the Field Explorer dialog box. Your Access query, and all fields associated with that query, appear under Database Fields.

Note: You cannot use Access Action queries or Update queries in Seagate Crystal Reports. However, you can use Access Select queries and Cross-tab queries.


Opening Access Parameter queries

Access Parameter queries can be opened only when you open an Access database via ODBC. Make sure you have an ODBC data source set up for your Access database before attempting this procedure. See Setting up an ODBC data source.

Note: When you design a Parameter query in Access, you must provide a prompt for the query and specify a data type for the parameter. First, with your query open in Design View in Microsoft Access, enter a prompt in the Criteria cell for the field that will act as a parameter. Then, choose Parameters from the Query menu in Access, and specify a data type for the parameter you just created. Make sure the prompt appears exactly as it does in the Criteria cell. For complete instructions, refer to your Access documentation. If you do not set up your Parameter query correctly, Seagate Crystal Reports will not be able to use it.

To open an Access Parameter query
  1. In Seagate Crystal Reports, choose Options from the File menu.

    The Options dialog box appears.

  2. Click the Database tab.

  3. Select the Stored Procedures and/or Reprompt user when connecting check box(es).
      • Selecting Stored Procedures automatically displays any available stored procedures when you log on to an ODBC data source. Seagate Crystal Reports treats Access Parameter queries much like it treats SQL stored procedures. So, to use a Parameter query, the Stored Procedures check box must be selected.
      • Selecting Reprompt user when connecting displays the Allow Reporting On dialog box every time you select an ODBC data source. This dialog box provides the same options as the Allow Reporting On section on the SQL tab of the Options dialog box, but provides those options for every ODBC data source you select.
  4. In addition, you can specify Table name LIKE and Owner LIKE options if you wish.
      • Table name LIKE is based on the SQL LIKE clause. This option allows you to specify the kinds of table names you want to appear in the Choose SQL Table dialog box. You can use the underscore character (_) or the percent sign character (%) as wildcards with this function. The underscore character specifies any single character, while the percent sign signifies any character string. For example, DAV_ matches DAVE only, while DAV% matches DAVE and DAVID. Table name LIKE C% displays only those tables that have a table name beginning with the letter C.
      • Owner LIKE is also based on the SQL LIKE clause. Owner LIKE allows you to select the Owner (or Creator or Alias) of the table, not the table name itself. For example Owner LIKE C% displays only those tables that have an owner beginning with the letter C.
  5. Click OK to exit the Options dialog box.
  6. Create a new report and choose ODBC as the data source for your Access database.

    If you did not specify a particular Access database file with your Access ODBC data source, the Select Database dialog box appears.

    Note: If your database requires a user name and password, or any other log on information, a log on dialog box appears.

  7. Locate and select the database that contains the Access Parameter query you want to use and then expand it.

    If you selected the Reprompt user when connecting check box in the Options dialog box, the Allow Reporting On dialog box appears. Otherwise, skip to Step 9.

  8. Make sure the Procedures check box is selected and click OK when finished.
  9. Highlight your Parameter query and click Add.

    The Enter Parameter Values dialog box appears.

  10. Highlight a parameter in the Parameter Fields list.

    Set to NULL Value is selected by default. If you want to assign a value, clear the Set to NULL Value check box.

  11. Assign a value by typing into the Discrete Value box and then click OK.
  12. Repeat Steps 10 and 11 for each parameter in your Access Parameter query.
  13. On the Data Explorer dialog box, click Close.

    You can change parameter values at any time by choosing Stored Procedure Parameters from the Database menu.

  14. Create your report using the fields in the Parameter query. Only the records that satisfy the parameter values you specified in the Enter Parameter Values dialog box are used in your report.

Note: You cannot use Access Action queries or Update queries in Seagate Crystal Reports. However, you can use Access Select queries and Cross-tab queries.


Using ODBC data sources

Setting up an ODBC data source

To set up an ODBC data source, you must first have an ODBC driver installed for the type of data you want to use. Many DBMS applications automatically install and set up ODBC drivers. If you are not sure whether ODBC drivers have been installed for your data, refer to the documentation that came with your DBMS application.

Note: Seagate Crystal Reports installs version 3.510 of ODBC Administrator. If you have a different version, steps in this procedure will vary slightly.

To set up an ODBC data source
  1. From the Program Manager, double-click the ODBC Administrator icon in the appropriate program group.

    The ODBC Data Source Administrator dialog box appears.

  2. Click Add to add a new ODBC data source.

    The Create New Data Source dialog box appears.

  3. Choose the ODBC driver appropriate for your data type from this list.
  4. Click Finish when finished.

    If a driver does not appear for your data type, then the ODBC driver has not been correctly installed. Refer to the documentation for your DBMS application.

    An ODBC Data Source Setup dialog box that is specific to the ODBC driver you selected appears.

    Note: If an error message appears instead of the Setup dialog box, you may not have the correct ODBC drivers installed on your system for the type of data you selected.

  5. Type the name for your new ODBC data source in the Data Source Name box.

    Note: The dialog box that appears may look different from the one shown here, depending on the type of data you are using. This dialog box is specific to the Access 97 ODBC driver. For more information about using the dialog box that appears for your data, click Help.

    .

  6. Click OK when finished.


Checking settings for an ODBC data source

  1. From the appropriate program group or folder, run the ODBC Administrator application.

    The ODBC Data Source Administrator dialog box appears.

  2. Highlight the appropriate data source from the User Data Sources list (on the User DSN tab).
  3. Click Configure.

    The ODBC Data Source Setup dialog box appears.

    The ODBC Data Source Setup dialog box that appears is specific to the data source you selected, and contains controls and information for setting up your data source.

  4. Check the settings in this dialog box to make sure the information matches your system and database.
  5. Make any changes necessary, and then click OK.
  6. Click OK to close the ODBC Data Source Administrator dialog box.


Logging on to an ODBC data source

  1. Choose Log On/Off Server from the Database menu.

    The Data Explorer dialog box appears.

  2. Choose the ODBC database file you want to open and click Log On.

    If the data source requires a user name and password, or any other log on information, a log on dialog box appears.

  3. Type in the log on information you usually use to access this database, and click OK.

    If you did not specify a database with the ODBC data source, the Select Database dialog box appears. Select the database file and then click OK.


Adding an ODBC database table to a report

  1. Choose Add Database to Report from the Database menu.

    The Data Explorer dialog box appears.

  2. Choose the ODBC database file you want to open and expand it by double-clicking it.

    If the data source requires a user name and password, or any other logon information, the Login dialog box appears.

  3. Type in the log on information you usually use to access this database, and click OK.

    If you did not specify a database with the ODBC data source, the Select Database dialog box appears. Select the database file and then click OK.

  4. Highlight a database table and then click Add.
  5. Click Close when you are finished with the Data Explorer dialog box.

    The Field Explorer dialog box appears with Database Fields selected and expanded. The new table is added.


Logging on to MS SQL Server via ODBC

This section is intended as an example of how to log on to a Microsoft SQL ServerTM data source from Seagate Crystal Reports. Your SQL server application or any other password-protected data source may require different steps.

To log on to MS SQL Server via ODBC
  1. Verify the settings for the Microsoft SQL Server data source using ODBC Administrator. See Checking settings for an ODBC data source.
  2. From Seagate Crystal Reports, choose Log On/Off Server from the Database menu.

    The Data Explorer dialog box appears.

  3. Choose a SQL Server data source and then click Log On.

    The SQL Server Login dialog box appears.

  4. Type your MS SQL Server login ID and password.
  5. Click Options.

    The Options section of the SQL Server Login dialog box appears.

  6. Verify the settings for your SQL Server.
  7. Verify the name of the SQL Server database you want to open, the database language you want to use, the name of the application you are using (Seagate Crystal Reports), and the name of your computer workstation. Make any changes necessary.
  8. Click OK.


Logging off an ODBC data source

  1. Choose Log On/Off Server from the Database menu.

    The Data Explorer dialog box appears.

  2. Highlight the ODBC data source you want to log off from this list.
  3. Click Log Off.
  4. Click Close when finished with the Data Explorer dialog box.


Changing the ODBC data source accessed by a report

  1. Choose Set Location from the Database menu.

    The Set Location dialog box appears with a list of table aliases for the tables displayed in the report and will display the locations and logon information for the table you select below the list of tables.

  2. Highlight the first table in this list box.
  3. Click Set Location.
  4. Choose the original ODBC data source to log on if you are not logged on already. You must log on to the old data source before you can modify a report to use a new data source. Since you must be logged on to the old data source, the old data source must be available on the local machine.
      • If the machine is no longer connected to the old server, you can install an ODBC data source with the name of the old data source and have it point to the new database server. Log on to this data source as you would log on to the "old" data source.
      • If you are using the same data source name to connect to a new server, you must configure that data source in the ODBC Data Source Administrator (found in the Control Panel), and make it point to the new server.

        After you log on to the old data source, double-click it so the list of tables appears in the Data Explorer dialog box.

  5. Choose the new data source within the Data Explorer dialog box to log on.

    You should now be logged on to both the old and the new data sources.

  6. Double-click the new data source to display its tables, then select the appropriate table from this list. The table you choose should correspond to the first table you selected in the Set Location dialog box.
  7. After clicking Set the program prompts you to change the location of all tables in the report to the location you specified for the first table.

  8. Click Yes to set the location of all tables in the report to the same database.
  9. Close the Set Location dialog box, and choose Verify Database from the Database menu to refresh the table definitions in the report.
  10. Log off the old data source.
  11. Save the report.


SQL stored procedures

Selecting an SQL stored procedure and changing parameters

  1. Choose Options from the File menu.

    The Options dialog box appears.

  2. Click the Database tab and make sure either the Stored Procedures or the Reprompt user when connecting check box is selected.
      • Selecting Stored Procedures automatically displays any available stored procedures when you log on to an SQL database.
      • Selecting Reprompt user when connecting displays the Allow Reporting On dialog box every time you select an ODBC data source. This dialog box provides the same options as the Explorer Options section on the Database tab of the Options dialog box, but provides those options for every ODBC data source you log on to.
  3. In addition, you can specify Table name LIKE and Owner LIKE options if you wish.
      • Table name LIKE is based on the SQL LIKE clause. This option allows you to specify the kinds of table names you want to appear in the Choose SQL Table dialog box. You can use the underscore character (_) or the percent sign character (%) as wildcards with this function. The underscore character specifies any single character, while the percent sign signifies any character string. For example, DAV_ matches DAVE only, while DAV% matches DAVE and DAVID. Table name LIKE C% would display only those tables that have a table name beginning with the letter C.
      • Owner LIKE is also based on the SQL LIKE clause. The Owner LIKE option allows you to select the Owner (or Creator or Alias) of the table, not the table name itself. For example Owner LIKE C% would display only those tables that have an owner beginning with the letter C.

        Note: For more information on the SQL LIKE clause, refer to your SQL documentation.

  4. Click OK to exit the Options dialog box.
  5. Create a new report based on the SQL database that contains the stored procedure you want to use.
  6. Double-click the ODBC data source for your SQL Server from the Data Explorer dialog box.

    The SQL Server Login dialog box appears.

  7. Enter the required information to log in.
  8. Click Options.

    The Options section of the SQL Server Login dialog box appears.

  9. Verify the settings for your SQL Server.
  10. Click OK.

    If you toggled on the Reprompt user when connecting check box in the Options dialog box, the Allow Reporting On dialog box now appears. Otherwise, skip to Step 12.

  11. Make sure the Procedures check box is selected and click OK when finished.
  12. Highlight an SQL stored procedure and click Add.

    The Enter Parameter Values dialog box appears.

    Note: Under the native driver for MS SQL Server, stored procedure input parameters are limited to 64 characters, rather than 255.

  13. Highlight a parameter in the Parameter Fields list.

    Set to NULL Value is selected by default. If you want to assign a value, clear the Set to NULL Value check box.

  14. Assign a value by typing into the Discrete Value box and then click OK.
  15. Repeat Steps 13 and 14 for each parameter that appears in the Parameter Fields list.
  16. On the Data Explorer dialog box, click Close.

    You can change parameter values at any time by choosing Stored Procedure Parameters from the Database menu.

  17. Create your report using the fields from the stored procedure. Only the records that satisfy the parameter values you specified in the Enter Parameter Values dialog box are used in your report.


Advanced database features

One-to-many links

This tutorial demonstrates how to set up an A to B, A to C report using the Customer, Credit, and Orders tables in the Xtreme.mdb sample database. The Xtreme.mdb database is located in the \Program Files\Seagate Software\Crystal Reports\Samples\Databases directory. Use the instructions here as a guideline for creating A to B, A to C reports with your own database files.

To set up an A to B, A to C link
  1. On the Standard toolbar, click New.
  2. Click As a Blank Report and then OK on the Seagate Crystal Report Gallery.
  3. Expand the File Data Sources tree.
  4. Double-click the Xtreme.mdb database file to see its tables.
  5. Highlight the Credit table and click Add.
  6. Repeat the previous step for both the Customer and Orders tables.
  7. When all three tables have been added, click Close on the Data Explorer dialog box.

    The Visual Linking Expert appears.

  8. Link the Customer Credit ID field in the Credit table to the Customer ID field in each of the other two tables.

    Note: A different linking configuration occurs if you click Smart Link and this tutorial will not work properly.

  9. Select one of the link lines in the Visual Linking Expert, and click Options.
  10. Click Look up all of one, then all of others in the When linking to two files from this file section of the Link Options dialog box.

    This option establishes an A to B, A to C link.

  11. Click OK to return to the Visual Linking Expert.

    The option you selected affected all links.

  12. To make sure the correct link option is in effect, click the link line that you did not select in the last step.
  13. Click Options, and verify the Look up all of one, then all of others setting in the Link Options dialog box.
  14. Click OK in the Link Options dialog box, then click OK again back in the Visual Linking Expert.

    For more information about this type of linking, see Look up all of one, then all of others (A to B, A to C).

You have now established an A to B, A to C relationship among the three tables.


SQL queries

This section is only valid for reports using ODBC data sources. Seagate Crystal Reports automatically generates an SQL query when you design a report based on one or more ODBC data source. This query is sent to the ODBC data source(s) as an instruction to gather the data needed by the report.

To edit an SQL query
  1. On the Database menu, click Show SQL Query.
    The Show SQL Query dialog box appears.

  2. Click anywhere inside the text area to begin making changes.
  3. Use the ANSI SQL language to fine-tune the SQL query.

    Note: You cannot change the SELECT clause of the SQL statement.

    You can cut, copy, or paste any part of the query to or from the Clipboard if needed.For more information, see The SQL language.

  4. Click OK when finished.


ACT! databases

ACT! is a powerful Contact Management application that stores all your contact information in a database format similar to xBASE databases (dBASE, Clipper, and FoxPro).

Note: Versions of ACT! before and including version 2 require the use a file called Crw.act which is not needed in versions 3 and 4. Choose the appropriate procedure based on the version of ACT! you are using.

To use an ACT! 2 database
  1. On the Standard toolbar, click New.

    The Seagate Crystal Report Gallery appears.

  2. Click As a Blank Report and then OK.
  3. In the Data Explorer dialog box, expand the File Data Sources tree and double-click Find Database File.
  4. Use the Open dialog box to locate and highlight the file Crw.act. This file is located in the \Program Files\Seagate Software\Crystal Reports directory or in the directory in which the program resides. Click Open when finished.

    The Choose File for ACT! dialog box appears.

  5. Use the controls in this dialog box to locate and highlight your ACT! database.
  6. Click OK.

    The Design tab appears in the application window. Create your report using fields from your ACT! database.


To use an ACT! 3 or 4 database

  1. On the Standard toolbar, click New.

    The Seagate Crystal Report Gallery appears.

  2. Click As a Blank Report and then OK.
  3. In the Data Explorer dialog box, expand the File Data Sources tree and double-click Find Database File.
  4. Use the Open dialog box to locate and highlight your ACT! database. Click Open when finished.

    The database you chose appears in the Data Explorer dialog box.

  5. Highlight the table you want to use in your report and click Add.
  6. Click Close on the Data Explorer.

    The Design tab appears in the application window. Create your report using fields from your ACT! database.


NT Event Logs

If you are running on a Windows NT machine, Seagate Crystal Reports gives you the ability to generate reports based on the NT Event Log.

To report on an NT Event Log
  1. On the Standard toolbar, click New.

    The Seagate Crystal Report Gallery appears.

  2. Click As a Blank Report and then OK.
  3. In the Data Explorer dialog box, expand the More Data Sources tree and double-click Find Database File.
  4. Double-click either NT Archived Event Log or NT Current Event Log.
      • Choose NT Archived Event Log to report on a previously archived NT Event Log. If you choose this option the Select Archived NT Event Log dialog box appears, allowing you to navigate to the file you want to report on.
      • Choose NT Current Event Log to report on the most recent NT Event Log.
  5. If you chose to report on the NT Current Event Log the Select Current Event Log dialog box appears:

  6. The computer referenced in the Computer(s) box is the computer on which the sample report is based. To change the computer, expand the Microsoft Windows Network tree.

    The directory structure expands to display the network group to which your computer is connected.

  7. Expand the network group to display individual machines connected to the group.
  8. Select the NT machine for which you would like to create an NT Event Log Report.

    When you select a machine, that name appears in the Computer(s) box.

    Three tables become available on the Data Explorer dialog box:

      • Application
      • Security
      • System.

    Use these tables to create your report based on the NT Current Event Log.

Note:

  • In order to report on the Security table, you need to have the User Right of "Manage auditing and security log" added to your Policy in NT.
  • The data that you will see is the same data that is seen from the NT Event Viewer.


For additional information

This section has only touched on some of the more important aspects of database access, relational databases, and SQL. If you are interested in learning more about database topics, refer to the documentation provided with your DBMS application.

In addition, there are hundreds of books available on the market that discuss database theory and design in depth. Look for the computer-related section at your local bookstore.


Exchange Data Access

Seagate Crystal Reports has the ability to access various types of Microsoft Exchange data. The program is capable of retrieving valuable information from the Exchange Information Store, Message Tracking Logs, and Exchange Server Administrator Objects.

The report designer uses the Physical Database server type method to access exchange data. Thus, it will use the SQL/ODBC method to log on to the desired exchange server type and display those types in the Log On Server dialog box.

You can active this option by choosing:

  • Log On/Off Server from the File menu (when there is no report opened)
  • Log On/Off Server from the Database menu (when there is a report opened).

The following is a summary of the various types of Exchange data that the Report Designer can access.

  • Address Book Contents
  • Exchange Folder Contents
  • Message Tracking Logs
  • Exchange Administrator Data Server Types.


Address Book contents

Description

Accesses account's personal information for all entries in the address book. All of the address books are on the Exchange Server, except for the Personal Address Book. Each of the address books are "Recipients Containers" on the Server and their contents can be viewed by selecting them in the Exchange Administrator.

The report designer interprets the information in the following manner:

  • the selected address book is seen as a database table
  • each object contained within the address book is seen as a record in the address book table
  • each object's properties are seen as fields of the address book table's records.

To view the contents of an address book, select the Recipients Container that represents the desired address book on the Exchange Server.


Server type

Exchange Folders/Address Book

To log on to the Exchange Folders/Address Book server type
  1. Open the Data Explorer dialog box by choosing:
      • Log On/Off Server from the File menu (when there is no report opened)
      • Log On Server/Off from the Database menu (when there is a report opened).
  2. Select Exchange Folders/Address Book from the More Data Sources folder.
  3. Double-click the folder or double-click Make a New Connection. The Choose Profile dialog box appears.
  4. Select the Profile that you would like to use from the Profile Name list. Click OK.

    The Select a folder/address book dialog box appears.

  5. Select the Address Book that you would like to use. All Address Books are available under the Address Book directory. Click to expand the directory and show its contents. After you have made your selection, click OK.
To set the location of a table accessing an address book
  1. On the Database menu, click Set Location.
  2. When the Set Location dialog box appears, click Set Location.
  3. Find and highlight the new address book you want to use in the Data Explorer dialog box and click Set when done.

    Verify that the new table has been selected by reviewing the Table, Server Type, Server Name, Database (alias name displayed), and User ID in the Location section of the Set Location dialog box.

  4. Click Done after reviewing the table information.


Address Book fields

Account | ISDN Number
Address Type | Keyword
Assistant | Language
Assistant Phone Number | Last Name
Business 2 Phone Number | Location
Business Fax Number | Mail Permission
Business Phone Number | MHS Common Name
Callback Phone Number | Mobile Phone Number
Car Phone Number | Office Location
City | Organizational ID Number
Comment | Original Display Name
Company Name | Other Phone Number
Conversion Prohibited | Pager Phone Number
Country | Post Office Box
Department | Postal Address
Disclose Recipients | Postal Code
Display Name | Primary Fax Number
E-mail Address | Primary Phone Number
First Name | Radio Phone Number
Generation | Send Rich-Text Format
Government ID Number | State
Home 2 Phone Number | Street Address
Home Fax Number | Telex Number
Home Phone Number | Title
Initials | Transmittable Display Name

Data Access DLL

P2smapi.dll

Version(s)

  • Crystal Reports for Exchange
  • 101 Back Office Reports
  • Crystal Reports 5.0 (and higher).


Exchange Folder contents

Description

Accesses all properties for each object in a folder (including all additional properties that the Exchange form assigns).

The folder that you would like to access can be viewed by selecting the folder in the Exchange client (provided that you have the appropriate permissions). The report designer will interpret the selected folder in the following manner:

  • the folder will be seen as a database table
  • each object contained within the folder will be seen as a record of the folder table
  • each object's properties will be seen as fields of the folder table's records.

In addition to providing access to all of the default properties that Exchange assigns an object within a folder, the Report Designer will provide access to any fields that were created by an Exchange Form. If the Exchange Form is:

  • assigned to the same folder that you specified when logging on as you selected upon creating the report
  • in the Exchange Client's Personal Forms Library.

The report designer will make it's fields available for access.


Server type

Exchange Folders/Address Book

To log on to the Exchange Folders/Address Book server type
  1. Open the Data Explorer dialog box by choosing:
      • Log On/Off Server from the File menu (when there is no report opened)
      • Log On/Off Server from the Database menu (when there is a report opened).
  2. Select Exchange Folders/Address Book from the More Data Sources folder.
  3. Double-click the folder or double-click Make a New Connection. The Choose Profile dialog box appears.
  4. Select the Profile that you would like to use from the Profile Name list. Click OK.
  5. From the Select a folder/address book dialog box, select the folder that you would like to use and click OK.
To set the location of a table accessing an Exchange Folder
  1. On the Database menu, click Set Location.
  2. When the Set Location dialog box appears, click Set Location.
  3. Find and highlight the new Exchange Folder you want to use in the Data Explorer dialog box and click Set when done.

    Verify that the new table has been selected by reviewing the Table, Server Type, Server Name, Database (alias name displayed), and User ID in the Location section of the Set Location dialog box.

  4. Click Done after reviewing the table information.


Exchange Folder fields

Note: Folder fields vary with the folder chosen. The following list reflects a folder in the Public Folders branch of the Select a folder/Address book dialog box.

Attachment | Priority
CC | Received
CC to Me | Recipient Address Type
Conversion Topic | Recipient Email Address
From | Sender Address Type
Importance | Sender Email Address
Item Text | Sensitivity
Item Type | Sent
Keywords | Sent Directly To Me
Message Creation Time | Size
Message Flags | Subject
Modification Time | To

Data Access DLL

P2smapi.dll

Version(s)

  • Crystal Reports for Exchange
  • 101 Back Office Reports
  • Crystal Reports 5.0 (and higher).


Message Tracking Logs

Description

Access to all fields from the Exchange Server's Message Tracking Log.

When message tracking is enabled, each component handling mail records its activities in a log maintained by the system attendant on each server. The log becomes a trace of the processing of each message as each component receives, processes, and delivers it to the next component. By default, the Message Tracking Log are stored in the \\<machine name>\<share name>\exchsvr\tracking.log directory. A file is created for each day and its name has the format YYYYMMDD.log.

The report designer will interpret each entry in the log(s) as a record, and it provides accesses to all fields of the message tracking log. The definition of the data stored in these files can be found in Exchange Server's on-line Help.


Server type

Message Tracking Log

To log on to the Message Tracking Logs server type
  1. Open the Data Explorer dialog box by choosing:
      • Log On/Off Server from the File menu (when there is no report opened),
      • Log On/Off Server from the Database menu (when there is a report opened).
  2. Select Message Tracking Log from the More Data Sources folder.
  3. Double-click the folder or double-click Make a New Connection. The MS Exchange Message Tracking Log dialog box appears.
  4. Enter the path for, or browse for, the directory where the tracking logs are located. By default, Exchange Server will place these files in the \\<machine name>\<share name>\exchsrv\Tracking.log.
  5. Click OK.
  6. Enter the date range you'd like to see log entries for in the Enter Message Tracking Log Dates dialog box.
  7. Click OK.
To set the location of a table accessing a Message Tracking Log
  1. On the Database menu, click Set Location.
  2. When the Set Location dialog box appears, click Set Location.
  3. Find and highlight the new Message Tracking Log you want to use in the Data Explorer dialog box and click Set when done.

    Verify that the new table has been selected by reviewing the Table, Server Type, Server Name, Database (alias name displayed), and User ID in the Location section of the Set Location dialog box.

  4. Click Done after reviewing the table information.


Message Tracking Log fields

Message ID | Priority
Event Number | Message Length (Bytes)
Date | Transport Time (Seconds)
Time | Message Transfer Cost
Gateway Name | Number of Recipients
Partner Name | Recipient Name
Remote Message ID | Recipient Report Status
Originator |

Data Access DLL

P2strack.dll

Version(s)

  • Crystal Reports for Exchange
  • 101 Back Office Reports
  • Crystal Reports 5.0 (and higher).


Exchange Administrator Data Server types

When you log on to any of the Exchange Administrator Data server types, you must select a profile (or profiles). Each profile that you select represents an Exchange Server. So, if you want to access n Exchange Servers, you would want to create n profiles where each profile's server value is one of the desired machines. Each one that you create for any of the Exchange Administrator Data server types will represent the profile (s)/Exchange Server(s) that you selected.

Seagate Crystal Reports can access a number of different Exchange Administrator Data Server types. These include:

  • Public Folder Allocation and Usage
  • Public Folder Membership
  • Public Folder Replication
  • Mailbox Properties.


Public Folder allocation and usage

Description

Provides valuable configuration and usage information of all Public Folders in an organization.

Seagate Crystal Reports will provide information for all of the folders listed in each Exchange Server's Public Information Store (as represented by the profile(s) selected when logging on). To view this data, select each Exchange Server's Public Information Store{Public Folder Resources tab} in the Exchange Administrator to view all of the properties that the Report Designer provides. The program interprets each entry as a record and the columns (the items available in the Report Designer as fields of the record.


Server type

Public Folder Admin

To log on to the Public Folder Admin server type
  1. Open the Data Explorer dialog box by choosing:
      • Log On/Off Server from the File menu (when there is no report opened),
      • Log On/Off Server from the Database menu (when there is a report opened).
  2. Select Public Folder Admin from the More Data Sources folder.
  3. Double-click the folder or double-click Make a New Connection. The Logon to Exchange Servers dialog box appears.
  4. Click Select Profiles and choose a profile from the list on the Select Profiles dialog box.
  5. Click OK to return to the Logon to Exchange Servers dialog box.
  6. Click OK once more to return to the Data Explorer dialog box.
To set the location of a table accessing a Public Folder Admin server type
  1. On the Database menu, click Set Location.
  2. When the Set Location dialog box appears, click Set Location.
  3. Find and highlight the new Public Folder Admin table you want to use in the Data Explorer dialog box and click Set when done.

    Verify that the new table has been selected by reviewing the Table, Server Type, Server Name, Database (alias name displayed), and User ID in the Location section of the Set Location dialog box.

    Note: The value MAPI PROFILES is always displayed as the Database name for this server type.

  4. Click Done after reviewing the table information.


Public Folder Admin fields

Server | Storage Quota (K)
Folder Name | Age Limit for Replicas
Folder Path | Folder ID
Last Access Date | Parent Folder ID
Last Access Time | Store ID
Number of Messages | Oldest Message Creation Date
Total Message Size (Byte) | Oldest Message Creation Time
Use Default Storage Limit | Newest Message Creation Date
Issue Warning Storage Limit (K) | Newest Message Creation Time

Data Access DLL

P2sexsr.dll (Windows NT only)

Version(s)

  • 101 Back Office Reports
  • Crystal Reports 5.0 (and higher).


Public Folder membership

Description

Provides information for each member and their permissions for every Public Folder in the organization.

The report designer will provide membership information for all of the folders listed in each Exchange Server's Public Information Store (as represented by the profile(s) selected when logging on). To view this data, you must perform the following operations in Exchange Administrator:

  1. Select each Exchange Server's Public Information Store{Public Folder Resources tab}. Record one of the folders displayed.
  2. Navigate through the Folders Tree (below the Organization Node in the Exchange Administrator) until you have selected the recorded folder. When you have found the folder, view its properties.
  3. Click General Tab{client permissions}. All of the members and their associated permissions will be displayed.

The report designer will treat each entry as a record and it will performs this operation for each folder listed in the Exchange Server's Public Information Store (as designated by the profile(s) selected when logging on).


Server type

Public Folder ACL

To log on to the Public Folder ACL server type
  1. Open the Data Explorer dialog box by choosing:
      • Log On/Off Server from the File menu (when there is no report opened),
      • Log On/Off Server from the Database menu (when there is a report opened).
  2. Select Public Folder ACL from the More Data Sources folder.
  3. Double-click the folder or double-click Make a New Connection. The Logon to Exchange Servers dialog box appears.
  4. Click Select Profiles and choose a profile from the list on the Select Profiles dialog box.
  5. Click OK to return to the Logon to Exchange Servers dialog box.
  6. Click OK once more to return to the Data Explorer dialog box.
To set the location of a table accessing a Public Folder ACL server type
  1. On the Database menu, click Set Location.
  2. When the Set Location dialog box appears, click Set Location.
  3. Find and highlight the new Public Folder ACL table you want to use in the Data Explorer dialog box and click Set when done.

    Verify that the new table has been selected by reviewing the Table, Server Type, Server Name, Database (alias name displayed), and User ID in the Location section of the Set Location dialog box.

    Note: The value MAPI PROFILES is always displayed as the Database name for this server type.

  4. Click Done after reviewing the table information.


Public Folder ACL fields

Server | Can read items
Folder Path | Can create subfolders
Member Name | Is owner
Member Email Address | Is contact
Role | Edit items
Can create items | Delete items

Data Access DLL

P2sacl.dll (Windows NT only)

Version(s)

  • 101 Back Office Reports
  • Crystal Reports 5.0 (and higher).


Public Folder Replication

Description

Provides information on servers that are replicating another Exchange Server's public folder.

MS Exchanger provides the facility of replicating public folders across multiple Exchange Servers. Thus, a folder can be originally created on an Exchange Server and copies of this folder can be made on other servers. The replication feature will ensure that the contents of these folders remain in sync. The program will provide replication information for all of the folders listed in each Exchange Server (represented by the profile(s) selected during logon) Public Information Store. To view this data, you must perform the following operations in Exchange Administrator.

  1. Select each Exchange Server's Public Information Store (Public Folder Resources tab). Record one of the folders that are displayed.
  2. Navigate through the folders tree (below Organization Node in Exchange Administrator) until you have selected the recorded folder. When you have found this folder, view it's properties.
  3. Select the replicas tab. All of the server's that are replicating the folder (including the Exchange Server which you selected in step 1) will be displayed.

The program will treat each entry under the replicas tab as record. And, it will perform this operation for each folder listed in each Exchange Server (assigned by the profile(s) selected during logon) Public Information Store.


Server type

Public Folder Replica

To log on to the Public Folder Replica server type
  1. Open the Data Explorer dialog box by choosing:
      • Log On/Off Server from the File menu (when there is no report opened),
      • Log On/Off Server from the Database menu (when there is a report opened).
  2. Select Public Folder Replica from the More Data Sources folder.
  3. Double-click the folder or double-click Make a New Connection. The Logon to Exchange Servers dialog box appears.
  4. Click Select Profiles and choose a profile from the list on the Select Profiles dialog box.
  5. Click OK to return to the Logon to Exchange Servers dialog box.
  6. Click OK once more to return to the Data Explorer dialog box.
To set the location of a table accessing a Public Folder Replica server type
  1. On the Database menu, click Set Location.
  2. When the Set Location dialog box appears, click Set Location.
  3. Find and highlight the new Public Folder Replica table you want to use in the Data Explorer dialog box and click Set when done.

    Verify that the new table has been selected by reviewing the Table, Server Type, Server Name, Database (alias name displayed), and User ID in the Location section of the Set Location dialog box.

    Note: The value MAPI PROFILES is always displayed as the Database name for this server type.

  4. Click Done after reviewing the table information.


Public Folder Replica fields

Server | Replica Server Site
Folder Path | Replica Server Name
Replica Server DN |

Data Access DLL

P2srepl.dll (Windows NT only)

Version(s)

  • 101 Back Office Reports
  • Crystal Reports 5.0 (and higher).


Mailbox Properties

Description

Provides valuable configuration and storage usage information of each Exchange user's account.

The program will provide information for all of the mailboxes listed in each Exchange Server (represented by the profile(s) selected during logon) Private Information Store. To view this data, select each Exchange Server's Private Information Store {Mailbox Resources tab} in the Exchange Administrator. All of the properties that the program provides are available for viewing in this dialogue (except for Home Server and Associated NT Account, please refer to note below). The program will interpret each entry in this dialogue as a record and the columns (the items available in the program) are fields of this record.


Server Type

Mailbox Admin

To log on to the Mailbox Admin server type
  1. Open the Data Explorer dialog box by choosing:
      • Log On/Off Server from the File menu (when there is no report opened),
      • Log On/Off Server from the Database menu (when there is a report opened).
  2. Select Mailbox Admin from the More Data Sources folder.
  3. Double-click the folder or double-click Make a New Connection. The Logon to Exchange Servers dialog box appears.
  4. Click Select Profiles and choose a profile from the list on the Select Profiles dialog box.
  5. Click OK to return to the Logon to Exchange Servers dialog box.
  6. Click OK once more to return to the Data Explorer dialog box.
To set the location of a table accessing a Mailbox Admin server type
  1. On the Database menu, click Set Location.
  2. When the Set Location dialog box appears, click Set Location.
  3. Find and highlight the new Mailbox Admin table you want to use in the Data Explorer dialog box and click Set when done.

    Verify that the new table has been selected by reviewing the Table, Server Type, Server Name, Database (alias name displayed), and User ID in the Location section of the Set Location dialog box.

    Note: The value MAPI PROFILES is always displayed as the Database name for this server type.

  4. Click Done after reviewing the table information.


Mailbox Admin fields

Server | Total Message Size (Byte)
Mailbox | Home Server
Email Address | Associated NT Account
Last Logon Date | Use Default Storage Limit
Last Logon Time | Issue Warning Storage Limit (K)
Last Logoff Date | Prohibit Send Storage Limit (K)
Last Logoff Time | Max Incoming Message Size (K)
Storage Limit Information | Max Outgoing Message Size (K)

Data Access DLL

P2sexsr.dll (Windows NT only)

Version(s)

  • 101 Back Office Reports
  • Crystal Reports 5.0 (and higher).


Accessing Data Sources

Seagate Crystal Reports works with all kinds of data, from simple text files to advanced client-server SQL databases. This section shows how the program connects to various data sources and what files have to be in place in order to make the connection. This is an in-depth section for advanced users who need to know how Seagate Crystal Reports operates beneath the surface.


Latest database drivers

Get the latest database drivers for Seagate Crystal Reports from the Seagate Software Community web site:
http://community.seagatesoftware.com/updates/default.asp


Introduction

Seagate Crystal Reports can access data stored in almost any common database format, as well as many uncommon formats. In addition, Seagate Crystal Reports leverages the full benefits of query (.QRY) files and dictionaries (.DC5). See The Crystal SQL Designer, and Dictionaries.

This section discusses the many different types of data that Seagate Crystal Reports can access, and explains the data access layers involved in connecting to the data. If you are not sure what Database Management System (DBMS) your company uses, contact your IS manager or your network administrator.

The principal purpose of Seagate Crystal Reports is simply to access data stored in databases and to produce reports on that data. This goal is one of the oldest uses of computers and remains one of the most common and most necessary. Seagate Crystal Reports is designed to make that task easier, less time-consuming, and more powerful.

This idea of accessing data remains at the root of every report produced. By understanding how Seagate Crystal Reports accesses data, you will gain a better knowledge of the reporting process, as well as a better knowledge of the type of data with which the program can work.

In addition, understanding the data access process will help you troubleshoot problems you may encounter while trying to open a particular database file. This is especially useful for IS managers, or for anyone who provides data access support for a group of users.

Most of the information in this section is designed for experienced Seagate Crystal Reports users and IS managers, and covers technical aspects of Database Management Systems (DBMS) and data storage techniques. A familiarity with computers; the Windows 95 and Windows 98, or Windows NT operating system; and at least one DBMS application is assumed.

Note: Many of the translation files mentioned in this section have slightly different names when viewed in the Convert Database Driver dialog box. For example, the translation file normally called P2sodbc.dll appears as Pdsodbc.dll in the Convert Database Driver dialog box. Both of these names represent the same file.


Four types of data

The data that Seagate Crystal Reports can access falls into four general categories:

  • Direct access database files
  • ODBC data sources
  • Crystal SQL Designer files
  • Crystal Dictionary files.

Each type of data must be accessed using a specific set of Dynamic Link Libraries (DLLs) and other data access-related files. Once you understand the process the program uses to access each type of data, you will have a better understanding of the report creation process and the elements used to create powerful reports with your data. See The Crystal SQL Designer, and Dictionaries.

Note: When accessing any type of data, Seagate Crystal Reports relies on the database drivers to provide field names, field types, and field lengths. This information is provided by either the database engine or the ODBC database driver.


Direct access database files

Seagate Crystal Reports can access many of the most common PC database formats directly. In other words, the program has the built-in capabilities needed to directly open database files and tables designed in dBASE, FoxPro, Clipper, Btrieve, Paradox, and Microsoft Access, among others. This functionality exists as soon as you install Seagate Crystal Reports. Once the program is installed on your system, you can immediately begin creating reports based on these databases by selecting the appropriate file.

Advantages

Accessing the database directly is the fastest way to read the data. Seagate Crystal Reports only needs to talk to a single data access layer that provides contact with the data. Report results can be obtained quickly in almost any system environment.

In addition, data access is simple. Direct access database files are point-and-click data sources. You need only select the required database files, and Seagate Crystal Reports will read all the stored data.

Disadvantages

When you access a database directly through Seagate Crystal Reports, only that database type can be used by the report. You can not switch to a different type of database or table without creating a new report.

For example, if you design a report based on Btrieve data, you can not change the tables accessed by the report to Access data. Seagate Crystal Reports communicates with Btrieve data using Btrieve-specific syntax, a syntax that is not compatible with Access data.

If you access data through ODBC, on the other hand, the syntax used is always the SQL language, regardless of the actual database type. See ODBC data sources.


Three layers

Direct access of database files from Seagate Crystal Reports requires three layers:

  • Seagate Crystal Reports
  • Data translation
  • Database.

Seagate Crystal Reports uses the data translation layer to talk to the database and access its data.

Seagate Crystal Reports

Seagate Crystal Reports operates as an interface through which you can format, arrange, select, and sort the data stored in database files. It obtains data by communicating with one or more files in the data translation layer that can actually read the database. Since Seagate Crystal Reports can work with many forms of data, it must rely on other files in order to work directly with the data. Seagate Crystal Reports can then use a native method of communication to talk to the translation files.

Data translation

Data is translated through a set of DLLs specific to Seagate Crystal Reports. The program uses the DLLs specific to a certain data type to understand how data is organized for that type and to present it correctly when your report is printed, previewed, or exported.

Note: Seagate Crystal Reports comes with all the data translation files for each of the direct access database types that it supports. For complete information on all required files, refer to the Runtime File Requirements online Help (Runtime.hlp).

Database

The database file consists of one or more tables. Different DBMS applications store database information differently. For example, dBASE stores each database table as a separate file. Access, on the other hand, can store several tables, along with queries, macros, and other database elements, all in a single file.

When Seagate Crystal Reports accesses a database file directly, it automatically retrieves information about all of the tables and fields in that file. You may not use all of the tables or fields, but the program will make them available to you. In other words, when a dBASE file is opened, only one table in the dBASE file is available. However, when an Access file is opened, every table in that file is available, even if you never use them all.

Note: Seagate Crystal Reports will also open queries in an Access database through the DAO engine or ODBC and will allow you to report on query fields, as with table fields. See DAO and Access.


Common database formats

Although Seagate Crystal Reports uses the same three-tiered system for obtaining data from all direct access database file formats, each format requires a different set of DLLs. However, some formats expand the basic three-tiered structure.

The following sections cover the systems used by Seagate Crystal Reports to access data from some of the most popular database formats.

dBASE, FoxPro, Clipper

Seagate Crystal Reports has been designed to open dBASE data simply and directly through the xBase engine (inside P2bxbse.dll). FoxPro and Clipper are dBASE compatible database formats, and Seagate Crystal Reports uses the same DLL to access files created by any of these three DBMS applications.

Note: The P2bxbse.dll translation layer supports FoxPro files up through version 2.x. See Visual FoxPro for versions after 2.5.

The file P2bxbse.dll handles all translation between Seagate Crystal Reports and the dBASE, FoxPro, or Clipper files. Each database file contains only a single database table, but there is no limit to the number of files that can be accessed by a report.

Note: dBASE data can also be accessed through the Borland Database Engine (BDE) using the translation file P2bbde.dll. To see how the BDE communicates with database data, see Paradox. The BDE, however, does not support FoxPro or Clipper data.


Paradox

Files created with Paradox (.DB) are made available to other applications through the Borland Database Engine (BDE). The BDE does the actual work with the Paradox data, retrieving the requested tables and fields. Since the BDE works so closely with the actual data, it combines with the Paradox database file to create the database layer in the three layer data access model. Seagate Crystal Reports accesses the BDE through the P2bbde.dll translation file.


Microsoft Access

Microsoft Access provides several means for opening its database files. Each method has its advantages and disadvantages, and the technique that you should use may depend on how your data is set up. Below is a description of how to open Access data from Seagate Crystal Reports through the DAO engine. Another technique uses Microsoft's Open Database Connectivity (ODBC) standard, and is described in Access.

Note:

  • You can maintain Access security when opening database files with Seagate Crystal Reports by running Sysdb32.exe and select the Access Systm.mdw file. In this case, the program will look to Systm.mdw when opening an Access database and the user will be prompted for the Access password (as required) in Seagate Crystal Reports.
  • When you open an Access database using the DAO engine, Seagate Crystal Reports opens the entire database and loads information about all tables and queries from the database. To do this, Seagate Crystal Reports must reserve a large section of your computer's memory (called a buffer) in advance. Computer memory restrictions limit this buffer to 65,536 bytes (64K). This restricts the size of your Access database to about 80 tables, depending on the number of fields in your tables.


DAO

Microsoft's Data Access Object (DAO) Engine for versions of Access 2.0 and later is the part of the Microsoft Access Database Management System that actually handles your database data. As a user, you usually do not work directly with the DAO engine. It acts as a gateway through which Access data is made available to applications. Since the DAO engine is so closely tied to Access data, Seagate Crystal Reports considers it a part of the actual database.

DAO uses Microsoft's Object Linking and Embedding (OLE) technology (installed with Windows 95, Windows 98, and Windows NT) to provide access to Access data through an object-oriented approach.

In addition to Access database tables, Seagate Crystal Reports can open and use Access queries through DAO. If you are not familiar with Access queries, refer to your Access documentation. See also Opening Access queries through DAO.

Note:

  • Access Parameter queries and Cross-tab queries can only be opened through an ODBC connection. See Opening Access Parameter queries. Access Action queries are not supported by Seagate Crystal Reports.
  • When opening Access queries in a report, make sure the Views and Stored Procedures options are toggled on using the Database tab of the Options dialog box in Seagate Crystal Reports. This ensures that the queries will be visible when you open the Access database.

To translate information and data to and from DAO, the Report Designer uses the DAO translation files P2bdao.dll, P2ctdao.dll, and P2irdao.dll.

Note: Seagate Crystal Reports provides all the files necessary for reading Access data through the DAO engine. Because the program supports the most recent version of DAO, there is also native support for VSFoxPro (see Visual FoxPro). For more information on required files, refer to the Runtime File Requirements online Help (Runtime.hlp).

Secured Microsoft Access Databases

If you will be using secured Access databases, the SystemDB parameter in the Windows Registry database must be set to point at the path where the System.mda or System.mdw (Access 95) file is located. On Windows 95, Windows 98, and Windows NT systems, the SystemDB parameter is located in the following Registry key:

\\HKEY_LOCAL_MACHINE\SOFTWARE\Seagate Software\Jet\3.0\ Engines\Jet

Seagate Crystal Reports includes a utility called Sysdb32.exe to take care of setting this parameter for you. Simply run the appropriate utility and point it at the location of the System.mda or System.mdw file.


Btrieve

Seagate Crystal Reports connects to the Btrieve engine through the translation files P2bbtrv.dll and P2ctbtrv.dll.

The Btrieve engine is a complex collection of DLLs and EXEs that are specific to the version of Btrieve you are using. For more information on the different Btrieve engine files, refer to your Btrieve documentation.

Note:

  • Btrieve must be configured correctly for Seagate Crystal Reports to read Btrieve databases. If Btrieve is already configured correctly on your system, Seagate Crystal Reports can use your Btrieve data immediately upon installation. Seagate Crystal Reports automatically installs the Btrieve files that it requires to read Btrieve data. Refer to your Btrieve documentation to make sure the Btrieve engine is configured correctly.
  • When you open a Btrieve database, Seagate Crystal Reports opens the entire database and loads information about all the tables in the database. To do this, Seagate Crystal Reports must reserve a large section of your computer's memory, called a buffer, in advance. Computer memory restrictions limit this buffer to 65,536 bytes (64K). This restricts the size of your Btrieve database to about 80 tables, depending on the number of fields in each table.
Btrieve DDF files

Seagate Crystal Reports does not determine the definitions of Btrieve data files directly from the data files themselves. It needs a set of Btrieve Data Dictionary Files (.DDF) that contain file, field, and index information. Seagate Crystal Reports uses Wbtrvdef.dll and Sbtrvdef.dll to parse these DDF files. The following are the required DDFs which must all reside in the same directory:

  • File.ddf
  • Field.ddf
  • Index.ddf

A set of DDFs normally contain definitions for multiple Btrieve data files. Once one of the DDFs is selected when creating a new report, Seagate Crystal Reports immediately adds all the data files defined in that DDF into the report. Seagate Crystal Reports also takes the path defined in the DDFs as the default path of the data files. The DDFs and data files can reside in different locations.

Note: Be sure to study your Btrieve documentation for more information on Btrieve DDFs and on configuring the Btrieve engine.


Exchange

Exchange is Microsoft's successor to MS Mail. Exchange, however, includes not only e-mail, but also management of group scheduling, electronic forms, groupware, and Internet connectivity. An Exchange folder can contain standard notes (mail), files, and instances of Exchange forms. All of this data is stored in the Exchange Information Store.

Seagate Crystal Reports can report on data contained in the Exchange Information Store. Exchange data sources available for reporting include:

  • Message Tracking Logs
  • Address Lists
      • Personal Address Books
      • Global Address Lists
      • Distribution Lists
  • Exchange Folder Contents
      • mail messages
      • Exchange Form applications
      • properties of OLE documents
  • Exchange Administrator
      • properties of Exchange mailboxes on the Exchange Server
      • properties of public folders on the Exchange Server
      • replica list of public folders
      • ACL (Access Control List) of public folders.

You can use each Exchange data source like a database table and you can link each Exchange data source to other data sources. For example, you can join the Message Tracking Log to an Address List by using an e-mail address as the link field.

The data translation file used to access the Exchange data source depends on the data source that is being accessed. The following table lists each of the Exchange data translation files and describes their purpose:

File name | Data source
P2strack.dll | Message Tracking Logs
P2smapi.dll | Exchange Folder Contents and Address Lists
P2sexsr.dll | Properties of Exchange Mailboxes and Public Folders
P2srepl.dll | Replica Lists of Public Folders
P2sacl.dll | Access Control Lists (ACL) of Public Folders
P2soutlk.dll | Microsoft Outlook

Exchange translation files work directly with the Microsoft Messaging API (MAPI). MAPI acts as a database engine for Exchange data.

How the Report Designer treats Exchange data

Seagate Crystal Reports treats Exchange Administrator data (Public Folder Admin, Public Folder ACL, Public Folder Replica, and Mailbox Admin server types) as a physical database server. To access this data, you must log on using a SQL/ODBC server and select the appropriate tables from the Choose SQL Table dialog box.

When you log on to any of the Exchange Administrator servers, you must select a profile (or profiles). Each profile represents an Exchange Server.

Note: Refer to your Microsoft Exchange documentation for more information about how to set up and create Exchange profiles.


ACT!

Symantec's ACT! contact management software stores information in a relational database format similar to the xBase format. See dBASE, FoxPro, Clipper. Seagate Crystal Reports can read this data and lets you produce reports based on your contact information.

ACT! 2 databases

You open data in ACT! 2 by selecting the Crw.act file from Seagate Crystal Reports when you create a new report. Crw.act must be installed in the same directory as the program. This file forces Seagate Crystal Reports to load the P2bact.dll and P2iract.dll translation files. This step is important because ACT! 2 data looks like xBase data to Seagate Crystal Reports, so it will use the P2bxbse.dll translation file unless instructed otherwise. If this happens, the data will be translated as xBase data rather than ACT! 2 data, and may not appear correctly in your report. See ACT! databases.

ACT! 3 and 4 databases

Versions 3 and 4 of ACT! do not use an intermediate step in the translation layer. The translation files used for all ACT! databases version 3 and higher are P2bact3.dll and P2iract.dll. See ACT! databases.


Oracle 7 and 8

Seagate Crystal Reports supports direct access to Oracle 7 and Oracle 8 SQL databases. This accessibility is provided by the P2sora7.dll and P2lora7.dll translation files. These files communicate with the Oracle 7 and Oracle 8 database driver, which works directly with Oracle databases and clients, retrieving the data you need for your report.

Note: In order for Seagate Crystal Reports to use Oracle 7 and Oracle 8 SQL databases the Oracle client software must be installed on your system, and the location of the Oracle driver must be in the PATH statement of your Autoexec.bat file.


Microsoft SQL Server 6.x and 7.0

Seagate Crystal Reports provides direct access to databases created by Microsoft's SQL Server, versions 6.0, 6.5, and 7.0. The P2ssql.dll file installed with the program translates requests to the SQL server and then returns data from the server. It communicates directly with the Microsoft SQL Server driver.

Note: Network administrators and IS managers who run Microsoft's Systems Management Server for BackOffice can run reports on Systems Management Server data. Systems Management Server uses SQL Server to store system data, so the files used to access that data are the same files shown here for SQL Server.


Sybase System 10/11

Seagate Crystal Reports opens SQL data created by Sybase System 10 or System 11 directly through the P2ssyb10.dll, installed with Seagate Crystal Reports. This translation file works with the Sybase database drivers to read Sybase System 10/11 data. If your Sybase server is correctly configured, you will be able to read Sybase data as soon as Seagate Crystal Reports is installed.


Lotus Domino

Lotus Domino is a powerful groupware application used for communication and information sharing between departments in an organization.

A Lotus Domino database can be read by Seagate Crystal Reports using either a native driver or an ODBC driver. For information about the ODBC driver, see Lotus Domino. The following table compares the features of the native driver and the ODBC driver.

Feature | Native driver | ODBC driver
Logon to different servers | Yes | Yes
Use Lotus Domino client extension manager to pass password to Lotus Domino client | Yes | No
Obtain list of available databases (including subfolders) | Yes | Yes
List database filename | Yes | Yes
List database title | Yes | No
Report on Views and Forms | Yes | Yes
Distinguish between Views and Forms with same name | Yes | No
Omit Forms with no fields | Yes | No
Omit Subforms (cannot be used independently) | Yes | No
Text fields shown as strings | Yes | Yes
Text fields shown as memos | Yes | No
Rich Text fields shown as strings | Yes | No
Rich Text fields shown as memos | Yes | Yes
Computed values for composed fields | Yes | No
Multiple value fields shown as first value with proper type | Yes | No
Multiple value fields shown as string and memo | Yes | No
Converting report from other driver | Yes | Partial
Left outer join on linked tables | Yes | Yes
Other joins on tables | No | Yes

Choosing Lotus Domino during installation adds the translation files P2snote.dll and P3slnen.dll to the Windows or Winnt Crystal directory.

Note:

  • Nextpwd.dll and the Lotus API DLL (Lcppn201.dll) are installed in the Lotus Domino executable directory.
  • The following line is added to the Notes.ini file:

EXTMGR_ADDINS=extpwd

  • The Lotus Domino executable and data directories are added to the PATH.


Informix Online Server

The Informix Online Server provides client/server capabilities along with SQL compliance.

Seagate Crystal Reports opens SQL data created by Informix through the P2sifmx.dll, installed with Seagate Crystal Reports. This translation file works with the Informix database drivers to read Informix data. You must have the Informix client installed and configured properly before using this translation file.


DB2 Server

IBM's DB2 Server is an SQL compliant, client/server application that is part of IBM's popular database management suite.

Seagate Crystal Reports opens SQL data created by DB2 through the P2sdb2.dll, installed with Seagate Crystal Reports. This translation file works with the DB2 database drivers to read DB2 data. You must have the DB2 client installed and configured properly before using this translation file.


Active Data

Seagate Crystal Reports can be used to report off ActiveX data sources, including ActiveX Data Objects (ADO), Remote Data Objects (RDO), and Data Access Objects (DAO). Reports created off these data sources can be used in Visual Basic applications that use these ActiveX data sources. Visual Basic applications, Seagate Crystal Reports also supports Crystal Data Objects (CDO), which are sets of relational data created at runtime using Visual Basic arrays.

Seagate Crystal Reports also offers the ability to create reports without specifying an actual data source. This is supported through the use of a Data Definition file, which is an ASCII text file with placeholders to represent database fields. By using reports created off a Data Definition File, an application developer has the flexibility of specifying the actual data source at runtime.

The translation file Seagate Crystal Reports provides for Active Data reporting is P2smon.dll. This translation file works with a different set of drivers for each data source.


Local file system

You can use Seagate Crystal Reports to report on files located on your system or network drives including information such as file name, version number, date, and so on.

The translation file P2sfs.dll is provided by Seagate Crystal Reports for reporting on your local file system.

Note: You must have UNC (universal naming convention) read-access to your local file system. UNC is a standard format for paths that include a local area network file server. The basic syntax is: \\server\share\path\filename.


NT Event Log

If using Windows NT version 3.51 or later, you can use Seagate Crystal Reports to report on the NT Event Log. The Event Log is a database used by network administrators to record and keep track of different types of events that can occur on a Windows NT Workstation or on a Windows NT server.

Seagate Crystal Reports provides the translation file P2sevt.dll for working with NT Event Log data. This file communicates with the Event Logging API in Advapi32.dll, a part of the Windows NT operating system.


Outlook

Microsoft Outlook provides powerful organization and information management tools in the form of e-mail, calendars, task lists and other popular tools.

Seagate Crystal Reports lets you report on your Outlook data by providing the translation file P2soutlk.dll. Because Outlook data is stored in a flat file system, the translation file accesses it directly.

Note: You must have Microsoft Outlook installed, or available through UNC (universal naming convention) read-access. UNC is a standard format for paths that include a local area network file server. The basic syntax is: \\server\share\path\filename.


Microsoft IIS/Proxy log file

If you use Microsoft Internet Information Server (MS IIS), or Microsoft ProxyTM, you can use Seagate Crystal Reports to report on the log files. These log files keep track of different types of events that occur when using a web server and browser.

The translation file Seagate Crystal Reports provides for MS IIS and Proxy log files is P2smsiis.dll. Because log file data is normally stored in a flat file system, the translation file accesses it directly.

Note: You must have UNC (universal naming convention) read-access to your local file system. UNC is a standard format for paths that include a local area network file server. The basic syntax is: \\server\share\path\filename.


Web/IIS log files

You can use Seagate Crystal Reports to report on Web log files. These log files keep track of different types of events that occur when using a web server and browser.

The translation file Seagate Crystal Reports provides for Web/IIS log files is P2swblg.dll. Because log file data is normally stored in a flat file system, the translation file accesses it directly.

Note: You must have UNC (universal naming convention) read-access to your local file system. UNC is a standard format for paths that include a local area network file server. The basic syntax is: \\server\share\path\filename.


SAP

SAP, a vendor of client/server business application solutions, offers an ERP (enterprise resource planning) software package that includes SQL databases you can report on using Seagate Crystal Reports.

Seagate Crystal Reports provides access to databases created by SAP ERP. The P2srfc.dll and P2srfcaq.dll files installed with Seagate Crystal Reports translate requests to the SAP Application Server's network connectivity layer. The SAP Application Server then interprets the request and returns data from the SAP database.

Note: Seagate Crystal Reports supports access to the SAP database using the files librfc32.dll and vrf32.dll.


Baan

Baan, a vendor of client/server business application solutions, offers Baan IV, an ERP (enterprise resource planning) software package. Baan IV includes a custom SQL client/server and database you can report on using Seagate Crystal Reports.

Seagate Crystal Reports provides access to databases created by Baan IV ERP. The P2sbaan.dll file installed with Seagate Crystal Reports translates requests to the Baan SQL server and then returns data from the server.

Note:

  • The Baan client does not have to be installed to use the Seagate Crystal Reports translation file.
  • Seagate Crystal Reports supports access to the Baan database using the files Bn4c2nt2.dll and P2sbann.ini.


ODBC data sources

Open Database Connectivity (ODBC) is a standard developed by the Microsoft Corporation 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 be able to work with any source of data that can be accessed by ODBC.

There are hundreds of Database Management Systems (DBMS) available for personal computers, and thousands of applications that access DBMS data. Normally, a company that designs an application that accesses data, such as Seagate Crystal Reports, must develop a means for the application to communicate with each type of data that a customer might want to use. Seagate Crystal Reports does this with the databases that it can access directly.

On the other hand, if a DBMS simply provides a means by which ODBC can access its data, the DBMS data becomes an ODBC data source. Any application that can communicate with ODBC (such as Seagate Crystal Reports), will instantly have access to any ODBC data source. With ODBC drivers available for most common DBMS products, the range of data types that Seagate Crystal Reports can use is almost unlimited.


Advantages

Perhaps the biggest advantage to accessing data through ODBC is the ability to access a wide range of data with just one interface. Since most popular Database Management Systems now offer ODBC drivers, with more appearing every day, Seagate Crystal Reports can use any type of data you have.

Because of the extreme flexibility built into ODBC, you can use the same report file with different ODBC data sources. For example, you might design a report using an Oracle data source, and later, if your company switches to Microsoft SQL Server, you can simply change the ODBC data source used by your report. The only requirement is that the new data source must have the same structure (tables and fields) that the original data source had (although table names can be different). See Changing the ODBC data source accessed by a report.

Experienced SQL (Structured Query Language) programmers also benefit from the ODBC standard. Since Seagate Crystal Reports uses SQL to communicate with ODBC, SQL programmers and Database Administrators can view and edit the SQL statements sent to ODBC, controlling exactly how data is retrieved from the data source.

Finally, by using SQL pass-through technology to send an SQL statement to ODBC and retrieve an initial set of data, Seagate Crystal Reports off-loads much of the data retrieval and sorting work on to the server system, freeing up local memory and resources for more important tasks. In addition, only the data specified by the SQL statement is returned to Seagate Crystal Reports, reducing network traffic and the use of network resources. By working more efficiently with the original data, Seagate Crystal Reports saves you time and effort, and lets you concentrate on the design process and other more important work.

Disadvantages

Because of the many layers involved in passing data through ODBC from a database to an application, ODBC data sources often take more time to return data than natively accessed data sources. First, Seagate Crystal Reports must request some data. The request must be translated by the ODBC translation layer into a format that ODBC understands (an SQL statement). ODBC must determine where the requested data exists, and pass the request on to the ODBC data source. For more information, see DBMS translation (ODBC data source) layer. The data source must analyze the request and translate it again into a format that can be understood by the DBMS. This complex process not only takes time, but it can also fail at any of several possible levels.

In addition, ODBC data sources must be correctly configured and set up in the Odbc.ini and Odbcinst.ini files before they can be used. If you create a report on one system and try to open it on another system that does not have the same ODBC data source set up, Seagate Crystal Reports will not be able to connect to the data.

When working with ODBC, you should also be aware that the SQL language used by ODBC is based on the standards set for the SQL language by the American National Standards Institute (ANSI). Some SQL-based DBMS applications, however, provide additional features to the SQL language that are specific to that DBMS. If your data uses features unique to your DBMS, ODBC will not be able to translate those features (though in many cases it will still retrieve most of the data). See The SQL language.

Five layers

The process by which Seagate Crystal Reports accesses data from an ODBC data source consists of five layers:

  • Seagate Crystal Reports layer
  • ODBC translation layer
  • ODBC layer
  • DBMS translation (ODBC data source) layer
  • Database layer.

By using the Structured Query Language (SQL), all five layers can conveniently pass data from the database to your report.


Seagate Crystal Reports layer

When working with ODBC data, Seagate Crystal Reports generates an SQL statement that requests the appropriate data from ODBC. The powerful SQL generator built into Seagate Crystal Reports is designed to create an SQL statement that will let the ODBC data source or ODBC itself do as much of the report generation as possible, returning only the data needed to produce the report. This SQL statement can be viewed and fine-tuned by anyone familiar with the SQL language. See SQL queries.


ODBC translation layer

Seagate Crystal Reports uses the Dynamic Link Library P2sodbc.dll to communicate with ODBC. This file is unique to Seagate Crystal Reports environment and provides your report with access to any ODBC data source. This is the driver that actually passes data to and from ODBC.


ODBC layer

ODBC is a set of several DLLs and INI files built into the Windows environment that act as a gateway through which database requests and data can pass. Any database file or format that is to be used via ODBC must be set up as an ODBC data source.

In Windows 95, Windows 98, and Windows NT, the ODBC DLLs are:

  • Odbc32.dll
  • Odcccp32.dll
  • Odccint.dll (ODBC 2.5 and later).

Although information regarding data sources is recorded in Odbc.ini and Odbcinst.ini, 32-bit ODBC uses the Windows Registry database to retrieve information about individual data sources.

Note: For more information on ODBC and the ODBC files, see the Microsoft ODBC documentation.

ODBC uses the SQL language for all transactions between Seagate Crystal Reports and ODBC. Even if the database does not normally use SQL to create and work with tables, the ODBC driver provided by the database (the DBMS translation layer) must communicate with ODBC using SQL. For most users, this feature of ODBC is transparent, but more advanced users often take advantage of the features of the SQL language used by ODBC.


DBMS translation (ODBC data source) layer

This layer consists of one or more drivers provided by a DBMS that allow ODBC to communicate with the database. Seagate Crystal Reports ships with several ODBC drivers for many of the most common database formats. If you are unsure whether you can use an ODBC driver to access the data in your database, refer to the documentation for your DBMS application. Most DBMS applications that run on a Windows-based platform offer an ODBC driver.

When a DBMS provides an ODBC driver, it must register the driver with ODBC on the machine on which it has been installed. It does this by assigning a name to the driver and recording the filename in the Odbcinst.ini file. Usually, this step is handled automatically when the DBMS application is installed on the system. However, your network system or DBMS application may require that you register the ODBC driver manually with the ODBC Setup application. For more information about registering an ODBC driver with ODBC, refer to the documentation for your DBMS.

Once an ODBC driver is registered, you need to establish an ODBC data source using that driver. The ODBC data source is the object that you connect to when accessing data from Seagate Crystal Reports through ODBC. Data sources are recorded in the Odbc.ini file. The data source keeps track of the DBMS translation files (ODBC drivers) and, sometimes, the database itself. An ODBC data source can specify just a database format, such as Oracle, Sybase SQL, or MS SQL Server. Some users, however, prefer to actually specify a particular database. In this case, the ODBC data source extends across both the DBMS translation layer, and the database layer.

If you are using a client/server database, such as an SQL server, the ODBC drivers communicate with the database server through the Database Communication layer, the same layer that your database client uses to communicate with the database server.

Note: ODBC drivers find their specific DBMS client files on the local machine mainly through key directories that the DBMS client has installed in the search path (specified in Autoexec.bat). The important thing to remember is that a workstation client on a local PC must be able to connect to its server successfully. If you are not sure how to verify this, contact your IS manager.

For Seagate Crystal Reports and the ODBC drivers, it does not matter what kind of platform your database server exists on. It is the DBMS client that connects and communicates with the server; Seagate Crystal Reports and the drivers need only communicate with the DBMS client. For more information, see Using SQL and SQL databases.


Database layer

The database file which the ODBC data source refers to can be located anywhere on a system. Once the ODBC data source is set up, Seagate Crystal Reports does not need to know the actual location and format of the data. Thus, the database can have any format and can be located anywhere on a network, as long as ODBC can communicate with it through the ODBC data source.


Common ODBC database formats

Access

Although Microsoft Access files can be opened directly by Seagate Crystal Reports (see Microsoft Access), you may wish to use ODBC for these files instead. When communicating with Access databases, ODBC uses a translation file that communicates with the Microsoft Jet Database Engine through the DAO (see DAO). The Jet Database Engine is an example of a DBMS-specific ODBC driver.

The Jet engine is the part of the Access DBMS that does all of the actual work with an Access database. Jet is a required component for working with Access data. Since the Jet engine is an integral part of all Access databases, it is shown here as part of the database layer.


Excel

You can convert Microsoft Excel spreadsheets into databases that can be read by Seagate Crystal Reports through ODBC. In Excel 4.0 and earlier, use the Set Database command on the Data menu. In Excel 5.0 and later, use Define on the Name submenu of the Insert menu. Once converted, spreadsheet rows become records, and spreadsheet columns become fields. (For more information on converting your spreadsheets to database format, refer to your Excel documentation). Once the spreadsheet is converted, you can set up an ODBC data source for the file, and then select it from Seagate Crystal Reports.

Note:

  • If you are using Excel 7 or later, you can export your spreadsheets as Access database tables, and read them from Seagate Crystal Reports as you would read any other Access tables. For more information, refer to your Excel documentation.
  • You can also use the Microsoft Excel add-in to create reports in Seagate Crystal Reports.

In Windows 95, Windows 98, and Windows NT, you can set up an ODBC data source for Excel spreadsheets using the DAO engine. The DAO engine is installed on your system when you install Seagate Crystal Reports. However, you must set up an ODBC data source manually for your Excel spreadsheet. See Setting up an ODBC data source.


Informix

Seagate Crystal Reports accesses Informix databases through ODBC. The Informix client should be installed on your machine. Otherwise, Seagate Crystal Reports will provide the driver that ODBC uses to communicate with the Informix database engine.

Note: Seagate Crystal Reports provides the ODBC driver Crinf913.dll for reading Informix data.


SQL databases through Merant DataDirect

There are many different SQL Database Management Systems available on the market, and most of them can be accessed through ODBC. Seagate Crystal Reports automatically installs and sets up several ODBC data sources, allowing you to access many of the most popular SQL databases, including:

  • Oracle
  • Sybase SQL Server
  • DB2/2

Seagate Crystal Reports provides the Merant DataDirect ODBC drivers for these SQL database formats. Not all SQL databases are accessed through these drivers, but as a convenience, the program automatically sets up these drivers for you during installation. Seagate Crystal Reports still communicates with ODBC through the P2sodbc.dll translation file, but the DataDirect drivers provide ODBC with easy access to the actual databases.

Note: If you are using an SQL database not accessed by the Merant drivers, refer to your DBMS documentation for more information about the required ODBC drivers.

Do not confuse SQL databases with the SQL language. Structured Query Language (SQL) is a specialized computer language used to design, build, and read database files. See Using SQL and SQL databases.

SQL databases are any collection of computer applications that depend on the SQL language for database creation and manipulation. SQL DBMS applications are usually designed to run as large client/server applications spread across a network.

To open an SQL database, ODBC uses a set of four DataDirect ODBC support drivers (these are the same for every SQL database format), a DataDirect ODBC driver specific to the database format, and the Database Communication layer that actually communicates directly to the database file. The files provided for this DBMS translation layer are all Merant DataDirect drivers.

Note: ODBC does not have to use the Merant DataDirect drivers to access the SQL databases shown here. Most SQL DBMS applications provide their own ODBC drivers. However, Seagate Crystal Reports sets up the Merant drivers for you automatically.

Note: Seagate Crystal Reports provides Merant drivers for accessing SQL databases. These 32-bit drivers are named Cr*13.dll.

As mentioned previously, Seagate Crystal Reports automatically creates several ODBC data sources for the SQL database formats supported by Merant DataDirect. These data sources are automatically created:

  • ODBC-CRDB supports DB2/2
  • ODBC-CROR7 supports Oracle 7
  • ODBC-CROR8 supports Oracle 8
  • ODBC-CRSYB supports Sybase System 10.


Visual FoxPro

Microsoft Visual FoxPro data is accessed through ODBC, while FoxPro data from version 2.5 and earlier is accessed directly through the xBase engine. If you are using FoxPro version 2.5 or earlier, see dBASE, FoxPro, Clipper.

Seagate Crystal Reports provides the ODBC driver Vfpodbc.dll, allowing ODBC to work with Visual FoxPro data.


Lotus Domino

A Lotus Domino database can be read by Seagate Crystal Reports through ODBC. For Windows 95, Windows 98, and Windows NT, the Lotus Domino DBMS translation layer consists of three files:

  • Nsql32.dll
  • Nsqlv32.dll
  • Nsqlc32.dll

These files use the drivers installed by the Lotus Notes client to work with the Lotus Domino database. The client component of Lotus Domino must be installed on the local machine.

Note: The Domino Server can be substituted for the Lotus Notes client in the database layer of this diagram.


PeopleSoft

PeopleSoft, a vendor of enterprise application solutions, offers the PeopleSoft ERP (enterprise resource planning) system. Seagate Crystal Reports works with PeopleSoft ERP data using ODBC.

Note: The PeopleSoft client must be installed and configured properly to use the Seagate Crystal Reports ODBC translation file (P2sodbc.dll).


OLE DB

OLE DB is a database connectivity entity from Microsoft similar in conception to ODBC.

Note:

  • OLE DB is a connectivity methodology and not a database. Like ODBC, it facilitates the exchange of data created in other database management systems by providing an interface layer.
  • OLE DB requires the use of an OLE DB provider, which is the OLE DB equivalent of an ODBC driver.

Seagate Crystal Reports provides the OLE DB consumer P2soledb.dll, allowing OLE DB to communicate with an OLE DB provider.


Crystal SQL Designer files

The Crystal SQL Designer is a query which is simply a request for a specific set of data from a database. Once the data is gathered, it can be stored as a Crystal SQL Designer file (.QRY). The Crystal SQL Designer file can then be used much like a database table. The data it gathers from your SQL databases becomes a new data set that can be added to reports.

A Crystal SQL Designer file gathers data from ODBC data sources (such as SQL servers) by means of SQL (Structured Query Language). The SQL Designer sends an SQL statement with instructions to gather and return a specific set of data is sent directly to the SQL DBMS. The DBMS handles all of the actual data gathering, sorting, and grouping, according to the instructions in the SQL statement. Only the final set of data is returned to the SQL Designer and stored as a query file.

Note: If you are not familiar with SQL, see SQL join types (ODBC data sources).

First, you refine an SQL statement and create a query file that contains only the data you need. Then you design your reports based on the query file instead of on the original databases. Most of the data gathering process is done on the SQL server when you design the query. When you design your report, the Report Designer only needs to work with a small set of data, saving you time and trouble. For more information, see Creating a new query using the Crystal SQL Designer.


Advantages

While there are many reasons for using the Crystal SQL Designer, the primary one is the ability to off-load most of the data retrieval process to a server and store the resulting data as a separate data set. By using this SQL pass-through technique, where data retrieval tasks are passed through to the server, you retrieve your data faster and more efficiently. Any time you are working with SQL data, you should consider building a query file before designing your report.

In addition, the SQL Expert provides for more control over your data with the SQL language. The Report Designer provides some SQL language features when accessing SQL or ODBC data, but the Query Expert is a powerful query tool that provides more powerful SQL data access features. The Query Expert allows aggregate functions in an SQL statement and supports all data query elements of the SQL language. If you know the SQL language, you can perform complex SQL tasks using UNION operations and sub-queries. See The SQL language.

Disadvantages

Since a query represents a complete data set, any records, fields, or tables that were not included when the query was created will not be available when using the query to build a report. A report cannot be any more complex than the data it accesses, so by using a query, you limit your reporting options to the data in the query.

In addition, a query can not be used with any other source of data. If you decide to use a query in your report, you can not include an additional data source, such as a database table or another query file, to use in the report.


Crystal Dictionary files

A dictionary (.DC5) file is a structured and simplified view of organizational data that you can create for any of the individuals in your organization that are using Seagate Crystal Reports. With a dictionary, end users only see the subset of tables and fields they need.

A dictionary is an optional source of data for Seagate Crystal Reports. It provides a convenient filter, clarifying and simplifying complex data access techniques for end users, but the user can still access data directly from the database. Dictionaries simply provide all the convenience without the headaches.

If you choose to design a report by using a dictionary, you cannot use any other data source in that report. This includes other dictionaries, Seagate Crystal Reports, ODBC data sources, direct access databases, and all other data sources. The purpose of a dictionary is to provide fast, easy to understand access to a particular set of data. Connecting to other sources of data within the same report would defeat this purpose. See Creating a new dictionary.

Dictionaries allow you to:

  • design a single, dynamic view of all the data that is necessary to create organizational reports and queries
  • create a dictionary that contains 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
  • 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 reduce data misuse, loss, and damage.

Once created, the dictionary acts as a filter, providing a view of complex data that is clear and easy for any user to understand. The complexity of your data will not stop end users from creating powerful reports.

Seagate Crystal Reports reads the dictionary file by using the P2ixbse.dll file. This translation file is based on the xBase engine used to access dBASE, FoxPro and Clipper databases, but it provides all the flexibility needed to read dictionaries. See dBASE, FoxPro, Clipper.

Note: If you upgraded from an earlier version of Seagate Crystal Reports that allowed dictionary files, the older dictionary files (.DCT) were based on the Btrieve engine. If you convert those older files to new dictionary files, the new files will use the xBase translation layer instead of Btrieve. However, the Btrieve engine installed by the earlier version of Seagate Crystal Reports must remain on your system for the new dictionary application to read the older dictionary files.

The Database Access layer is the layer through which the dictionary file actually reads the original database data. Dictionaries must read database data using the same routes that Seagate Crystal Reports uses to read the data. The sections on direct access database layers and ODBC data sources describe the files dictionaries need for reading data.

The benefit of dictionaries is that this Database Access layer is completely transparent to the user. The dictionary displays a view of data in Seagate Crystal Reports that may or may not match the actual data, but that is easily accessible and convenient for users.

Finally, dictionaries provide an easy means of changing the originally accessed data without changing the view of data seen by users. For example, your original database may contain Price, Quantity, and Cost fields, and you decide that Cost can be calculated from Price and Quantity, so you eliminate the Cost field. By simply updating the dictionary to calculate Cost instead of getting it directly from the database, your users never know the difference. This is also useful when the entire underlying database format is changed. Once again, just update the dictionary.

Dictionary files are often created by an IS manager who controls a company database. The IS manager can work with data that is organized and classified to create simple, easy-to-use dictionaries for company employees. In each dictionary file, the employees will find only the data they need, since the original data has been manipulated or customized by the IS manager for varying usage.


The Crystal SQL Designer

A query is a selection statement used to obtain specific information from the database. This section describes how to use the Crystal SQL Designer to create, modify and optimize queries.


The Crystal SQL Designer

The Crystal SQL Designer creates a query, a request for specific information from a database. If you are requesting information from an SQL database (or from a database accessed 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 with SQL can take quite a while. To assist you, Seagate Crystal Reports provides you with, the Crystal SQL Designer, a component that eliminates the need to fully understand SQL so you can start building effective queries right away.

  • If you are new to querying, you will appreciate the way the Crystal SQL Designer helps you create queries. By answering a few questions on a set of sequential tabs, you'll give the program all the information needed to generate a query that fits your needs.
  • If you are an SQL professional, you will appreciate the ability to fine-tune queries that the Crystal SQL Designer generates. If you are more comfortable writing your own SQL queries, you will find it easy to enter the queries directly or even copy and paste them in from another source.

Note: The Crystal SQL Designer can only access data stored in an ODBC data source. Any database (including SQL) mentioned in this section must be accessed through ODBC.


Why use a query?

Query files provide a means of off-loading much of the data-generating tasks normally performed by Seagate Crystal Reports to the database server. The set of data returned represents a subset of the actual data in the database - only the data you specifically need.

If you are an experienced SQL programmer, the Crystal SQL Designer enables you to reuse your existing queries, quickly and easily. All of your existing queries become convenient query files that you can use to design reports with Seagate Crystal Reports.

Although Seagate Crystal Reports supports powerful SQL pass-through reporting, it does not support the full SQL language or allow you to edit every part of an SQL statement. By using the Crystal SQL Designer, you are able to use all of the power of SQL, including complex joins, sorts, and aggregate functions. In addition, a query file provides full ANSI SQL compatibility.


Using the Crystal SQL Designer

The Crystal SQL Designer has two primary uses:

  • Designing and developing data sets for building reports in Seagate Crystal Reports.
  • Retrieving and analyzing information on an "as needed" basis to facilitate informed decision-making.

Seagate Crystal Reports and query data sets

Seagate Crystal Reports enables you to design a report based on a query data set rather than on tables and fields. Since the query contains a predefined set of data, the tables and fields necessary for the report are already included.

When designing your report, you can use the set of data produced by the SQL query. The name of the query, along with fields it accesses, appear in the Insert Field dialog box. Aggregate functions and SQL expressions act like fields, providing data values corresponding to each record in the SQL query.

Data analysis and decision-making

You may not always need to produce finished reports based on your data; sometimes you just need numbers in a hurry (to prepare for a meeting, to help make projections, etc.). The Crystal SQL Designer makes it easy to get the information you need.

Sometimes you may need to retrieve the same data on a recurring basis (weekly, every month end, etc.). By setting up and saving a single query, you can retrieve updated data quickly, whenever you need it, with minimal effort.

Note: The Crystal SQL Designer cannot retrieve any number value longer than 20 characters or calculate a formula with a value longer than 20 characters. Values longer than 20 characters will be truncated.


Creating a new query using the Crystal SQL Designer

Accessing the Crystal SQL Designer

  1. On the Start menu, select Programs, select Seagate Crystal Reports, then click Crystal SQL Designer.

    Note: The location of the Crystal SQL Designer may vary depending on location you specified during installation.

  2. On the File menu, click New.

    {bmc bt_new.gif}

    The New Query dialog box appears.

  3. Click Use SQL Expert.

The Create SQL Expert appears. This expert contains six tabs that will lead you step-by-step through the query creation process.

Note: The Links tab only appears when two or more database tables are selected on the Tables tab.

Previewing data

Once you select at least one field for the query on the Fields tab, you can view the data retrieved by your query at any time, by clicking Preview Query at the bottom of the dialog box. After you are done viewing the query data, click Edit to return to the SQL Expert.


Specifying a table

  1. Click SQL/ODBC or Dictionary.

If you click SQL/ODBC:

    • Select an SQL or ODBC data source from the Log On Server dialog box.
    • Click OK.
    • Choose the tables you would like to add to the query. Click each table, then click Add. The tables appear in the list area of the Choose SQL Table dialog box. After you have added all of the tables, click Done.

If you click Dictionary:

    • Select the Dictionary (.DC5), then click OK.
    • All ODBC database tables accessible from the dictionary are added to your SQL query.

      Note: Dictionary files must be based on an ODBC data source.

  2. Click Next.

    The Links tab appears (if two or more database tables have been selected).


Linking tables and specifying a join type

When you click Smart Linking, the Create SQL Expert makes links between the matching fields of each table. The link is represented by a line with an arrow. This is referred to as a link line.


Link information

To find out more about a link
  1. Click the link line.

    The line becomes highlighted, along with the fields on either end of the line.

  2. Click Options.

    The Link Options dialog box opens, displaying the link details.

  3. Click Cancel to return to the Create SQL Expert.
  4. Click Next.

    The Fields tab appears.


Adding fields to a query

  1. Click the field from the Database Fields area you would like to have appear in your query.
  2. Click Add to move it to the Query Fields area.
  3. Click Remove to remove a field from the Query Fields area.

Identifying unique values in a query

Select the Select Distinct Values check box to activate it.


Adding a SQL expression

Note: You must have some familiarity with the SQL language and SQL expressions before trying to add an expression to your query file.

  1. Click Expression.

    The SQL Expression dialog box appears.

  2. Type a name for the new expression, then click OK.

    The SQL Expression dialog box appears.

  3. Double-click on a field in the Fields area to add it to the expression.

    The field moves into the SQL area.

  4. Edit the expression if needed.
  5. Click OK when you have finished.
  6. Select the new SQL expression.

    It will be indicated by an @ sign.

  7. Click Add.

    The field is added to the Query Fields list.


Summarizing data with aggregate functions

Aggregate functions

Use aggregate functions to obtain summary information on all records or on specific groups of records. Aggregate functions are most useful when you do not need the detailed information and you only want to examine totals.

For example, you might need the total number of orders made and the average amount of each order. For this type of query, you apply the Count function to the Order ID field, and the AVG (average) function to the Amount field. The query calculates the summary information and provides the results you need.

  1. Select the field you want to summarize from the Query Fields area.
  2. Choose an aggregate function to apply to the selected field from the Total drop-down list:
      • COUNT( ) counts the number of values within a group
      • SUM( ) adds the values within a group, to provide a total
      • AVG( ) finds the average of all values within a group
      • MIN( ) finds the minimum value within a group
      • MAX( ) finds the maximum value within a group.

        Any other fields that appear in the Query Fields area can be used for sorting.


Selecting groups to be included in a query

  1. Select the field from the Database Fields you want to summarize.

  2. From the Total drop-down list select the aggregate function to apply to the field.
  3. Click the Select tab.

  4. Select the aggregate function from the Database Fields area.
  5. Click Add.

    The field is added to the Select Fields list.

  6. Use the selection criteria drop-down lists to specify which group summary values based on the aggregate function should appear in the result.


Sorting and grouping information

You can group either by sorting data, so that records with like data appear grouped in the sorted list, or by summarizing data with aggregate functions, so that summary data appears in your query for each group of records.

  1. From the Database Fields area, select the field you want to sort.
  2. Click Add.

    The field is added to the Group Fields area.

  3. From the Order drop-down list, choose the order in which you want the data sorted.
      • In ascending order: A-Z.
      • In descending order: Z-A.
      • In original order: the order that Seagate Crystal Reports receives the records. In most cases this is the order of the data from your database.

  4. Repeat these steps for each field as required.
  5. Click Next.

    The Select tab appears.


Specifying records to be included in a query

  1. From the Database Fields area, click the field that contains the data you want to filter or specify.
  2. Click Add.

    The field is added to the Select Fields area.

  3. Use the record selection drop-down lists to specify the filter/selection criteria to be applied to the field.
  4. Repeat Steps 2 and 3 for every field in the Select Fields area. This will increase your report performance as only the records matching the criteria you have specified are included.

  5. Click Next.

    The SQL tab appears.


Editing the SQL Statement

  1. Make changes to the SQL statement as required.
  2. Click Finish.

    The Crystal SQL Designer dialog box appears.

  3. Click Yes to process the query.

    The Crystal SQL Designer window appears with the results of your query.


Creating a query from another Crystal Query

Accessing the Crystal SQL Designer

  1. From the Start menu, select Programs, select Seagate Crystal Reports, then click Crystal SQL Designer.
  2. On the File menu, click New.

    The New Query dialog box appears.

  3. Click Start from existing Seagate Query.
  4. Select the query (*.QRY) file that you want to use as the base for your new query.
  5. Click OK.

    The program runs the existing SQL query and displays the data set.

  6. On the Edit menu, click Query.

    The Create SQL Expert appears with the specifications for the selected query already in place.

  7. Use the Create Query Expert to make any changes necessary to the query.
  8. Click Finish after completing all of the changes.
  9. Click Yes to process the query.

    The Crystal SQL Designer window appears with the results of your query.

  10. On the File menu, click Save As to specify a name for the new query. The new query is saved in a separate file; your source query remains unchanged.


Selecting a query for a report

  1. From the Start menu, select Programs, select Seagate Crystal Reports, then click Crystal Report Designer.
  2. On the File menu, click New.

    The Seagate Report Gallery appears.

  3. Confirm Standard is selected, then click OK.

    The Standard Report Expert appears.

  4. Click Query, from the Data tab.

    The File Open dialog box appears.

  5. Locate the queries (.QRY) file you want to use to create the new report.

    This example uses the sample query in the Queries folder.

    Note: Only one query file can be used with each report.

  6. Click Open.

    The query file for your report is added to the Data tab.

  7. Continue working through each of the tabs in the Standard Report Expert to finish designing the report.


Creating a parameter field for use in a query

A parameter field can be created while previewing a query in the Crystal SQL Designer.

  1. On the Edit menu, click Parameter Field.

    The Enter Name dialog box appears.

  2. Enter the name you want to use to identify the parameter, then click OK.

    The Parameter Field dialog box appears.

  3. Enter the following information in the fields provided:
      • Prompting Text: Enter the text you want to appear when the program prompts you.
      • Value Type: Enter the data type of the parameter field.
      • Default Prompting Value: Enter the value you want the program to use if you do not supply a new value.
      • Browse Field: Use this drop-down list to specify a default field.
  4. Click OK.

The parameter field can now be used in your query.


Using an SQL query that was designed elsewhere

  1. Copy the SQL statement to the Windows Clipboard.

    Most SQL editors allow the SQL statement to be copied to the Clipboard by using the Ctrl-C key combination.

  2. From the Start menu, select Programs, select Seagate Crystal Reports, then click Crystal SQL Designer.
  3. On the File menu, click New.

    The New Query dialog box appears.

  4. Click Enter SQL Statement.

    The Log On Server dialog box appears.

  5. Select the Server Type, then click OK.

    The SQL Server Login dialog box appears.

  6. Enter your user ID and password to log on to the SQL server, and click OK.

    A message appears indicating the success of your log on.

  7. Click OK.

    The Enter SQL Statement dialog box appears.

  8. Enter the SQL statement in the SQL area. Click anywhere inside the box to place an insertion point.
  9. Press Ctrl-V or click Paste to paste the SQL statement into the SQL area.

    From within the SQL area you can make changes to the SQL statement. If needed, you can even delete the statement, and create a new one.

  10. Click OK.

    The Crystal SQL Designer dialog box appears.

  11. Click Yes to process the query.
  12. On the File menu, click Save to save the new query.

The old SQL statement becomes a new SQL query that can be used with Seagate Crystal Reports just like any other SQL query file.

Alternatively, you can import a SQL statement saved in an ASCII text file. To do so, follow Steps 2 through 6 to open the Enter SQL Statement dialog box and log on to the ODBC data source, then click Import to import the SQL statement from the text file.


Dictionaries

Dictionaries are structured and simplified views of data that can be created for some or all of the individuals in an organization. When working with Dictionaries, users see only the information they need and that you want them to see. They reduce support costs and time, and reduce data misuse, loss, and damage. This section shows how to set up and use Dictionaries to improve organizational efficiency and security.


Dictionary overview

A dictionary is a structured and simplified view of data that you can create for some or all of the individuals in your organization that are using Seagate Crystal Reports.

Unlike some systems that force users to access data through a data distribution metalayer, dictionaries are optional components. Data can still be accessed directly by the user. Dictionaries simply provide all of the convenience without the restrictions.

Dictionaries allow you to:

  • design a single, dynamic view of all the data that is necessary to create organizational reports and queries
  • organize the data and rename tables and fields to make it easier for users to understand the content and purpose of the data
  • create complex data-manipulation formulas that users can access without the need to understand formula concepts.

Note: The Formula Editor used in Crystal Dictionaries is not as complete as the one used in Seagate Crystal Reports.

Dictionaries reduce data misuse, loss, and damage. When a Dictionary is used to create a report, the only data used in the report is the data accessed through the Dictionary. You can not use a Dictionary and some other data source in the same report. Because Dictionaries are 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.

Finally, Dictionaries provide an easy means of changing the underlying data set without changing the view of the data seen by users. You can change field and table names in the underlying data, for example. Then you remap the Dictionary to the new field and table names without changing the aliases assigned to the data. The users create their reports using the same data interface they've been using, never knowing what has changed under the surface.

Once created, the Dictionary acts as a filter, providing a view of complex data that is clear and easy for any user to understand.


Using a dictionary

Dictionaries are often designed and distributed by Information System (IS) Managers or Network Administrators who control and manage a company's databases. These databases are often complex collections of data spread throughout several tables with hundreds or even thousands of fields. A user, trying to locate and use a small set of data for a report, can easily get lost among database, table, and field names.

By creating a customized dictionary that contains a small amount of data specific to the work performed by a small group of users, you provide those users with clear and easy access to all of the data they need. For example, the Accounting department's dictionary can be different from the Sales department's dictionary, or the Personnel department's dictionary. Some data may overlap between dictionaries, but it can be named and organized in a fashion that best suits the users accessing it.


Creating a new dictionary

  1. Open Seagate Crystal Dictionaries.
  2. Click the New button on the toolbar.

    The Crystal Dictionary Expert appears.

    This Expert contains several tabs. Each tab is numbered to lead you through the development process step-by-step.

    Note: The Links Tab appears only when you have added more than one table to your dictionary.

  3. To access the options on each tab, click the tab. Information and controls needed for the selected step will be displayed in the dialog box. You may also use the Next>> and <<Back buttons to go to the next (right) and previous (left) tabs.

    Note: Certain steps must be performed before others in the creation process. For example, you must select tables before you can select fields from those tables. For that reason, some tabs may not be available until you perform the required steps prior to selecting those tabs.

  4. Click Save at the bottom of the Expert to save at any time.

    Note: Since a dictionary must contain some database data, the Save button will be disabled until you add at least one field to the Headings & fields in View list box on the View tab.


Adding tables to a dictionary

Adding a data file

  1. While in the Crystal Dictionary Expert, click the Tables tab.

  2. Click the Data File button.

    The Choose Database File dialog box appears.

  3. Use the options in this dialog box to highlight a database file.
  4. Click Add to add the file. If the selected database file contains only one table, that table will appear in the list box on the Tables Tab.

    Note:

      • When there is more than one table to add from the selected database file, the Select Tables dialog box appears. Highlight the tables you wish to include from the list and click OK. Only the tables you selected will appear in the list box on the Tables Tab. See Designing the view of the data.
      • You cannot create a dictionary from two different data sources.
  5. Repeat Steps 3 and 4 for each database file you want to add to the dictionary.
  6. Click Done when you are finished adding database files.

    Note: When a database file is added, the tables and fields from that file will not necessarily appear to the user who opens the dictionary from the Report Designer. The tables that appear on the Tables Tab are only the tables available to the creator of the dictionary. To add specific fields, see Designing the view of the data.

    You may also need to choose an index file to be used by one of the database tables. This is done on the Tables Tab:

  7. Highlight the database table you want to pick a specific index for.
  8. Click the Index button.

    The Choose New Location dialog box appears.

  9. Use the controls in this dialog box to highlight a new index file, and click OK when finished.

    Note: By default, Crystal Dictionaries will use any index file it finds with the same name as the database file. You only need to select an index file if you want to use an index with a different name than the database file.


Adding an SQL or ODBC data source

  1. While in the Crystal Dictionary Expert, click the Tables tab.

  2. Click the SQL/ODBC button.

    The Log On Server dialog box appears.

  3. Select an SQL or ODBC data source and click OK when finished.

    If the data source requires any log on information, such as user name and password, the SQL Server Login dialog box appears.

  4. Log on to the ODBC data source just as you normally do from your Database Management System application.
  5. Click OK.

    The Choose SQL Table dialog box appears.

  6. Highlight a database in the SQL Databases list box.

    The SQL Tables list box displays all of the tables for the database you selected.

  7. Highlight the table you would like to have included and click Add to add it to your dictionary.
  8. Repeat Step 7 for each table you want to add to the dictionary.
  9. Click Done when finished.

Note: When an SQL or ODBC data source is added from the Tables Tab, the tables and fields from that data source will not necessarily appear to the user who opens the dictionary. The tables that appear on the Tables Tab are only the tables available to the creator of the dictionary, for adding to the dictionary. See Designing the view of the data.


Linking multiple tables

If you have added more than one database table to your dictionary click the Links tab in the Crystal Dictionary Expert.

Creating a link

  • If a link is possible between two tables, you can create a new link by dragging a field name from one table to the other. The application will draw a new link arrow between the tables.
  • If you click the Smart Linking button, the application will create logical links between tables in your Dictionary.

Changing a link

  • If you select a link and click the Options button, the Link Options dialog box appears. You can use the controls in this dialog box to make any necessary changes to the highlighted link.


Designing the view of the data

Selecting tables and fields for users

After using the Tables tab to add tables to the dictionary, those tables, and the fields in them, are not automatically available to users. The View tab must be used to expose these fields. The View tab lets you design the actual view of the data that the users will see.

  1. While in the Crystal Dictionary Expert, click the View tab.

  2. Highlight the field you want to make available to users from the Tables & fields from database list.
  3. Click the Add button.

    The field is added to the Headings & fields in View list.

To make a table and all its fields available to users

Highlight the table name in the Tables & fields from database list box, and click Add. The table name becomes a field heading in the Headings & fields in View list box. All fields from the table appear as fields under the new field heading.


Key points

When adding and organizing tables and fields in the View Tab, keep in mind the following points:

  • Tables are not displayed to the dictionary user as database tables. Table names become field headings. These headings appear just like tables when the user designs a report based on your dictionary. However, field headings do not necessarily represent database tables that actually exist.
  • Field headings can be added anywhere in the Headings & fields in View list box to provide clearer organization of data for your users. See Adding Help text.
  • Fields can be added to the View list box as many times as necessary. A field does not have to appear under a field heading that matches the table the field exists in. Organize fields in any order and under any field headings that will work best for your users.
  • Fields must be grouped under field headings. If you add a single field to the Headings & fields in View list box and no field heading appears in the list box (the list box is empty), the application will provide a default field heading for you and will add the field you selected underneath that heading.
  • Field names and field headings that appear in the Headings & fields in View list box can be renamed to anything you want. See Renaming fields, field headings, and formulas.


Adding formulas to the view

  1. While in the Crystal Dictionary Expert, click the View tab.

  2. Click the New Formula button.

    The Insert Formula dialog box appears.

  3. Type a name for the formula and click OK when finished.

    The Formula Editor appears.

  4. Use the Formula Editor to create a formula for the Dictionary, just as you would create a formula for a report.

    Note: The Crystal Dictionary supports formulas created in Crystal syntax only. See Creating Formulas with Basic Syntax.

    Not all Crystal functions are available in the formula editor in the dictionary designer.

  5. Click Accept when finished.

    The new formula is added to the Tables & fields from database list box.

  6. To add the formula to the view, highlight the formula you just created in the Tables & fields from database list.
  7. Click the Add button. The formula field is added to the Headings & fields in View list.
  8. To modify a formula, highlight it and click the Edit button.

Note: Normally, formulas are represented with an @ symbol. The formula name appears in the Headings & fields in View list box without the @ symbol to hide the fact that this is a formula.


Organizing the view of the data

Adding a new field heading

  1. While in the Crystal Dictionary Expert, click the View tab.

  2. Highlight the field that will be the first to appear under the new field heading from the Tables & fields from database list box.
  3. Click the Heading button.

    The Insert Field Heading dialog box appears.

  4. Type the new name into the text box and click OK when finished.

    The new field heading appears in this list, as specified.


Moving fields/field headings

  1. While in the Crystal Dictionary Expert, click the View Tab.
  2. Highlight the heading or field you want to move from the Headings & fields in View list and drag it up or down to the desired position.

    The order that the fields and field headings appear in this list box is the order that they will appear to users.

Note: When organizing fields and field headings, remember that field headings take the place of database tables. Because of this organization, the first item in the list box must be a field heading.


Renaming fields, field headings, and formulas

  1. While in the Crystal Dictionary Expert, click the View Tab.
  2. Highlight the heading or field you want to rename.
  3. Click Alias.

    If you chose a heading, the Set Table Alias dialog box appears.

    If you chose a field, the Set Field Alias dialog box appears.

  4. Type the new name into the text box and click OK when finished.

Note: This process does not actually rename tables or fields. Only the alias name that appears to the user opening the dictionary is changed. The original database file is not affected.


Updating the location of a database table

  1. While in the Crystal Dictionary Expert, click the Tables tab.

  2. Highlight the table or field that has changed name or location from the list box.
  3. Click the Location button.

    Note: Remember, the table names that appear here are aliases rather than the actual database table names.

    If the table is from a data file, the Choose New Location dialog box appears.

    If the table is from an SQL server or other ODBC data source, the Choose SQL Table dialog box appears.

  4. Highlight the new name or location of the database table from the dialog box that appears, and click OK.


Adding Help text

To maximize the efficiency of your dictionary, Seagate Crystal Reports allows you to add Help text. Whenever anyone needs clarification on what the elements of your dictionary are, they can point to the item in question and Help text will appear in a pop-up window to assist them.

  1. While in the Crystal Dictionary Expert, click the View tab.

  2. Highlight the field that you want to add Help text to from the Tables & fields from database list box.
  3. Click the Help Text button.

    The Edit Help Text dialog box appears.

  4. Enter the Help Text and click OK when finished.

    When the user selects a field or field heading and holds the cursor over the selected item, the Help text appears in a pop-up window.


Adding graphics to the dictionary

  1. While in the Crystal Dictionary Expert, click the Graphic tab.

  2. Click the Add button.

    The File Open dialog box appears.

  3. Use the controls in the File Open dialog box to highlight a graphic image file, and click OK to add it to the dictionary.

    Dictionaries support the Windows bitmap (.gif), PC Paintbrush (.PCX), Tiff (.TIF), and TARGA (.TGA) graphic formats. The image file appears in the list box of the Graphic Tab.


Organizing graphics

You may now want to change the name, update the location, or delete a graphic. Highlight the desired graphic and click the appropriate button for your needs.

  1. Highlight the desired graphic in the Add pictures to Dictionary, change names or update location list box.
  2. Click the Alias button to change the name,
      • click Delete to delete the graphic from the list, or
      • click the Location button to change the location.
      • If you clicked the Alias button, the Set Graphic Alias dialog box appears.

  3. Type a new name for the graphic in the Enter a new graphic alias text box and click OK when finished.

Note: If you clicked the Location button to set the new location of the image, the Choose New Location dialog box appears. Use this dialog box to find the new name and/or location of the graphic file.


Creating sample data for users to browse

The Sample Data Tab in the Dictionaries Expert lets you create a set of custom sample data that appears to users when they browse field data. The data they see may or may not reflect actual data in the database, depending on the sample data you design.

  1. While in the Crystal Dictionary Expert, click the Sample Data tab.
  2. If the data has changed, click the Refresh button to retrieve a list of the new data.

  3. Highlight a field that you want to make browseable from the Headings & fields in View list.
  4. Click the Collect button. The selected values will be added to the Browsed data list.
  5. To modify any of the browseable data, highlight a value, then click either Delete to delete the value or Edit to change it.

    If you clicked the Edit button, the Edit Value dialog box appears.

  6. Enter the new value in the text box and click OK when finished.

    The new value appears in the Browsed data list box.

Note: Deleting and editing values in the Browsed data list box of the Sample Data Tab does not change the database file. It only changes the list of values that appears to a user whenever the Browse and Paste dialog box is opened. This allows you to customize the look of the data when users browse data, without actually changing the data that is reported on.


Working with an existing dictionary

Accessing a dictionary for your report

When creating a new report in Seagate Crystal Reports, you can specify a dictionary as your data source. By using a dictionary for your report, administrators can monitor company information being disclosed and users are not burdened by extra data they will not be using in their reports.

Note: You cannot use more than one dictionary file in a report at a time. Also, you can not link fields from dictionary files to fields in other database tables.

To access a dictionary
  1. Click the New button on the Standard toolbar in Seagate Crystal Reports.

    The Seagate Crystal Report Gallery appears.

  2. Click Using the Report Expert button.
  3. Select the type of report you want to create from the Choose an Expert list.
  4. Click OK.
  5. In the Standard Report Expert dialog box, click Dictionary.
  6. Select the dictionary you want to use.

    You return to the Standard Report Expert. The field headings of the data in the dictionary are listed on the right.

  7. Click the Fields tab.

    The database fields from the dictionary are listed

  8. Select the database fields you want to include in your report.
  9. Click Add.
  10. Click Next to move to the next folder to have the report expert help you

    sort the data.

  11. Continue to click Next if you want the Report Expert to help you design the rest of your report.
  12. Click Design Report to access your report.

    The Seagate Crystal Report Expert closes and creates a report based on your specifications.


Editing an existing dictionary

  1. Click the Open button on the Crystal Dictionaries toolbar.

    The File Open dialog box appears.

  2. Choose the existing dictionary file and click OK.

    The Crystal Dictionary Expert appears.

  3. Use the Expert to make changes to the dictionary file.


Converting a 4.x or 5.x dictionary file

  1. Click the Open button on the toolbar.

    The File Open dialog box appears.

  2. Select the old dictionary (*.DC5) file and click OK.

    The Select View dialog box appears, listing the names of all views from the old dictionary file.

  3. Highlight the view you want to convert to a new dictionary file, and click OK.

    The Crystal Dictionary Expert appears with the data from the view you selected.

Note: This version of Crystal Dictionaries provides an easier and more powerful method for controlling data access than earlier versions. However, each view from an older dictionary file is handled as a separate dictionary in this version. An older dictionary file, on the other hand, held several views. To convert an entire dictionary 4.x or 5.x file, you must open each view in the file separately and save it as a new dictionary file.

  4. Use the Expert to make changes to the new file.
  5. When the file is saved, it will be saved in the new dictionary format (*.DC5).


Report Processing Model

This section provides you with in-depth information about the Report Processing model. This model determines the order in which data is accessed and manipulated during report generation.


Overview

Seagate Crystal Reports uses a three-pass reporting method to generate reports. The sections below describe what happens during each step of this process. To see a visual representation, refer to the flow-chart at the end of this section.

What is a "pass"?

A pass is a process that Seagate Crystal Reports uses each time the data is read and manipulated. Depending on the complexity of the report Seagate Crystal Reports may make 1, 2, or 3 passes over the data. This feature allows for complex reporting and formula manipulation.


Pre-pass #1

When previewing a report, the first elements to be evaluated are "constant" formulas. Constant formulas are those that have a constant value for the entire report. They do not change from record to record. For example, 100* 30 would be a constant formula. Constant formulas are evaluated at the beginning of the print generation process and are never evaluated again. This process is known as "BeforeReadingRecords." If you were to place a constant formula field (i.e., 100*30) in the Details section, the result would be 3000 for each record displayed.


Pass #1

After the "BeforeReadingRecords" process has taken place, Seagate Crystal Reports begins reading the database records. During the record reading process, the following will occur:

  • Record retrieval. Where possible record selection and sorting are pushed down to the database in this step.
  • Evaluation of recurring formulas. These formulas are those that contain database fields but do not contain references to subtotals or summary information. This evaluation time is known as "WhileReadingRecords."Formulas that contain references to subtotals or summary information are processed in the second pass.
  • Application of the record selection locally. If the record selection is too complex to be pushed down to the database, it is applied by Seagate Crystal Reports in this step.
  • Sorting, grouping, and totaling. In this step, Seagate Crystal Reports sorts the records, separates them into groups, and then calculates the subtotals and summaries needed for each group.
  • Cross-Tab generation.
  • Storage of saved data. After the totaling process is complete, all of the records and totals are stored in memory and to temporary files. Crystal Reports does not read the database again, but instead uses this saved data during all subsequent processing.


Pre-pass #2

During Pre-Pass #2, Seagate Crystal Reports orders the groups in the report for Top/Bottom N or Hierarchical Grouping. The records are not read in this process, instead Seagate Crystal Reports only looks at group instances from Pass 1, and takes the Top N as appropriate, or orders the groups based on the Hierarchical Grouping settings specified.


Pass #2

Seagate Crystal Reports enters the second pass through the data to format pages. The pages are formatted on demand. This means that Seagate Crystal Reports will not format a page until it is requested by the user, or it is required for the total page count in Pass #3.

During page formatting, Seagate Crystal Reports does the following:

  • Group selection formula
  • Running totals
  • Calculation of formulas marked "WhilePrinting Records"

    These are formulas that contain references to subtotals or summary information, also known as "PrintTime" formulas. This evaluation time is known as "WhilePrinting Records".

  • Charts and maps
  • Subreports
  • Generate Pages on Demand.

Note: Subtotals, grand totals, and summaries may be incorrect if the report has a group selection formula. This occurs because the grand totals and summaries are calculated during Pass #1, but the group selection formula filters the data again in Pass #2. Running total fields can be used instead of summaries to total data in reports with a group selection formula.


Pass #3

In the third, and final pass, the total page count is determined. This applies to reports that use the total page count, or Page N of M, special variable fields.


Multi-pass reporting flow chart

Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com


Product Support

This section provides you with information about how to contact Seagate Software to register your product and how to obtain technical support. It also includes details about our product return and replacement policies.


Product registration

When using Seagate Crystal Reports for the first time, a dialog box appears that asks for your name, address, and related information. Then you are prompted to register the product to receive your Registration Number.

Registration methods:

  • If you have access to the Internet, fill out the Product Registration form on the Seagate Software web site at:

    http://www.seagatesoftware.com/register

    Or access the form from the Help menu by clicking Register/Change Address.

  • Print the Product Registration form and then fax it to the Registration Fax number closest to you. Seagate will then fax back to you a registration number that can be entered into the product the next time you use it.

    Registration Fax Numbers

    USA/Canada +1 (604) 681-5147
    United Kingdom +44 (0) 181 231 0649
    Australia +6 2 9955 7682
    Hong Kong +852 2893 2727
    Singapore +65 777 8786

  • Fill out the Registration Form and mail it to Seagate Software. Seagate will mail a registration number back to you to enter into the product.

Registering the program will ensure that you are kept up-to-date with product advancements, and it will enable Seagate to provide quality technical support to people that are properly registered with Seagate Software.

When you enter the Registration Number, you have completed the registration process.


Product support

Seagate Software is proud of the quality of its product and has spent a great deal of time trying to make it intuitive to use. If, however, you need assistance with something, consult the online Help system. The Help system can be accessed by clicking any Help button, by pressing the F1 key, or by selecting an option from the Help Menu. The Help system contains all of the information from the User's Guide, as well as in-depth explanations and examples of all the reporting concepts.

Note: Product support plans vary from region to region. Contact your Seagate Software Office/Distributor for a list of product support plans available in your region.

See Seagate Software International Office Directory for a list of Seagate Software International Offices.


Web support

Seagate Software web site

To connect to the Seagate Software web site
  1. Click Help.
  2. Select Seagate Software on the Web.
  3. Click Seagate Software Home Page.

Or enter the following address into your web browser:

http://community.seagatesoftware.com

Note: "community" replaces "www" in the web address.


Seagate Software Product Support

The Seagate Software Product Support web page provides a number of different support methods. These include Answers by Email, Files and Updates, Forums, and the Seagate Knowledge Base.

To connect to the Seagate Software Product Support web page
  1. Click Help.
  2. Select Seagate Software on the Web.
  3. Click Online Support.

Or enter the following address into your web browser:

http://community.seagatesoftware.com/support

Note: "community" replaces "www" in the web address.


Email support

Email

  • answers@seagatesoftware.com

To submit a Technical Support issue by email:

  • Email a blank message to the address above. Leave everything blank and the system will send you back a form to complete.
Newsletter Service

  • http://community.seagatesoftware.com/myprofile/subscribe.asp
      • Seagate Software's Newsletter Service provides subscribers with information about product updates, current events, and new product releases.
      • Each product you select will add your email address to that particular topic's newsletter group. You may select multiple products and you may select both marketing and technical information. You will then see a confirmation page that simply asks you to verify your information. You may unsubscribe from any list at any time.


Fax support

Another efficient way to receive support for Seagate Crystal Reports is to fax your technical support request. To do this, first fill in the bottom part of the Technical Support Request form included with the product. This form appears when you choose the Technical Support Request from the Help Menu. When you have completed the form, click Print Request to print it.

Fax the completed form to Seagate Software at +1 (604) 681-7163. This service is available Monday through Friday (24 hours a day).

After a technical product specialist has had a chance to review your fax, they will respond to you by return fax the next business day.


Technical support

Seagate Software offers several levels of telephone support for Seagate Crystal Reports.

Priority Technical Support

Seagate Crystal Reports Priority Technical Support is designed to get you priority-queue response while saving you money on long-distance calling fees.

  • Money-Saving Toll-Free Number**
  • Priority-Call Response
  • Extended Calling Hours**
  • Online Services for 24-Hour Support
  • Affordable One-Year Contract

Money-Saving Toll-Free Number**

Get unlimited access to a toll-free number and save money on expensive long-distance calling times.

Priority-Call Response

We guarantee the fastest possible response times for Priority Support incidents. All Priority Support calls take precedent over Standard Support calls.

Extended Calling Hours**

Extended calling hours ensure you can get the answers you need, at the right time. We offer extended calling hours Monday to Friday from 8:00am - 8:00pm EST.

Online Services for 24-Hour Support

Seagate Software provides the tools for you to independently get fast answers to technical questions. We have a number of online services for unlimited email and web-based support, 24 hours a day, 7 days a week.

Affordable One-Year Contract

Sign-up for Seagate Crystal Reports Priority Support for a one-year contract from the date of purchase.

**Availability of toll-free numbers and extended calling hours varies by region.

Contacting Us

For more information, or to purchase Seagate Crystal Reports Priority Support, visit our web site at http://www.seagatesoftware.com or contact us at the office nearest you.

Canada/USA: 1-800-877-2340 or 1-604-681-3435

Europe/Middle East/Africa: +44-181-566-2330

Asia/Pacific: +61-2-9955-4088


Standard Technical Support

Seagate Software provides customers with free phone, email and fax support for Seagate Crystal Reports users during regular business hours, Monday through Friday. Standard Support is free* to all registered users. We encourage you to register your product to ensure you have timely access to our technical support services.

*Free technical support is available for the first 60 days from the date of purchase.

Location | Days | Times
North America +1 (604) 669-8379 | M-F | 11:00am - 7:00pm EST
Austria + 43 (0) 1 79 5672 85 | M-F | 9:30am - 5:00pm CET
Belgium + 32 (0) 2 713 12 35 | M-F | 9:30am - 5:00pm CET
France +33 (0) 141 918630 | M-F | 9:30am - 5:00pm CET
Germany +49 (0) 699 509 6180 | M-F | 9:30am - 5:00pm CET
Ireland + 353 (0) 1 407 30 30 | M-F | 9:00am - 4:00pm GMT
Netherlands + 31 (0) 20 346 9201 | M-F | 10:00am - 5:00pm CET
Sweden + 46 (0) 85 87 711 45 | M-F | 10:00am - 5:00pm CET
Switzerland (German) + 41 (0) 1 800 9134 | M-F | 9:30am - 5:00pm CET
Switzerland (French) + 41 (0) 1 800 9130 | M-F | 9:30am - 5:00pm CET
UK +44 (0) 181 231 0638 | M-F | 9:00am - 4:00pm GMT

Note: Long-distance charges may apply. Telephone numbers vary with location.

If you are calling from Africa or the Middle East, see Seagate Software International Office Directory to find out the telephone number of the support office closest to you.

If the country you are calling from is not listed above call the North American Standard Technical Support number at +1 (604) 669-8379.

Please have the following information available:

  • Product registration number.

    If you are registered, you can find the product registration number by choosing About Crystal Report Designer from the Help Menu.

    If you are not registered, you will need to register to obtain the product registration number.

  • Product name and version number.

    From the Help menu, click About Seagate Crystal Reports.

  • Operating system you are using.

    For example, Windows 95, Windows 98, Windows NT, or Windows 3.11.

  • Version of the database and other software you are using with Seagate Crystal Reports (if required).

    Access, Btrieve, SQL, Sybase, Paradox, etc.

  • Network information, if you are on a network.
  • Contents of AUTOEXEC.BAT and CONFIG.SYS files.
  • The list of steps necessary to recreate the problem.
  • The programming environment (if applicable).


Seagate Knowledge Link

Our Seagate Software Technical Product Specialists have created the Seagate Knowledge Link - our searchable database of technical reference articles. Shipped on CD, this application includes a base library of articles that can help new and experienced users resolve current technical issues. Seagate Knowledge Link includes 12 months of regular Technotes delivered bi-weekly via email.

Contacting Us

For more information, or to purchase Seagate Knowledge Link, visit our web site at http://www.seagatesoftware.com or contact us at the office nearest you.

Canada/USA: 1-800-877-2340 or 1-604-681-3435

Europe/Middle East/Africa: +44-181-566-2330

Asia/Pacific: +61-2-9955-4088

See Seagate Software International Office Directory to find out the telephone number of the sales office closest to you.


Product return policy

If you are not satisfied with Seagate Crystal Reports for any reason, you can return it to the original place of purchase for a refund within 30 days of the purchase date.


Product replacement policy

If your Seagate Crystal Reports CD or documentation is defective, then please contact Seagate Software, Inc., within 30 days of the purchase date. Fax a description of the problem and Seagate will solve it as quickly as possible. Please fax the description of the defect to +1 (604) 681-2934.

Note: Replacement policies vary from region to region. Contact your local distributor for a list of replacement policies available in your region.


Seagate Software International Office Directory

This section lists the contact information for Sales, Product Support, and Product Registration at each Seagate Software office, worldwide.


North/South American Head Office

Canada & USA

Seagate Software, Inc.

840 Cambie Street

Vancouver, BC V6B 4J2

Canada

Sales

Telephone: 604-681-3435

Toll-Free: 1-800-877-2340

Fax: 604-681-2934

Email: sales@seagatesoftware.com

Product support

Phone: 604-669-8379

Fax: 604-681-7163

Email: answers@seagatesoftware.com (Available in English only)

Web browser: http://community.seagatesoftware.com/support
(Available in English only)

Note: "community" replaces "www" in the web address.

Product registration

Fax: 604-681-5147

Email: answers@seagatesoftware.com

Web registration: http://www.seagatesoftware.com/register


Latin America

Seagate Software, Inc.

Suite 270 - 510 Thornall Street

Edison, NJ 08837

USA

Sales

Telephone: 732-321-6500

Fax: 732-321-6504

Product support

Please see the Product Support section listed under Canada.

Product registration

Please see the Product Registration section listed under Canada.


Asia/Pacific Offices

Australia

Seagate Software Pty Ltd.

Level 9, 52 Alfred Street

Milsons Point, NSW 2061

Australia

Sales

Telephone: +61 2 9955 4088

Sales: +1-800-647-006

Fax: +61 2 9955 7682

Product support

Please see the Product Support section listed under Canada.

Product registration

Fax: +61 2 9955 7682

Online registration: please see the product registration section listed
under Canada.


Hong Kong

Seagate Software (HK)

Suite 2603, 26th Floor

Universal Trade Center

3 Arbuthnot Road, Central

Hong Kong

Sales

Telephone: +852 2575 2576

Fax: +852 2893 2727

Product support

Please see the Product Support section listed under Canada.

Product registration

Online registration: please see the product registration section listed
under Canada.


Japan

Seagate Software KK

Bridgestone Bldg. 2F

2-13-12 Hirakawa-cho,

Chiyoda-Ku,

Tokyo 102-0093

Sales

Telephone: +81. 3. 5226. 3601

Fax: +81. 3. 5226. 3606

Email: sales_jp@img.seagatesoftware.com

Product support

Fax support: +81.3.5226.3605

Support email: support_jp@img.seagatesoftware.com

Product registration

Fax registration: +81.3.5226.3605

Email: answers@seagatesoftware.com

Web registration: http://www.seagatesoftware.com/register


Singapore

Seagate Software IMG

14 Science Park Drive

03-02 The Maxwell

Singapore Science Park

Singapore 118226

Sales

Telephone: +65 777 0533

Fax: +65 777 8786

Product support

Please see the Product Support section listed under Canada.

Product registration

Online registration: please see the product registration section listed
under Canada.


Europe/Middle East/Africa Offices

United Kingdom - EMEA and Northern European Head Office

Seagate Software

The Broadwalk

54 The Broadway

Ealing, London

W5 5JN

UK

Sales

Telephone: +44 (0) 181 566 2330

Fax: +44 (0) 181 231 0600

Product support

Country | Telephone | Language
UK | +44 (0) 181 231 0638 | English
Austria | + 43 (0) 1 79 5672 85 | German
Switzerland | + 41 (0) 1 800 9134 | German
Switzerland | + 41 (0) 1 800 9130 | French
Belgium | + 32 (0) 2 713 12 35 | French
Netherlands | + 31 (0) 20 346 9201 | English
Ireland | + 353 (0) 1 407 30 30 | English
Sweden | + 46 (0) 85 87 711 45 | English

Fax: +44 (0) 181 231 0600 (English, German, French)

Email: answers@seagatesoftware.com (available in English only).

Web browser: http://community.seagatesoftware.com/support
(available in English only).

Note: "community" replaces "www" in the web address.

Product registration

Fax: + 44 (0) 181 231 0649

Email: answers@seagatesoftware.com

Web registration: http://www.seagatesoftware.com/register


Scotland

Seagate Software IMG

The Station Master's Office

Dalmeny Station

South Queensferry West

Lothian

EH30 9JP

Scotland

Sales

Telephone: +44 (0) 1506 410444

Fax: +44 (0) 1506 414994

Product support

Please see the Product Support section listed under Northern European
Head Office.

Product registration

Online registration: please see the product registration section listed under Northern Europe.


Sweden

Seagate Software

Kanalvagen 10C

194 61 Upplands Vasby

Sweden

Sales

Telephone: +46 8 590 04150

Fax: +46 8 590 04110

Product registration

Please see the Product Registration section listed under Northern European Head Office.

Online registration: please see the product registration section listed under Northern Europe.


Netherlands

Seagate Software

Hojel City Center

Gebuw D, 4e etage

Graadt van Roggenweg 328

Postbox 19127

3501 DC Utrecht

The Netherlands

Sales

Telephone: +31 30 298 2124

Fax: +31 30 298 2125

Product support

Please see the Product Support section listed under Northern European
Head Office.

Product registration

Online registration: please see the product registration section listed under Northern Europe.


Germany - Central European Head Office

Seagate Software GmbH

2nd Floor

Frankfurter Strasse 21-25

D-65760 Eschborn

Germany

Sales

Telephone: +49 (0) 6196 9559 0

Fax: +49 (0) 6196 9559 10

Product support

Telephone: +49 (0) 699 509 6180

Email: answers@seagatesoftware.com (Available in English only)

Web browser: http://community.seagatesoftware.com/support
(Available in English only)

Product registration

Fax: +49 (0) 6995 09 6182

Web browser: http://www.seagatesoftware.com/register


Switzerland

Seagate Software GmbH

World Trade Center

PO Box 112

Leutschenbachstrasse 95

CH-8050 Zurich

Switzerland

Sales

Telephone: +41 1 308 3922

Fax: +41 1 308 3500

Product support

Please see the Product Support section listed under Central European
Head Office.

Product registration

Fax: +49 (0) 6995 09 6182

Online registration: please see the product registration section listed under Central Europe.


France - Southern European Head Office

Seagate Software

62 bis, avenue Andre Morizet

F-92643 Boulogne Billancourt

Cedex

France

Sales

Telephone: +33 (0) 1 41 10 1600

Fax: +33 (0) 1 46 04 7419

Product support

Telephone: +33 (0) 141 918630

Fax +44 (0) 181 231 0600

Email: answers@seagatesoftware.com (Available in English only)

Web browser: http://community.seagatesoftware.com/support
(Available in English only)

Product registration

Fax: ++ 33 (0) 1 41 91 86 27

Web browser: http://www.seagatesoftware.com/register


Spain

Seagate Software IMG

Paseo de la Castellana 93 -4a

28046, Madrid

Spain

Sales

Telephone: +3491 555 5198

Fax: +3491 555 9957

Product support

Please see the Product Support section listed under Southern European
Head Office.

Product registration

Online registration: please see the product registration section listed under Southern Europe.


Italy

Seagate Software S.r.l.

Via Conservatorio 22

Milan 20122

Italy

Sales

Telephone: +39 02 7729 310

Fax: +39 02 7729 40

Product support

Please see the Product Support section listed under Southern European Head Office.

Product registration

Online registration: please see the product registration section listed under Southern Europe.


South Africa Regional Office (Southern & Central Africa)

Seagate Software IMG

Lower Ground Floor

Block F, Pin Mill Farm

164 Katherine Street

Sandton

PO Box 786050

Sandton, 2146

Republic of South Africa

Sales

Telephone: +27 11 448 2080

Fax: +27 11 448 1960

Product support

Run locally in Johannesburg.

Telephone: +27 11 448 2080

Fax: +27 11 448 1960 Contact: Ross Harrison

Email: rossh@seagatesa.co.za

Email: answers@seagatesoftware.com (Available in English only)

Web browser: http://community.seagatesoftware.com/support
(Available in English only)

Note: "community" replaces "www" in the web address.

Product registration

Online registration: please see the product registration section listed under Northern Europe.


Middle East Regional Office (ME & Northern Africa)

Seagate Software

PO Box 8687

Dubai

United Arab Emirates

Sales

Telephone: +971 4 523888

Fax: +971 4 519056

Product support

Run locally in Dubai.

Telephone: +971 4 523888 Contact: Katia Boueiri

Fax: +971 4 519056 Contact: Katia Boueiri

Email: kboueiri@img.seagatesoftware.com

Email: answers@seagatesoftware.com (Available in English only)

Web browser: http://community.seagatesoftware.com/support
(Available in English only)

Note: "community" replaces "www" in the web address.

Product registration

Online registration: please see the product registration section listed under Northern Europe.


Command Reference

Menu commands are used to create, customize, print, and save your reports. Each menu contains a list of commands that are related by their function. For example, all the commands related to files, such as opening, closing, saving, and so on, are found on the File menu.


File menu

The File menu commands allow you to open, close, and save files, to save files under different file name, to send the file to a printer, and create new reports.

The File menu includes commands used to open, close, and save files, save files under a different file name, create new reports, mailing labels, and cross-tabs, as well as several other kinds of reports. It also includes a command to exit the program. Additionally, it contains commands that enable you to change page margins, preview a report before printing, send a report to a printer, select a printer if you want the report to print on something other than the default printer, and export a report to a disk file in a variety of formats. You can also add summary information to help you identify a report, as well as change the default settings so that the program works the way that is the most efficient for you.


New command

When you choose the New command the Seagate Crystal Report Gallery appears. You can create a report using one of the following report experts, or click As a Blank Report to open a blank report and create your report yourself.

  • Standard Expert
  • Form Letter Expert
  • Form Expert
  • Cross-Tab Expert
  • Subreport Expert
  • Mail Label Expert
  • Drill Down Expert
  • OLAP Report Expert
Related topics

Report Expert

Introduction to Reporting


Open command

Use the Open command to open an existing report. When you choose the Open command, the Open dialog box appears. Use this dialog box to select the report file you wish to open.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Open dialog box


Close command

Use the Close command to close the current report while keeping the application active.

When you choose the Close command:

  • If you have already saved your work, the program closes the report.
  • If you have not yet saved your work, the program asks you if you want to save your changes before closing.
      • If you click Yes and you have already given your report a name, the program saves your changes under that name and closes the report.
      • If you click Yes and you have not already given your report a name, the Save As dialog box appears. Assign a name to your report. When you finish, the program saves your changes under the new name and closes the report.
      • If you click No, the program closes the report. All of your changes since you last saved are lost.
      • If you click Cancel, the program cancels the close request and returns you to the report.


Save command

Use the Save command to save the active report to disk under its current name.

  • All changes you have made while working on the report will be saved.
  • The previous version of the report will be overwritten.

If you have not previously saved your report, the program will prompt you to do so.

Note: This command is also available as a button on the Standard toolbar.


Save As command

Use the Save As command to save the active report to disk under a new name, or to save your report in Version 7 format. All changes you have made while working on the report will be saved to the new file. Your original report file will remain unchanged. See Save As dialog box.


Save Data with Report command

Use the Save Data with Report command if you plan to work again with the report you are creating in the near future (for example, fine tuning it) or if you plan to share the report with someone else who would not have access to the original data.

Typically, when you save a report, the program saves a report definition and the underlying data. The definition contains all of the information needed for printing your report. The data is a snapshot of the original data as it existed when you ran the report. If you clear the Save Data with Report option via the Options command on the File menu, the program saves only the report definition. The data must be refreshed each time the report is run. See Refresh Report Data command. To select the option for the current report, use this command.

There are some things to consider before using the Save Data With Report command.

  • If you save only the definition:
      • your report will require somewhat less disk space (enough for the template only), but
      • the program will need to retrieve the data before it prints the report.
  • If you save your data with the report:
      • your report will require somewhat more disk space (enough for the report template and the data), but
      • the program will not need to retrieve the data before it prints the report.

Switch this command on or off to suit your needs. This option is switched on by default. To change the default, choose the Options command from the File menu and select the Save Data With Report option on the Reporting tab of the Options dialog box when it appears.

Note: When the program saves data with the report, it compresses the data to take up less disk space. It decompresses the data when it opens the report.

Related topics

Using the Save Data with Report command

Options dialog box


Save Subreport As command

The Save Subreport As command allows you to save a subreport as a primary report. Before you can use the Save Subreport As command, the subreport must be selected on the Design tab.


Print Preview command

Use the Print Preview command to display the report in the Preview Tab before you print it, to see what it will look like and to fine tune the report while working with the actual data.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Preview tab


Print submenu

Use the commands on the Print submenu to print your report.


Preview Sample command

Use the Preview Sample command to print a draft report to a window using only a subset of the data you will use in your final report. This feature can save you a great deal of time during the report creation process.


Printer command

Use the Printer command to print a hard copy of your report to the currently selected printer.

Note: This command is also available as a button on the Standard toolbar.


Export command

Use the Export command to export your report in one of several popular word processing, database, and spreadsheet formats, in HTML or ODBC format, or in one of a number of standard data interchange formats. For example, you can export your report in Microsoft Excel format and then open it in Excel as a spreadsheet file.

You can export to a disk file, to an application, to a Lotus Notes database, to an Exchange Folder, or to e-mail.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Export dialog box

Exporting a report


Mail command

Use the Mail command to export your report to e-mail. When you choose the Mail command, the Export dialog box appears. Use this dialog box to specify an export format and destination for your report.

Related topics

Export dialog box

Exporting to Microsoft Mail (MAPI)


Printer Setup command

Use the Printer Setup command to select the printer for printing the report, and to set its properties. If you do not select a printer, the program will print to the Windows default printer.

Related topics

Print Setup dialog box


Page Setup command

Use the Page Setup command to set page margins for your report. Margins define the white space between your report and the edges of the page.

Note: The program uses the non-printing areas established for your printer as default printer margins. Those margin settings appear in the Print Setup dialog box. Although you can set margins that fall inside the non-printing areas, parts of your report may be clipped off if you do.

Related topics

Using the Page Setup command

Page Setup dialog box

Page margins


Options command

Use the Options command to modify settings that apply to the reporting environment. Using these settings, you can customize the program to fit the way you work.

This command takes you to the Options dialog box. This dialog box serves as a control panel for configuring the program in a number of different areas.

Once there you can change default settings in the following tabs:

  • Layout tab
  • New Report tab
  • Database tab
  • Editors tab
  • Data Source Defaults tab
  • Reporting tab
  • Fields tab
  • Fonts tab

Your settings here affect new reports and fields added to existing reports, but they do not affect the work done before you changed the settings.

Related topics

Options dialog box


Report Options command

Use the Report Options command to display the Report Options dialog box to set a number of technical options that apply only to the active report. Your specifications are saved with the report and do not affect any other reports. This option is useful when creating reports for distribution.

Related topics

Report Options dialog box


Summary Info command

Use the Summary Info command to:

  • add summary data that can help you and other users identify the report, and
  • view the statistical information the program generates for each report.
Summary Data

You can supply any or all of the following kinds of information about your report: author, keywords, comments, title, subject, and template. Summary information does not print with the report; it is simply an accessible part of the electronic report file. You can use this command to view and modify summary information as well.

Statistical Information

The program tracks statistical information (such as who last worked on the report, when it was created and last saved, and so forth). This information is read-only; you can not modify it directly.

Related topics

Document Properties dialog box

Adding summary information to the report


Exit command

Use the Exit command to end your reporting session and return to the Windows environment.


Edit menu

The Edit menu includes commands used to modify aspects of a report. It includes commands to undo and redo actions, edit fields, formulas, summaries, subreport links, OLAP members, OLE objects and OLE links, to view a sample of the data in a selected field, and to cut, copy, and paste report and OLE objects. You can also use the Edit menu commands to show, hide, move, merge, or delete report sections, delete groups, and convert static OLE objects into editable bitmaps.

Note: The ability to cut/copy/paste lines and boxes works in the Design tab but not the Preview tab.


Undo command

The Undo command is a dynamic command. The command name (as seen on the menu) changes based on the last action you performed. Undo reverses the effects of an action and restores your document to the way it appeared before you performed the action. The program supports multiple levels of Undo.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Undo/Redo activities


Redo command

The Redo command is a dynamic command. The text changes on the menu based on the last Undo you performed. Redo restores the effects of an Undo and returns your document to the way it was before using the Undo command. The program supports multiple levels of Redo.

Related topics

Undo/Redo activities


Cut command

Use the Cut command any time you wish to cut (delete) a selected object while holding it on the Clipboard for later use.

Note: The Cut command can be used in the Formula Editor (for any formula element) via the Windows keyboard command Ctrl-X.

Related topics

Using the Cut command


Copy command

Use the Copy command any time you wish to hold a copy of a selected object on the Clipboard for later use without disturbing the object as it currently appears in the report.

Note: The Copy command can be used in the Formula Editor (for any formula element) via the Windows keyboard command Ctrl-C.

Related topics

Using the Copy command


Paste command

Use the Paste command any time to paste (insert) an object from the Clipboard into your report.

Note: The Paste command can be used in the Formula Editor (for any formula element) via the Windows keyboard command Ctrl-V.

Related topics

Using the Paste command


Paste Special command

The Paste Special command allows you to paste an OLE object into your report from the Clipboard, and to choose how the object is pasted.

Related topics

OLE

Paste Special dialog box

OLE Object command


Find command

Use the Find command to find text or particular values of a field in the report.

Related topics

Find dialog box


Find Again command

Use the Find Again command to find the next occurrence of the item specified in the Find dialog box.

Related topics

Find dialog box


Formula command

Use the Formula command on the Edit menu to edit the currently selected formula. When you choose this command, the Formula Editor appears with the formula text displayed, ready for editing.

Related topics

Formula Editor

Field Explorer

Using Formulas


Parameter command

Use the Parameter command to edit the currently selected parameter.

Related topics

Edit Parameter Field dialog box

Field Explorer


Text Object command

Use the Text Object command to edit the currently selected text object.

Related topics

Text objects

Working with text objects


Subreport command

The Subreport command allows you to edit a selected subreport. When you choose this command, the program will open the Design tab for the selected subreport. You can make the desired changes in that tab.

Related topics

Subreports


Summary Field command

The Summary Field command allows you to change the operation for the selected summary. This option, for example, can change a sum operation to one that determines the maximum (highest) value in the group.

Related topics

Insert Summary dialog box

Using the Summary Field command

Summarizing grouped data


Running Total Field command

Use the Running Total Field command to edit the currently selected running total.

Related topics

Create Running Total Field dialog box


Subreport Links command

Use the Subreport Links command to link the data in a subreport to data in the parent report. This enables you, for example, to create a subreport that provides the details behind summary data in the parent report. This command works in conjunction with the Parameter Field command on the Insert menu. When you choose this command, the Subreport Links dialog box appears.

Related topics

Subreport Links dialog box

Linking a subreport to the data in the primary report


Browse Field Data command

Use the Browse Field Data command to view the values in a report field.

Note: This command is only active if you have selected a field on your report.


Show/Hide Sections command

Use the Show/Hide Sections command display the Section Expert, in which you can select report sections to show or hide using the Suppress or Hide options.

  • If you select Hide (Drill-Down OK) for a section, you will only see the information in that section if you drill down. You can print the information in the section once you have drilled down to it.
  • If you select Suppress (No Drill Down) for a section, you will not be able to see the information in that section as long as it is suppressed. You cannot drill down on a suppressed section.
Related topics

Section Expert

Hiding report sections


Move Section command

Use the Move Section command when you have multiple sections in an area and you want to change their order of appearance. For example, if you have three Detail sections, Detail A, Detail B, and Detail C, and you want to move Detail C so that it prints before Detail B, use this command to move the sections.

This command takes you to the Section Expert, in which you can select the section you want to move, then use the arrow buttons to move the section up or down the list.

Related topics

Section Expert

Moving a section


Merge Section command

Use the Merge Section command when you have multiple sections in an area and you want two of the sections combined into a single section. For example, if you have three Detail sections, Detail A, Detail B, and Detail C, and you want to combine Detail B and Detail C into a single section, use this command to merge them.

This command takes you to the Section Expert, in which you select the first of the sections that you want to merge, then click Merge to merge that section and the next. The sections are renumbered automatically.

Related topics

Merging two related sections

Section Expert


Delete Section command

Use the Delete Section command when you have multiple sections in an area and you want one of them deleted. For example, if you have three Detail sections, Detail A, Detail B, and Detail C, and you want to delete Detail B, use this command to delete that section.

This command takes you to the Section Expert, which you can use to select the section you want to delete, then click Delete to delete it.

Note: You cannot delete any of the original sections that appear when you first create a new report.

Related topics

Deleting a section

Section Expert


Delete Group command

Use the Delete Group command to delete a group from your report. This command takes you to the Delete Group dialog box, which you can use to delete the desired groups.

Related topics

Using the Delete Group command


Object command

Note: The name of this command and its submenu change to match the object you have selected.

Use the appropriate Object command, or the appropriate submenu command, to modify the selected embedded object.

  • Edit command
  • Open command
  • Properties command
  • Activate Contents command
  • Edit Package command
  • Convert command
  • Convert Picture Object command
Related topics

OLE overview


Convert Picture Object command

Use the Convert Picture Object command to convert the selected picture object.

When you use the OLE Object command on the Insert menu to place a picture in a report, the picture can be treated as either an embedded or a linked object.

When you use the Picture command on the Insert menu to insert a picture into the report, the Report Designer converts the picture into a static object.

Static objects do not support editing. To edit a static object, it has to be converted into an editable type of object using the Convert Picture Object command on the Edit menu.

Related topics

Convert dialog box

OLE overview


Edit command

Use the Edit command to edit the selected object in place using the tools from the object's original (server) application. To use the original application to edit the object, use the Open command.

Related topics

OLE overview


Open command

Use the Open command to open the selected object's original (server) application with the object open and ready for editing.

Related topics

OLE overview


Properties command

Use the Properties command to change the properties for the selected linked or embedded object.

Related topics

OLE overview


Activate Contents command

Use the Activate Contents command to open the package that created the linked or embedded object.

Related topics

OLE overview


Edit Package command

Use the Edit Package command to open the Object Packager. See the Object Package help for details.

Related topics

OLE overview


Convert command

Use the Convert command to convert the selected linked or embedded object to another kind of object, for example to convert a document file to a picture.

Related topics

Convert dialog box

OLE overview


Links command

Use the Links command to make changes in existing OLE object links. Using this command, you can change the source data for a link and also the way in which that link is updated. This command is only active when you have a linked object in the report. When you insert an OLE object, you can choose to insert it as an embedded object or as linked object. See Insert Object dialog box (Create from File).

When you choose the Links command, the Links dialog box appears.

Note: This command is not related to editing a database link. To edit a database link you must choose the Visual Linking Expert command from the Database menu.

Related topics

Insert Object dialog box (Create from File)

Links dialog box

Using the Links command

OLE overview


View menu

The View menu includes commands used to modify the user interface of the program. View menu commands enable you to show or hide the toolbars, zoom in and out on a report to view it at different magnifications, and to turn guidelines, the grid, and the rulers on and off. The Group Tree view can be displayed or hidden from the View menu.


Toolbars command

Use the Toolbars command to open the Toolbars dialog box to control the appearance of the toolbars.

There are four toolbars to choose from: Standard, Formatting, Supplementary Tools, and Analyzer Tools. Use the check boxes provided to show any or all of the toolbars.

To view larger buttons on your toolbars, select the Large Buttons check box.

Tooltips are windows that appear with a name when your cursor rests on top of a button. To view tooltips on your toolbars, select the Show ToolTips check box.

Related topics

Standard toolbar

Formatting toolbar

Supplementary Tools toolbar

Analyzer Tools toolbar


Status Bar command

Use the Status Bar command to show or hide the status bar. By default the status bar is shown (a check mark appears beside the command on the menu).


Rulers in Design command

Use the Rulers in Design command to show or hide the rulers in the Design tab. By default the rulers are shown on the Design tab (a check mark appears beside the command on the menu).

Related topics

Comparisons with the Design tab


Rulers in Preview command

Use the Rulers in Preview command to show or hide the rulers in the Preview tab. By default the rulers are shown on the Preview tab (a check mark appears beside the command on the menu).

Related topics

Comparisons with the Design tab


Guidelines in Design command

Use the Guidelines in Design command to show or hide the guidelines in the Design tab. By default, the guidelines are shown on the Design tab (a check mark appears beside the command on the menu).

Related topics

Using guidelines

Viewing guidelines


Guidelines in Preview command

Use the Guidelines in Preview command to show or hide the guidelines in the Preview tab. By default, the guidelines are shown on the Preview tab (a check mark appears beside the command on the menu).

Related topics

Using guidelines

Viewing guidelines


Grid in Design command

Use the Grid in Design command to show or hide the grid lines in the Design tab. By default the grid is shown on the Design tab (a check mark appears beside the command on the menu).

Related topics

Using the grid

Selecting the grid


Grid in Preview command

Use the Grid in Preview command to show or hide the grid lines in the Preview tab. By default the grid is not shown on the Preview tab (no check mark appears beside the command on the menu).

Related topics

Using the grid

Selecting the grid


Tool Tips in Design command

Use the Tool Tips in Design command to allow tool tips on the Design tab.


Tool Tips in Preview command

Use the Tool Tips in Preview command to allow tool tips on the Preview tab.


Tool Tips in Analyzer command

Use the Tool Tips in Analyzer command to allow tool tips on the Design tab.


Group Tree command

Use the Group Tree command to show or hide the Group Tree view in the Preview tab. When the Group Tree view is active, you can use Smart Navigation technology to drill down on groups to view the details of the underlying data.

This command is also available as a button on the Formatting toolbar.

Related topics

Group Tree view


Zoom command

Use the Zoom command to open the Magnification Factor dialog box to zoom in and out on your report. With this command you can view your report at anywhere from 25% to 400% of its actual size, make it fit within the page or reset the size to 100%.

At the lower magnifications you will see more emphasis on layout; at the higher magnifications, you will see more emphasis on details.

Note: These options are also available using the Zoom Control on the Standard toolbar.

Related topics

Using the zoom feature


Close command

Use the Close command to close the active tab. You cannot use this command if the active tab is the Design tab of the primary report.


Insert menu

The Insert menu includes commands used to insert database fields, text objects, formula fields, parameter fields, cross-tab objects, subtotals, grand totals, summaries (counts, averages, and so on), groups, and sections. This menu also includes commands that enable you to insert group name fields, subreports, graphics, lines, boxes, charts, and OLE objects into a report.


Database Field command

Use the Database Field command to place a data field from an active database table on your report. When you choose the Database Field command, the Field Explorer appears with Database Fields selected.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Field Explorer

Inserting a field


Text Object command

Use the Text Object command to insert a text object anywhere on your report. A text object is an object that holds text (a single character, a single word, entire sentences, or an entire letter). A text object can hold database fields and formula fields as well as text. Thus, a text object can be used for a variety of reporting needs such as labels, titles, annotations, callouts, disclaimers, footnotes, and even mail merge form letters.

Note: While the effective limit on text object size is 32K (including carriage return and line feed characters), it is recommended that text objects be used only for more manageably sized blocks of text.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Text objects


Formula Field command

Use the Formula Field command to create or insert a formula into your report. With this command, you can insert an existing formula or create a new formula. This command also lets you edit, delete, or rename existing formulas.

When you choose the Formula Field command, the Field Explorer appears with Formula Fields selected. See Creating and modifying formulas.

Note: You can also open the Field Explorer by clicking the Insert Fields button on the Standard toolbar.

Related topics

Using the Formula Field command

Creating and modifying formulas

Field Explorer

Formula Editor


Parameter Field command

Use the Parameter Field command to create or insert a parameter (prompting) field into the report itself, into a formula, into a record selection formula or into the body of the report. When using a parameter field, the program prompts you for a value when you first run the report and whenever you refresh the data.

The program also allows you to edit, delete, or rename existing parameter fields with this command.

When you choose the Parameter Field command, the Field Explorer appears with Parameter Fields selected.

Note: You can also open the Field Explorer by clicking the Insert Fields button on the Standard toolbar.

Related topics

Field Explorer

Creating a parameter field


Special Field command

Use the Special Field command to insert any of several special fields into your report. When you choose the Special Field command, the Field Explorer appears with Special Fields selected.

Note: You can also open the Field Explorer by clicking the Insert Fields button on the Standard toolbar.

Related topics

Field Explorer


Running Total Field command

Use the Running Total Field command to insert a Running Total Field in your report. This command totals all records (in the report, in the group, and so on) up to and including the current record. For example, if the three records in a specific field have values of 2, 4, and 7, and you insert a Running Total Field to summarize that field, the running total would equal 13, according to the following process:

  • 2 + 0 = 2
  • 2 + 4 = 6
  • 6 + 7 = 13

When you choose the Running Total Field command, the Field Explorer appears with Running Total Fields selected.

Note: You can also open the Field Explorer by clicking the Insert Fields button on the Standard toolbar.

Related topics

Field Explorer


SQL Expression Field command

Use the SQL Expression Field command to insert an SQL Expression in your report. You must have some familiarity with the SQL language and SQL expressions before trying to add an expression to your report.

When you choose the SQL Expression Field command, the Field Explorer appears with Running Total Fields selected.

Note: You can also open the Field Explorer by clicking the Insert Fields button on the Standard toolbar.

Related topics

Field Explorer

SQL Expression Name dialog box

SQL Expression Editor


Subtotal command

Use the Subtotal command to insert a subtotal of the currently selected numeric field into your report. A subtotal is a summary that can only be used with numeric fields. The program sorts, groups, and subtotals in a single step. When you choose the Subtotal command, the Insert Subtotal dialog box appears.

Related topics

Using the Subtotal command

Insert Subtotal dialog box

Summaries, subtotals, and grand totals


Grand Total command

Use the Grand Total command to print a report grand total of the currently selected numeric field at the end of the report. You can also use this command to insert a report average, a report count, and so on. When you choose the Grand Total command, the Insert Grand Total dialog box appears.

Related topics

Using the Grand Total command

Insert Grand Total dialog box

Summaries, subtotals, and grand totals


Summary command

Use the Summary command to summarize data and print the summary in your report. The program sorts, groups and summarizes in a single step. You can use summaries:

  • to count the number of values in a group,
  • to calculate the sum, average, standard deviation, or variance value in a group, and
  • to identify the minimum or maximum value in a group.

This command is only active after you have selected a field to summarize. When you choose the Summary command, the Insert Summary dialog box appears.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Using the Summary command

Insert Summary dialog box

Summaries, subtotals, and grand totals


Group command

Use the Group command to sort your data and break it into groups. For example, you could group the information in a customer list into state or zip codes. When you choose the Group command, the Insert Group dialog box appears.

Related topics

Using the Group command

Insert Group dialog box

Grouping, sorting, and summarizing data

Grouping data


Section command

Use the Section command to insert a new section in your report. When you choose this command the Section Expert appears, which you can use to insert a new section in your report. You can also use the Section Expert to make changes to any of the sections in your report.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Working with sections

Section Expert


Group Name Field command

Use the Group Name Field command to create live group headers. Once you have selected a group, the program creates a group name object for that group. The object contains the field or formula value that triggers each grouping (that is, the value in the sort and group by field). If you place this object in the group header section for the group, the program will print a live group header at the beginning of each group.

A live group header is a header that changes dynamically when the content of the group changes. If you were to group your data by state, for example, a typical live group header would print the name of the state at the beginning of each group.

By default, the program automatically inserts a group name field in the group header section whenever you create a group.

When you choose the Group Name Field command, the Field Explorer appears with Group Name Fields selected.

Note: You can also open the Field Explorer by clicking the Insert Fields button on the Standard toolbar.

Related topics

Using the Group Name Field command

Field Explorer

Creating group headers


OLAP Grid command

Use the OLAP Grid command to insert an OLAP Grid into your report. When you choose the OLAP Grid command, the Insert OLAP Grid Object dialog box appears. The term OLAP is used to refer to all common forms of OLAP (Online Analytical Processing) and multi-dimensional data storage and access systems.

Related topics

Insert OLAP Grid Object dialog box

OLAP Report Expert

OLAP Grid Objects

Creating and Updating OLAP Reports


Cross-Tab command

Use the Cross-Tab command to insert a cross-tab object into your report. A cross-tab is a spreadsheet-like report used for identifying trends. You can create a report in which the cross-tab object is the entire report, or you can insert one or more cross-tab objects into a primary report, as subreports. When you choose the Cross-Tab command, the Format Cross-Tab dialog box appears.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Cross-Tab Objects

Format Cross-Tab dialog box


Subreport command

Use the Subreport command to create a subreport object that you can place on your report. A subreport object is a self-contained report that has all of the usual report characteristics and abilities. You can import an existing report to use as a subreport object, or you can create your subreport from scratch as you would any other report.

You can insert multiple subreport objects into your parent report if you wish. You can coordinate the subreport data with the data in the primary report, or you can leave your subreport freestanding and unrelated to any data in the parent report.

When you choose the Subreport command, the Insert Subreport dialog box appears.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Subreports

Inserting subreports

Insert Subreport dialog box


Line command

Use the Line command to draw horizontal and vertical lines anywhere on your report. You can use these lines to enclose field data or to create other graphic effects.

While you can create lines via the Border and Colors command, the lines you draw via the Line command, differ from those in several important ways:

  • Border lines can not stand alone (they are always attached to a field or a picture) while graphic lines can stand alone.
  • A border line is limited to a very small selection of sizes, while a graphic line can be any length or height you wish.
  • A border line increases the height of the adjacent text line (taking up more space), while a graphic line does not.
  • A border (field border) can not span multiple sections; whereas, a graphic line can.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Format Line tab (Format Editor)

Adding and editing lines


Box command

Use the Box command to draw free-form boxes anywhere on your report. You can use these boxes to enclose field data or to create other graphic effects.

While you can create boxes via the Border and Colors command, the boxes you draw via the Box command differ from those in several important ways:

  • Borders come in fixed sizes; whereas, boxes can be created in any size you need.
  • A border can be used to enclose individual field values; whereas, a box placed around a field encloses all the values in the field.
  • Borders can not stand alone (they must surround a field or a picture), while boxes can.
  • Boxes do not increase the height of a text line (making for fewer lines per inch) whereas borders do.
  • A border (field border) can not span multiple sections, while a box can.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Format Box tab (Format Editor)

Adding and editing boxes


Picture command

Use the Picture command to insert bitmapped artwork (graphics, logos, and so on) into your report. The program helps you enhance the visual impact of your report using artwork in the following popular formats.

When you use the OLE Object command on the Insert menu to place a picture in a report, the picture can be treated as either an embedded or a linked object.

When you use the Picture command on the Insert menu to insert a picture into the report, the Report Designer converts the picture into a static object.

Static objects do not support editing. To edit a static object, it has to be converted into an editable type of object using the Convert Picture Object command on the Edit menu.

Note: Seagate Crystal Reports supports Bitmap, TIFF, JPEG, and PNG files.

Related topics

Working with static OLE objects

Inserting OLE objects into reports


Chart command

Use the Chart command to insert a chart into your report. When you choose the Chart command, the Chart Expert appears. Use this Expert to choose from among four types of Charts:

  • a simple group chart,
  • a detail/formula chart,
  • a cross-tab chart, or
  • an OLAP chart

Follow the step-by-step instructions in the Chart Expert to create your chart.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Charting


Map command

Use the Map command to open the Map Expert and insert a map into your report. Maps help you analyze your report data and identify trends more efficiently. For example, you could create a map that shows sales by region. You would then be able to:

  • drill down on the map regions to view the underlying data,
  • analyze the data using one of the five map types, and
  • use the Analyzer tab to adjust the appearance and organization of the map (allowing you to better identify trends).

In order to place a generic, group-based map on your report, you must first have a group and a summary or subtotal field present in the report. However, Seagate Crystal Reports does provide several specialized map layouts (Detail, cross-tab, and OLAP) that do not require groups and summaries.

Note: The Map command is only available if you have installed the mapping component of Seagate Crystal Reports.

Related topics

Map Expert

Mapping


OLE Object command

Use the OLE Object command to link or embed an OLE object in your report.

Note: You can also insert a picture using the Picture command on the Insert menu. In that case, the Report Designer converts the picture into a static object, which you cannot edit. To convert a static object to an editable object, use the Convert Picture Object command on the Edit menu.

Related topics

Insert Object dialog box

Inserting OLE objects into reports

OLE


Hyperlink command

Use the Hyperlink command to create a hyperlink from the selected object to to a web site, a local HTML file, a field value, an e-mail address, or another Seagate Crystal Report file.

The hyperlink is saved with your report and is available to other users as a way of viewing additional information.

When you choose the Hyperlink command, the Hyperlink tab (Format Editor) of the Format Editor appears.

Note:

  • If you create a hyperlink to another Seagate Crystal Report file, you are creating an on-demand subreport. Just as one subreport cannot contain another subreport, you cannot create a hyperlink between two subreports. See How subreport linking works.
  • To select a hyperlinked object, use Shift-click or Ctrl-click. Clicking on a hyperlink, without using the Shift or Ctrl key, activates the link.
  • This command is also available as a button on the Standard toolbar.
Related topics

Format Editor

Hyperlink fields


Format menu

The Format menu includes commands used to change the look of the elements in a report. It includes commands for changing fonts and for adding field borders, background color, and drop shadows. The Format menu has commands for formatting fields that are embedded in text objects, for formatting individual paragraphs in those text objects, and for entire sections of the report as well. There are also commands for formatting charts, as well as formatting and pivoting cross-tabs. Finally, Format menu commands can be used to have the program automatically arrange report objects, apply professionally designed styles to the entire report, and move individual objects within a stack of objects forward and backward.


Report Style Expert command

Use the Report Style Expert command to apply one of several professionally-designed styles to your report.

When you choose the Report Style Expert command, the Report Style Expert appears. Use this dialog box to select a report style and apply it to your report.

Related topics

Formatting

Report Style Expert


Auto-Arrange Report command

Use the Auto-Arrange command to:

  • adjust the spacing between fields,
  • reposition the fields, and then
  • center your report on the page, automatically.

When you place a field on your report, Seagate Crystal Reports allocates a space equal to the field width specified in your database. However, this field width is often far larger than the width of the values within the field. Use the Auto-Arrange command to resize and reposition the fields automatically.

Related topics

Using the Auto-Arrange Report command

Formatting


Format Object/Expert commands

Note: The formatting command that you see on the Format menu and the Analyzer menu changes to match the object you have selected (for example, Format Field, Format Box, Format Graphic, Map Expert, Chart Expert and so on).

Use the displayed command to format the selected object.

The Format commands open the Format Editor, which presents you with the various formatting properties that you can apply to the object. The properties vary for each kind of object, but they include:

  • applying borders and colors
  • changing the font for text or numbers
  • suppressing the object so that it does not print
  • cropping the size of the object
  • maintaining the object size or letting it grow.

If you selected a map, this command changes to the Map Expert command. Use the Map Expert to edit or format a map.

If you selected a chart, this command changes to the Chart Expert command. Use the Chart Expert to edit or format a chart.

Related topics

Formatting

Format Editor

Chart Expert

Map Expert


Border and Colors command

Use the Border and Colors command to add borders, background fill, and drop shadows to fields on your report. For example, you can:

  • enclose the field in a box,
  • enclose the field in a partial box or frame (only the top, only the left side, the top and bottom together with no sides, and so on),
  • add drop shadows that print below and to the right of the field value,
  • change the color of the border, text, and add a background fill color to a field,
  • specify the border width (the full width allotted for the field, or the width of the data within the field), and the border height (the full height allotted for the field, or the height of the data within the field).

Using the border options, you can create a variety of striking effects that can enhance the look of your report and highlight important data.

Related topics

Border tab (Format Editor)

Adding borders, color, and shading to a field

Using white space between rows

Formatting


Font command

Use the Font command to change the font face, size, style, effects, and/or color of selected text on your report.

  • When you choose the Font command after selecting a field, or after selecting a text object by clicking it, the Format Editor appears with the Font tab (Format Editor) selected. When a text object is selected in this way, you can move, resize the object as a whole, and any font settings affect all the text in the object.
  • When you choose the Font command after selecting a text object by double-clicking it, the Text Format dialog box appears. When a text object is selected in this way you can edit the text itself, and apply font settings to sections of the text.
Related topics

Font tab (Format Editor)

Using the Font command

Formatting


Highlighting Expert command

Use the Highlighting Expert command to display the Highlighting Expert to apply conditional formatting to currency and number fields.

Use the Highlighting Expert to highlight field values that are of particular interest. For example, to highlight customers whose the sales are greater than $25,000, you could use the Highlighting Expert to apply red background color to the {customer.LAST YEAR'S SALES} field, if the value is greater than $25,000.

You can also use the dialog box to set conditional font color and border style.

Related topics

Using the Highlighting Expert


Change Line Height command

Use the Change Line Height command to modify the measurements that determine how text is placed between two lines.

Note: This command is only available in a report section which is not using Free-form Placement. Cancel free-form placement using the Free-Form Placement check box on the Common tab in the Section Expert.

By adjusting the line height and descent, you will be able to position text on a pre-printed form in a manner that prevents the top of the text from touching a line, and that prevents the bottom of the text from touching a line.

Related topics

Free-form placement

Section Expert


Paragraph Formatting command

Use the Paragraph Formatting command to format paragraphs in a text object. For each paragraph you can set the font, tabs, and indents. In order to activate this command, you have to double-click the text object.

When you choose the Paragraph Formatting command the Format Editor appears with the Paragraph Formatting tab (Format Editor) selected.

Note:

  • When you select a field, or select a text object by clicking it, you can move, or resize the object, or apply formatting that affects all the text in the object.
  • When you select a text object by double-clicking it, you can edit the text itself, and apply formatting to sections of the text.
Related topics

Using the Paragraph Formatting command

Formatting

Format Editor


Tabs command

Use the Tabs command to set the tab stops for paragraphs in a text object. You can specify tab stop position and tab alignment. In order to activate this command, you have to double-click the text object.

Choosing the Tabs command opens the Text Format dialog box, with the Tabs tab selected.

Related topics

Formatting

Tabs tab (Text Format)

Tabs tab (Format Editor)

Using the Tabs command


Chart command

Use the Chart command to return to the Chart Expert to change the format of your chart.

Related topics

Charting

Chart Expert


OLAP Grid command

Use the OLAP Grid command to format your OLAP Grid. When you choose this command, the Insert OLAP Grid Object dialog box appears, allowing you to make changes as needed. The term OLAP is used to refer to all common forms of OLAP (Online Analytical Processing) and multi-dimensional data storage and access systems.

Related topics

Insert OLAP Grid Object dialog box

OLAP Report Expert

Creating and Updating OLAP Reports


Pivot OLAP Grid command

Use the Pivot OLAP Grid command to pivot an OLAP grid.

OLAP Report Expert

Creating and Updating OLAP Reports


Cross-Tab command

Use the Cross-Tab command to return to the Format Cross-Tab dialog box to change the format of your cross-tab. Use the Cross-Tab command on the Insert menu to create a cross-tab object.

Related topics

Cross-Tab Objects

Format Cross-Tab dialog box


Pivot Cross-Tab command

Use the Pivot Cross-Tab command to pivot a cross-tab on its axis, turning columns into rows and rows into columns. Use the Cross-Tab command on the Insert menu to create a cross-tab object.

Related topics

Cross-Tab Objects


Section command

Use the Section command to display the Section Expert. Using the Section Expert you can:

  • insert, delete, merge, and move report sections,
  • hide a section (keeping it from printing) while retaining drill down capabilities,
  • suppress a section (keeping it from printing and eliminating drill down capabilities),
  • print subtotals or group values only at the bottom of the page,
  • insert a page break before the section is printed,
  • insert a page break after the section is printed,
  • reset the page number to one (1) after a group value prints,
  • prevent page breaks from spreading data from a single record over two pages,
  • prevent blank lines from printing,
  • cause an object to overlay the following section when it prints, and
  • format the section with multi-column capabilities.
Related topics

Using the Section command

Working with sections

Formatting

Section Expert


Move Backward command

When you have multiple objects in a stack, use the Move Backward command to move the selected object "backward" (down) one layer in your stack. In order to access an object you have moved backward, you can do one of the following:

  • move objects that are above it out of the way, or
  • move those objects backward.
Related topics

Move to Back command

Move Forward command

Move to Front command


Move to Back command

When you have multiple objects in a stack, use the Move to Back command to move the selected object to the bottom of the stack.

Related topics

Move Backward command

Move Forward command

Move to Front command


Move Forward command

When you have multiple objects in a stack, use the Move Forward command to move the selected object "forward" (up) one layer in the stack.

Related topics

Move Backward command

Move to Back command

Move to Front command


Move to Front command

When you have multiple objects in a stack, use the Move to Front command to move the selected object to the front (top) of your stack.

Related topics

Move Backward command

Move to Back command

Move Forward command


Object Size and Position command

Use the Object Size and Position command to increase or decrease the size of the selected object, or to adjust the position of the selected object, in relation to the top and side margins. When you choose the Object Size and Position command, the Object Size and Position dialog box appears.


Align submenu

Use the commands on the Align submenu to align the currently selected objects with the last object you select. Click an object to select it and then Shift-click or Ctrl-click to select further objects.

Once you have selected the objects that you want to align, choose a command from the submenu.

Tops

Use the (Align) Tops command to align the tops of the selected objects with the top of the last object selected.

Middles

Use the (Align) Middles command to align the (vertical) middles of the selected objects with the (vertical) middle of the last object selected.

Bottoms

Use the (Align) Bottoms command to align the bottoms of the selected objects with the bottom of the last object selected.

Baseline

Use the (Align) Baseline command to align the baseline of the selected objects with the baseline of the last object selected.

Lefts

Use the (Align) Lefts command to align the left of the selected objects with the left of the last object selected.

Centers

Use the (Align) Centers command to align the center of the selected objects with the center of the last object selected.

Rights

Use the (Align) Rights command to align the right of the selected objects with the right of the last object selected.

To Grid

Use the (Align) To Grid command to align the selected objects with the grid.


Size submenu

Use the commands on the Size submenu to resize an object or objects to match the size of another object.

Click the first object you wish to resize, then Shift-click or Ctrl-click to select further objects, finally selecting the object whose size you wish to match.

Choose the appropriate size command from the submenu to resize the selected objects to match the size of the last object you selected.

Same Width

Resizes the selected objects to the same width as the last object you selected.

Same Height

Resizes the selected objects to the same height as the last object you selected.

Same Size

Resizes the selected objects to the same size as the last object you selected.


Database menu

The Database menu includes commands used to add and delete tables for use with reports, to change the alias used to identify a table, and to link and unlink tables. It has commands for logging on and off SQL and ODBC servers, showing and editing SQL queries, and modifying parameters for stored procedures. The Database menu also has commands that direct Seagate Crystal Reports to look for tables in new locations, change database drivers used in a report, remove tables from a report, and adapt reports appropriately if there are minor changes in table structure.


Visual Linking Expert command

Use the Visual Linking Expert command to:

  • create Smart Links automatically between databases,
  • display the links that have been set up among active databases,
  • create new links between active databases,
  • update (modify) existing links,
  • delete existing links,
  • add new databases/tables to the report,
  • select the index you want to use when multiple indexes are available for a field,
  • set the way partial text matches are to be handled, and
  • specify lookup options when database (A) is linked to two others, (B) and (C).

When you choose the Visual Linking Expert command, the Visual Linking Expert appears.

Related topics

Visual Linking Expert


Add Database to Report command

Use the Add Database to Report command to select an additional database table or tables for use in your report. When creating a new report, you select the first database you want to use in your report from the Data Explorer which appears when you begin a new report. Use this command to specify additional database files.

Related topics

The Data Explorer

Selecting a database to use

Data Explorer


Remove from Report command

Use the Remove from Report command to delete databases from the active list so that they no longer appear in your report.

Related topics

Remove from Report dialog box

Using the Remove from Report command


Set Location command

Use the Set Location command to change the location of a database that is active in a report. The Set Location command provides a simple way to indicate the new name or location of database files. This is especially useful if someone sends you a report that uses a database that has a different location on your system, or if you have changed the directory or disk location of a database. In addition, the Set Location command automatically converts your database driver to the data source you have chosen. For example, you can automatically convert a direct access data source to an ODBC data source using the Set Location command. The following guidelines apply:

  • If you are moving only one table, the Set Location command can convert it to the same type or any other type of data source.
  • If you are moving more than one table, the Set Location command can convert all of the tables to the same type of data source. To move more than one table to a different data source, use the Convert Database Driver command.

Note: This command does not physically move the database or databases. It simply directs Seagate Crystal Reports to look for the database or databases in another location than the one originally specified when setting up the report.

Related topics

Changing the ODBC data source accessed by a report

Set Location dialog box

Using the Set Location command

Using the Set Location process


Set Alias command

Use the Set Alias command to change the alias you have assigned to one or more of your active databases. An alias is an alternative name assigned to a database. Aliases make it possible for you to use a report created with a database whose name and/or location has changed since the report was created.

Related topics

Set Alias dialog box

Using the Set Alias command

Aliases


Set OLAP Cube Location command

Use the Set OLAP Cube Location command to enter the file path for an OLAP cube. This tells Seagate Crystal Reports where to find the cube.

This command is only available when you have selected an OLAP grid.

Related topics

Updating an OLAP report

Set OLAP Database Location dialog box


Convert Database Driver command

Use the Convert Database Driver command to change the database driver with which you connect to a particular database, for example when moving from an ODBC driver to a native driver.

When you choose the Convert Database Driver command, the Convert Database Driver dialog box appears.


Verify Database command

Use the Verify Database command to make certain your report prints with the current version of the active database and resets its record buffers to the current record size.

When you first create a report, the report draws its fields from the database as it exists at that time. It uses the structure of the database (number of fields, field position, data type, and so on) to identify and select those fields you want placed on the report. If you change the structure of the database (by adding or deleting fields) after you create the report, Seagate Crystal Reports needs to adapt the report to the new structure. This command is the tool you can use for adapting the report to the new database structure.

  • If the database has more fields now than it had when the report was first created, Seagate Crystal Reports attempts to identify and use the correct fields from the new database. The aim is to print an unchanged version of the report even though the underlying database has changed.
  • If the database has fewer fields now than it had when the report was first created, it uses those fields that are still available when it prints the report and ignores those that are no longer available.

Note: If your report is using ADO, RDO, or DAO to access data, then Verify Database can also be used to modify the command you wish to execute.

The Map Fields dialog box appears if the report database has changed since you last ran the report.

Related topics

Using the Verify Database process


Verify on Every Print command

The Verify on Every Print command is a lock that triggers the Verify Database command every time you print.

  • If there is a check mark beside the Verify on Every Print command, the command is active (it will trigger the Verify Database command every time you print).
  • If there is no check mark beside it, the command is inactive. By default the command is inactive.
Related topics

Using the Verify on Every Print command


Log On/Off Server command

Use the Log On/Off Server command to display the Data Explorer in order to log on to or log off an SQL or ODBC data source server.

To log on, choose the database file you want to open and click Log On.

To log off, choose the database file you want to open and click Log Off.

Related topics

Logging on to an ODBC data source


Show SQL Query command

Use the Show SQL Query command to view and to edit the SQL query that Seagate Crystal Reports is sending to your SQL data source.

Related topics

Show SQL Query dialog box

SQL database considerations

Using SQL and SQL databases


Stored Procedure Parameters command

Use the Stored Procedure Parameters command to change the parameters for the stored procedure you are using in your report.

You can build reports using stored procedures from the SQL data sources that support them. Seagate Crystal Reports assumes that the stored procedure you are using for creating a report will generate a result set, and it makes that result set available as a table. If the stored procedure requires parameters, those parameters are stored with the report.

Related topics

SQL stored procedures


Perform Grouping On Server command

Use the Perform Grouping On Server command to perform server-side processing for a designated report. Server-side processing allows you to set up a report that performs the majority of its processing on the server and pushes only relevant details to your computer. Server-side processing provides you with a number of benefits:

  • Less time connected to the server.
  • Less memory needed to process the report on your computer.
  • Lower transfer time from the server to the client.
Related topics

Server-side processing


Select Distinct Records command

Use the Select Distinct Records command to speed up processing of the SQL query used for the report. SQL SELECT statements are then treated as SELECT DISTINCT, and only retrieve unique records from the database.


Report menu

The Report menu includes commands used to select the records or groups to be included in a report, select the order in which report data is to be sorted (by record or by group), specify subreport links, and specify a print date for a report. It has commands for updating the data used in a report.


Report Expert command

Use the Report Expert command to return to the Report Expert you used to create the active report; you can then modify the report. If you choose this command and you did not use a Report Expert when you created the report, the Create Report Expert opens.

Related topics

Report Expert


Select Expert command

Use the Select Expert to select the records or groups you want to include in your report, and to filter out those you don't want to include. For example, you may have a customer database that contains records for customers from every state and Canadian province, but you may want to do a report only on Texas customers. This command lets you restrict your report so that only Texas customers are included.

When you choose the Select Expert, if you have selected a field the Select Expert appears. If you have not selected field, you have to choose a field from the Choose Field dialog box before the Select Expert appears. Seagate Crystal Reports automatically generates a record or group selection formula based on settings you specify in the dialog box.

This command allows you to set up reasonably complex selection criteria, but to have more control over the formula that is generated. Use the Edit Selection Formula submenu on the Report menu and set up your selection formula using the Record Selection Formula Editor or Group Selection Formula Editor.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Select Expert

Record Selection

Grouping data


Edit Selection Formula submenu

Use the commands on the Edit Selection Formula submenu to select the records or groups that you want included in your report (if you do not want them all included).


Record command

Use the Record command to create a record selection formula or to edit an existing record selection formula. When you choose this command, the Record Selection Formula Editor appears. Use this editor to build a Boolean selection formula.

Related topics

Record Selection


Group command

Use the Group command to create a group selection formula or to edit an existing group selection formula. When you choose this command, the Group Selection Formula Editor appears. Use this editor to build a Boolean selection formula.

Related topics

Using the Group command

Grouping data


Change Group Expert command

Use the Change Group Expert command to change the sorting and grouping specifications (sort and group by field, sort direction, and so on) for any of the groups in your report. You can also use this command to insert and remove groups and to change their processing order. If you insert a group section, a subtotal, or a summary and later want to modify it in any way, use this command to do so.

Related topics

Sorting, Grouping, and Totaling

Grouping data

Change Group dialog box


Top N/Sort Group Expert command

Use the Top N/Sort Group Expert command to set up reports that print only the Top N or Bottom N groups (N being a number you specify). Before you can use the Top N/Sort Group Expert, your data must first be subtotaled or summarized.

Related topics

Sorting, Grouping, and Totaling

Grouping data

Top N/Sort Group Expert


Hierarchical Grouping Options command

The Hierarchical Grouping Options command enables you to group data in a report to show hierarchical relationships. When you group data hierarchically, you sort information based on the relationship between two fields.

When you choose this command, the Hierarchical Options dialog box appears.

Related topics

Grouping data hierarchically


Sort Records command

Use the Sort Records command to change the order in which records appear in your report. You can add and remove sort fields and you can define the sort order (ascending or descending) for the data in your report. You can not, however, remove group sorts with this command.

When you choose this command, the Record Sort Order dialog box appears.

Note: This command is also available as a button on the Standard toolbar.

Related topics

Sorting, Grouping, and Totaling


Go To command

Use the Go To command as a shortcut for maneuvering within your report.

When you choose this command, the Go To dialog box appears. Use this dialog box to jump to:

  • a specific page number,
  • the first page of the report, or
  • the last page of the report.


Refresh Report Data command

Use the Refresh Report Data command to retrieve fresh data for your report when you display it in the Preview Tab.

By design, Seagate Crystal Reports only retrieves data when necessary. When you preview your report in the Preview tab, print the report, or export it to a file, the program runs your report and retrieves the required data. Once you are working with the data in the Preview tab, the program will run the report again and retrieve fresh data if you:

  • add fields to the report after the report was run,
  • add a formula that references a field that was not in the report when you ran it the first time,
  • expand your record selection criteria to include more records than were needed when you first ran the report, or
  • select the Refresh Data on every print option, in the Reporting tab of the Options dialog box.

Aside from these circumstances, the program will not automatically refresh a report.

However, there may be times when you want to retrieve new data for the report. For example, you may have created a report several days earlier and you want to see it run with the most current data. The Refresh Report Data command is intended for times such as this.

Related topics

Refreshing report data.


Set Print Date/Time command

Use the Set Print Date/Time command if your report contains a Print Date field that you would like to change. This enables you, for example, to post-date a report that you need to print prior to the date when it will be reviewed in a meeting or conference.


Analyzer menu

The Analyzer menu includes commands used to launch the Analyzer tab to customize your charts and maps.

Depending on the type of chart you select, the Analyzer menu includes commands for zooming in and out on bar and line charts, applying changes to all instances of the chart, discarding any custom changes made to the chart, saving the chart template to a file, applying a new template to the chart, changing the template specifications of the chart, changing the chart titles, changing the numeric axis grids and scales of the chart, and auto-arranging the appearance of the chart.

Many of the operations listed here can be found in the Format Chart menu on the Design, Preview, and Analyzer tabs. If you select an option from this menu on either the Design or Preview tab, your changes are applied to all instances of the chart on the report. Or, if you select a Format Chart option on the Analyzer tab, you set the properties of an individual instance of the chart independently from the rest of the report.

Depending on the type of map you select, the Analyzer menu includes commands for zooming, panning, and centering maps; changing the map title, map type, and setting the overall style of the map; reorganizing the layers of report elements (for example, you can display the Major Cities layer above the Highways layer); resolving data mismatches; changing the geographic map; and hiding and showing the Map Navigator.


Launch Analyzer command

Use the Launch Analyzer command to activate the Analyzer tab for a selected chart or map in the Preview tab.

The Analyzer tab enables you to organize your charts and maps for more efficient analysis. This tab also enables you set the properties of an individual instance of a chart or map independently from the rest of the report.

Note:

  • On the Map shortcut menu, this command is called Map Analyzer.
  • On the Chart shortcut menu, this command is called Chart Analyzer.


Chart Expert command

On the Design or Preview tab, you can format your chart by selecting the Chart Expert command from the Analyzer menu.

Choosing this command opens the Chart Expert.


Map Expert command

On the Design or Preview tab, you can format your map by selecting the Map Expert command from the Analyzer menu.

Choosing this command opens the Map Expert.


Format Field command

On the Design or Preview tab, you can format a field on your report by selecting the Format Field command from the Analyzer menu.

Choosing this command opens the Format Editor.


Format Graphic command

On the Design or Preview tab, you can format a graphic on your report by selecting the Format Graphic command from the Analyzer menu.

Choosing this command opens the Format Editor.


Select Mode command

Use the Select Mode command to disable all movement options. The Select Mode command prevents accidental zooming or panning of a chart or map.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Zoom In command

Select the Zoom In command to get a closer view of your chart or map. Once you activate the Zoom In mode, your cursor changes to represent a magnifying glass. The magnifying glass includes a plus sign to inform you that the selected area increases in size as you click the chart or map.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Zoom Out command

Select the Zoom Out command to get a more distant view of your chart or map. Once you activate the Zoom Out mode, your cursor changes to represent a magnifying glass. The magnifying glass includes a minus sign to inform you that the selected area decreases in size as you click the chart or map.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Pan command

Select the Pan command to move your map. When you activate this command, you can click and drag the map to the desired position on your screen.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Apply Changes to All Charts command

On the Analyzer tab, each change made to your chart is instance-specific. For example, if you rename the title of your chart from the Analyzer tab, the title change applies to only that chart instance. However, if you want to apply the title change to all chart instances, select the Apply Changes to All Charts command from the Analyzer menu.


Discard Custom Changes command

Select the Discard Custom Changes command to restore your chart or map that you have customized back to its original appearance (as specified in the Chart Expert or the Map Expert).

This command is available only if you have altered the original settings.


Save as Template command

On the Analyzer tab, use the Save as Template command to save the selected chart as a template. To apply a template to a chart, select the Template command from the Format Chart sub menu on the Analyzer menu.


Curve Fit & Stat Lines command

On the Analyzer tab, use the Curve Fit & Stat Lines command to fit one or more statistical lines or curves to a series of data on the chart.

Note: This command is only available when you select a data series on a chart, by clicking one of the data items for the series.

Choosing the Curve Fit & Stat Lines command opens the Curve Fit & Stat Lines dialog box for you to select the type of curve to display for the chosen data series.

You can set the color of the curves for a data series to the color used for that data series on the chart. (If you select this option for a chart that colors each item differently, such as a bar chart, the color for the first data item is used.)

If you do not select Show Color Same as Series for a data series, you can set the color for its curves selecting one of them and using the Change Color list.


Format Chart submenu

When viewing a chart on the Analyzer tab, you can perform several operations by selecting the commands on the Format Chart submenu.

With these commands you can apply a new template to the chart, change the template specifications of the chart, change the chart titles, change the numeric axis grids and scales of the chart, perform any additional formatting operations specific to the chart type, and define the viewing angles for the chart.


Template command

Use the Template command to apply a new template to your chart.

Note: This command is also available as a button on the Analyzer Tools toolbar.


General command

Use the General command to change the template specifications of your chart.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Titles command

The Titles command allows you to change the title and subtitle of your chart, the name of the footnote on your chart, and the name of the group title and data axis title of your chart.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Series command

Use the Series command to show how you want the data to be presented on your chart, and to include data labels, numbers, and trendlines with your chart.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Grid command

Use the Grid command to change the numeric axis grids and scales of your chart.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Selected Item command

Use the Selected Item command to format the font, line, and fill specifications of objects on your chart. Launch the Chart Analyzer, click the object that you want to format on your chart, then click Selected Item from the Analyzer | Format Chart menu.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Viewing Angle command

Use the Viewing Angle command to open the Choose a Viewing Angle dialog box. From here, you can make viewing adjustments to your 3D chart, including options to rotate, pan, move, and define the length and thickness of the frame walls surrounding your 3D chart.

In the Advanced Options section of the Choose a Viewing Angle dialog box, use the features on the Rotate tab to rotate your 3D chart to the specified angle.

In the Advanced Options section of the Choose a Viewing Angle dialog box, use the features on the Pan tab to pan and zoom your 3D chart inside the chart frame.

In the Advanced Options section of the Choose a Viewing Angle dialog box, use the features on the Walls tab to increase or decrease the length and thickness of the frame walls surrounding your 3D chart.

In the Advanced Options section of the Choose a Viewing Angle dialog box, use the features on the Move tab to move the 3D chart within the chart frame.

Note: This command is also available as a button on the Analyzer Tools toolbar.


Auto-Arrange Chart command

When moving or resizing a chart object on the Analyzer tab, select the Auto-Arrange Chart command from the Analyzer menu to reset your chart with the latest changes.


Center Map command

Use the Center Map command to center the map in its frame on the report. This is useful to restore the map to its original position after panning.


Change Map Title command

On the Analyzer Tab, use the Change Map Title command to change the name of your map.

Related topics

Changing the map title


Change Map Type command

On the Analyzer Tab, use the Change Map Type command to open the Customize Map dialog box and change the map type and properties for that map. For example, if you are analyzing a Ranged map, and you want to see how the data would look if it were presented in a Dot Density style, you can rearrange the map without having to return to the Map Expert and rework the format. The Analyzer tab also offers more advanced options for changing the appearance of the map you specify.

Related topics

Changing the map type


Change Map Layers command

Use the Change Layers command to open the Layer Control dialog box. Use this dialog box to rearrange the layers of your map. For example, you can rearrange the layers so that the Major Cities layer appears above the Highway layer, or so that the Capitals layer appears above the Top 20 Cities layer.

Note: This command is available only when from the Analyzer Tab.

Related topics

Changing map layers


Resolve Mismatch command

Sometimes the map you are working with uses a different geographic name from the one used in the database. For example, a map of Europe may use "United Kingdom" while the database uses the abbreviation "U.K." Until you resolve the data mismatch, the map will not be able to display any information for the selected geographic region.

Select the Resolve Mismatch command to open the Map Region Resolver dialog box, which lists the geographic names that do not correspond between the database and map.

Note: This command is available only when from the Analyzer Tab.

Related topics

Resolving data mismatches


Change Geographic Map command

Use the Change Geographic Map command to present the data values with a different geographic map. Choosing this command opens the Change Geographic Map dialog box.

Note: This command is available only when from the Analyzer Tab.

Related topics

Changing the geographic map


Show Map Navigator command

Use this command to show the Map Navigator. The Map Navigator provides a small-scale version of the currently displayed map. It includes commands for zooming, panning, and centering geographic maps. You can zoom in and out on your maps whenever you need to view more specific or general information. By panning, you can quickly drag your map anywhere you please. You can then return your map to the center of the tab by using the center command.

Related topics

Hiding and showing the Map Navigator


Hide Map Navigator command

Use this command to hide the Map Navigator. Then select the Show Map Navigator to display it again.

Related topics

Hiding and showing the Map Navigator


Window menu

The Window menu includes commands used to rearrange icons and windows. It also lists the report windows that are open and includes a command that lets you close all report windows at once.


Tile Vertically command

Use the Tile Vertically command to display your windows side by side on screen. With this command, you can resize the windows so they all fit on screen; all windows are visible.


Tile Horizontally command

Use the Tile Horizontally command to display your windows one above the other on screen. With this command, you can resize the windows so they all fit on screen; all windows are visible.


Cascade command

Use the Cascade command to stack and overlap your windows. When you choose this command, the entire top window is visible but only the title bars of the remaining windows are visible.


Arrange Icons command

If you have minimized any document windows, use the Arrange Icons command to arrange the document icons neatly at the bottom of the application window.


Close All command

Use the Close All command to close all open windows. Seagate Crystal Reports gives you an opportunity to save any unsaved work in the open windows.

When you choose the Close All command:

  • if you have saved all your reports, the program closes all the windows.
  • if you have not saved all your reports, the program prompts you to save them, report by report.
      • Click Yes to save the report before closing the window.
      • Click No to close the window without saving the report.


Help menu

The Help menu includes commands used to access Seagate Crystal Reports online help system. It has commands for registering Seagate Crystal Reports, accessing technical information about your computer system, and creating a technical support request. You can switch the Welcome to Seagate Reports dialog box on and off, and if connected to the Internet, you can access several key pages of the Seagate web site using commands on the Help menu. One other command provides information about the version you are using.


Seagate Crystal Reports Help command

Use the Seagate Crystal Reports Help command to start the online help system.


Context Help command

Use the Context Help command to activate the context help pointer that you can use to identify elements of the interface.

Note: This command is also available as a button on the Standard toolbar.


Welcome Dialog command

Use the Welcome Dialog command to display the Welcome to Seagate Reports dialog box where you can choose from the following options:

  • Create a new report using a report expert
  • Create a new report as a blank report
  • Open an existing report.

If you want this dialog box to appear whenever you start Seagate Crystal Reports, select Show welcome dialog at startup.

Report Expert


Getting Started Guide

Use the Getting Started Guide command to jump to the online Seagate Crystal Reports Getting Started Guide to give you an easy introduction to reporting with Seagate Crystal Reports.


Seagate Software on the Web

Use the Seagate Software on the Web submenu to access the following commands:

  • Free Stuff
  • Product News
  • Product Updates
  • Developer Samples
  • Online Support
  • Seagate Software Solutions
  • Product Registration
  • Seagate Software Community
  • Seagate Software Home Page

Your Web browser is automatically activated when you select any of these commands.


Free Stuff

Use the Free Stuff command to access the Files and Updates Index on the Seagate Software Web site. From the Files and Updates Index, you can download new versions of Seagate Crystal Reports, new language-specific sections, additional User-Function libraries, and sample applications—to name only a few categories.


Product News

Use the Product News command to access the Product Info page on the Seagate Software Web site. The Product Info page offers the latest information on new Seagate Software products.


Product Updates

Use the Product Updates command to access the Files and Updates page on the Seagate Software Web site. From this page you can find and download the most recent versions of Seagate Software products.


Developer Samples

Use the Developer Samples command to access the Files and Updates page on the Seagate Software Web site. From this page you can find and download all the latest sample reports and applications for Seagate Software products


Online Support

Use the Online Support command to access the Tech Support page on the Seagate Software Web site. From the Tech Support page, you can choose from a variety of options for finding help with your Seagate Software product.


Seagate Software Solutions

Use the Seagate Software Solutions command to access the Solutions page on the Seagate Software Web site. On the Solutions page, you will find valuable information about Seagate Software Business Intelligence Solutions, including links to more information about all of Seagate Software Business Intelligence Solutions software products.


Product Registration

Use the Product Registration command to access the Register Product page on the Seagate Software Web site. You can register your product at this page.


Seagate Software Community

Use the Seagate Software Community command to access Community on the Seagate Software Web site.


Seagate Software Home Page

Use the Seagate Software Home Page command to access the Seagate Software Home Page on the Seagate Software Web site.


Register/Change Address command

Use the Register/Change Address command to register and/or notify the company of a change of address.

Note: You must send in the registration form in order to receive technical support for your product.


Technical Support Request command

Use the Technical Support Request command to fill out a technical support request. When you are finished, you can print the report and either fax or mail it. When you choose this command, the Technical Support Request dialog box appears. Enter the information in this dialog box.

Note: You must send in the registration form in order to receive technical support on your product.

Related topics

Technical Support Request dialog box


About Seagate Crystal Reports command

Use the About Seagate Crystal Reports command to learn the version number and other pertinent information about Seagate Crystal Reports.


Shortcut menus

Everywhere in Seagate Crystal Reports you can display shortcut menus, by clicking the right mouse button. These menus enable you to work more quickly by providing quick access to the commands that are relevant to what you are doing at the time. For example if you have a text object selected right-clicking brings up a shortcut menu listing all the text editing and formatting commands.


Cancel Menu command

Use the Cancel Menu command to cancel the shortcut menu.


Standard toolbar

The standard toolbar contains several commonly used commands. You can switch the toolbars on and off using the Toolbars command, or from the shortcut menu that appears when you right-click the toolbar or menu area.

If you are not sure about the function of a button on the Standard toolbar, place the pointer over the button and hold it there until the tool tip appears.

The buttons on the Standard toolbar perform the following functions:

Creates a new report. Shortcut to the New command.

Opens an existing report. Shortcut to the Open command.

Saves the report. Shortcut to the Save command.

Sends the report to a printer. Shortcut to the Printer command.

Displays a preview of the report on the Preview tab. Shortcut to the Print Preview command.

Exports the report in one of several popular formats. You can export to a disk file, to an application, to a Lotus Notes database, to an Exchange Folder, or to e-mail. Shortcut to the Export command.

Refreshes report data. Shortcut to the Refresh Report Data command.

Cuts selected object/data to the clipboard. Shortcut to the Cut command.

Copies the selected object/data to the clipboard. Shortcut to the Copy command.

Pastes object/data from the clipboard to the report. Shortcut to the Paste command.

Undoes an action. Shortcut to the Undo command. Use the drop down list to undo more than one action.

Redoes the latest action that was undone. Shortcut to the Redo command. Use the drop down list to redo more than one action.

Inserts a hyperlink. Shortcut to the Hyperlink command on the Insert menu.

Opens the Field Explorer for you to insert database fields Shortcut to the Database Field command on the Insert menu.

Inserts a text object. Shortcut to the Text Object command on the Insert menu.

Inserts a summary. Shortcut to the Summary command on the Insert menu.

Activates the Report Expert. Shortcut to the Report Expert command.

Activates the Section Expert for you to format any section of the report. Shortcut to the Section command.

Activates the Select Expert for you to set record/group selection criteria. Shortcut to the Select Expert command.

Sets record sort order. Shortcut to the Record Sort Order dialog box.

Inserts a chart. Shortcut to the Chart command on the Insert menu.

Inserts a map. Shortcut to the Map command on the Insert menu.

Finds a specific record. Shortcut to the Find command.

Sets the magnification factor for viewing your report.


Formatting toolbar

The Formatting toolbar contains commands for formatting the selected field.

Use the two lists to the left of the Formatting toolbar to change the font and font size of the selected field.

The buttons on the Formatting toolbar perform the following functions:

 | Increases the font size of the selected data one point each time the button is clicked.
 | Decreases the font size of the selected data one point each time the button is clicked.
 | Changes the selected data to boldface.
 | Italicizes the selected data.
 | Underlines the selected data.
 | Aligns the selected data flush left.
 | Centers the selected data.
 | Aligns the selected data flush right.
 | When a number field is selected, places a currency symbol with the number.1
 | When a number field is selected, places a thousands separator in the number.1
 | When a number field is selected, places a percentage sign with the number.1
 | When a number field is selected, adds one decimal place to the number.1
 | When a number field is selected, removes one decimal place from the number.1
 | Activates the Highlighting Expert. Shortcut to the Highlighting Expert command on the Format menu.
 | Toggles the Group Tree on and off on the Preview Tab. Shortcut to the Group Tree command on the View menu.
 | Toggles the Supplementary toolbar on/off.
1The program refers to the settings in the Regional Settings section of the Control Panel (Windows 95, Windows 98, and Win NT 4.0).


Supplementary Tools toolbar

The Supplementary toolbar provides quick access to many advanced, report-enhancing experts and features. To display this toolbar click the Toggle Supplementary Toolbar button, found on the far-right end of the Formatting toolbar.

The buttons on the Supplementary toolbar perform the following functions:

Inserts a line. Shortcut to the Line command on the Insert menu.

Inserts a box. Shortcut to the Box command on the Insert menu.

Inserts a picture. Shortcut to the Picture command on the Insert menu.

Arranges report elements automatically to best fit the page. Shortcut to the Auto-Arrange Report command.

Activates the Report Style Expert to apply a professionally designed style to a report. Shortcut to the Report Style Expert command.

Inserts a group. Shortcut to the Group command on the Insert menu.

Inserts a subreport. Shortcut to the Subreport command on the Insert menu.

Inserts a cross-tab object. Shortcut to the Cross-Tab command on the Insert menu.

Finds Top/Bottom N records or sorts on summary information. Shortcut to the Top N/Sort Group Expert command.

Activates the appropriate editor to modify object properties.

Opens the Visual Linking Expert to define links between tables. Shortcut to the Visual Linking Expert command.


Analyzer Tools toolbar

The Analyzer Tools toolbar allows you to quickly view and customize maps and charts. To display the Analyzer Tools toolbar, choose the Toolbars command from the View menu and then toggle the Analyzer check box on in the Toolbars dialog box.

Some of these buttons operate on charts, some on maps. Some operate on maps or charts in any tab, others only operate in the Analyzer tab. To display the Analyzer Tab click on the map or chart you want to work with, and choose Launch Analyzer from the Analyzer menu.

One drop-down list appears at the left-hand side of the Analyzer Tools toolbar.

Use this drop-down list to change the color of a single item on a chart in the Analyzer tab (for example, to change the color of one of the bars on a bar chart).

The buttons on the Analyzer Tools toolbar perform the following functions:

Opens the Choose a Chart type dialog box for changing the type of chart displayed.

Opens the Chart Options dialog box, for setting the general properties of the chart.

Opens the Titles dialog box for adding titles to the chart and its axes.

Opens the Series Options dialog box for setting properties for the selected data series on a chart in the Analyzer tab.

Opens the Numeric Axes, Grids & Scales dialog box for setting these properties of the chart.

Opens the Formatting dialog box for setting font line and fill properties of the selected item on a chart in the Analyzer tab.

Opens the Choose a Viewing Angle dialog box for changing the viewing angle of a surface chart.

Activates the drill-down mode, and changes the cursor to a Drill-down cursor. Shortcut to the Select Mode command.

Activates the zoom in mode, and changes the cursor to a Zoom cursor. Shortcut to the Zoom In command.

Activates the zoom out mode, and changes the cursor to a Zoom cursor. Shortcut to the Zoom Out command.

Activates the Pan mode, and changes the cursor to a Panning cursor. Shortcut to the Pan command.

Centers the map. Shortcut to the Center Map command.

Opens the Customize Map dialog box, for changing the style and appearance of the map on the Analyzer Tab. Shortcut to the Change Map Type command.

Opens the Layer Control dialog box, for rearranging the layers of the map on the Analyzer Tab. Shortcut to the Change Map Layers command.

Opens the Map Region Resolver for resolving mismatches between the names of regions in the data and those on the map. Shortcut to the Resolve Mismatch command.


Using The Commands

This section provides you with step-by-step procedures for some of the commands you will use most often in Seagate Crystal Reports.


Using the Auto-Arrange Report command

  1. Create your report as you normally would.
  • Select and position database fields.
  • Build and place the database formulas.
  2. Group and summarize the data using groups and summary fields.
  3. On the Format menu, click Auto-Arrange Report. The program adjusts field size and placement, and automatically prints an attractive, balanced report to the screen.
Related topics

Auto-Arrange Report command


Using the Border and Colors command

  1. Select the field you want to format.
  2. Choose the Border and Colors command from the Format menu (or right-click and choose the Change Border command from the shortcut menu that appears). The Format Editor appears with the Border tab (Format Editor) selected.
  3. Select the text color, fill, border, and box sizes you want.

Note: All colors are fixed; they cannot be edited.

Related topics

Border and Colors command


Using the Copy command

  1. Select the text or object you wish to copy.
  2. Choose the Copy command from the Edit menu. The program makes a copy of the selected text or object and sends it to the Clipboard for later use (or until it is overwritten when you next use the cut or copy command). The text or object you selected in the report remains in place, unchanged.
Related topics

Copy command


Using the Cut command

  1. Select the text or object you wish to cut.
  2. Choose the Cut command from the Edit menu. The program cuts the text/object and holds it in the Clipboard for later use (or until it is overwritten when you next use the cut or Copy command). Cut text or objects are deleted from your report.
Related topics

Cut command


Using the Database Field command

  1. Choose the Database Field command from the Insert menu. The Field Explorer appears, with Database Fields highlighted, listing all of the fields in the active database.

    Note: If you are working with Btrieve and using a .DDF file that contains more than four database files, only the file names, not the field names are displayed.

  2. Select the field of interest from the list.
  3. Click the Insert button. An object frame appears.
  4. Move the frame to the desired insertion point and click to place it.
  5. Repeat Steps 2-4 until you have inserted all the fields you want to insert.
  6. Click Close when finished.

Note: For your convenience in setting up a report, the object frame is sized to approximate the true field width of the field selected. If the automatic field heading is longer than the field name (for example, the heading State over a two character state abbreviation), the frame is sized to match the width of the heading, not the width of the field itself.

Related topics

Database Field command

To insert a database field


Using the Delete Group command

  1. Choose the Delete Group command from the Edit menu. The Delete Group dialog box appears, listing all the groups currently included in the report.
  2. Choose the group you want to delete and click OK. The program deletes the group as specified.
Related topics

Delete Group command


Using the Delete Section command

  1. Choose the Delete Section command from the Edit menu. The Section Expert, listing all the sections in the report.
  2. Choose the section you want to remove and click the Delete button. The program deletes the entire section and all the elements it contains.
Related topics

Delete Section command


Using the Font command

  1. Select the field you want to edit.
  2. Choose the Font command from the Format menu. The Format Editor appears with the Font tab selected.
  3. Make the desired changes and click OK. The program applies the font changes to the selected report element.
Related topics

Font command


Using the Edit Formula command

  1. Select the formula you want to edit.
  2. Choose the Formula command from the Edit menu. The Formula Editor appears with the formula displayed in the formula text box.
  3. Modify the formula as needed.
  4. Click the Save and Close button.
Related topics

Formula command


Using the Formula Field command

  1. Choose the Formula Field command from the Insert menu. The Field Explorer appears with Formula Fields selected.
  2. Click the New button. The Formula Name dialog box appears.
  3. Enter the name for the new formula and click OK. The Formula Editor appears.
  4. Enter your formula in the Formula text box. See Creating a formula and inserting it into a report.
  5. When you have completed your formula, click Save and Close. The program checks the syntax and, if it is correct, displays the object frame. (If the syntax is incorrect, you will need to make the necessary syntax changes first. Then, when you click Save and Close, the object frame will appear.)
  6. Move the frame to the place you want to insert the formula and click to place it.
Related topics

Formula Field command


Using the Grand Total command

  1. Click the field you want totaled (or averaged, or counted, and so on).
  2. Choose the Grand Total command from the Insert menu. The Insert Grand Total dialog box appears.
  3. Click the arrow button on the list to reveal a list of possible grand total operations.
  4. Select the desired operation you want and click OK to return to the Design tab. The program calculates the grand total value, creates a Grand Total section for the report, and places the Grand Total value in that section.
Related topics

Grand Total command


Using the Group command

  1. Choose the Group command from the Edit Selection Formula menu, on the Report menu. The Group Selection Formula Editor appears. This formula restricts the groups that are printed.
  2. You can use the full range of operator, functions, and data fields to edit your formula.
  3. Click Save and Close when finished. The program limits the report to the groups specified.

Note:

  • No object frame appears when you create a selection formula; the formula is simply stored in the report.
  • Your group selection formula must be Boolean, that is, it must result in a Yes or No answer.
  • You cannot use commas in numbers you enter in a formula. Enter only the number itself.
Related topics

Group command


Using the Group Name Field command

  1. Choose the Group Name Field command from the Insert menu. The Field Explorer appears with the Others selected.
  2. Highlight the desired Group Name Field and click the Insert button. An object frame appears.
  3. Drag the Group Name field to the desired insertion point and click to place it.
  4. Repeat Steps 2 and 3 to add any additional Group Name fields.

Group Name Field command


Using the Group Number Field command

  1. Choose the Special Field command from the Insert menu. The Insert Fields dialog box appears with the Others tab selected. Select the Group Number command from the list that appears in the scroll box.
  2. Drag the Group Number Field to the desired insertion point and click to place it.

    A number is assigned to each group as the records are processed for printing. The number assigned represents the number of the group in the print sequence. The groups A, B, and C, for example, if sorted in ascending order (A to Z), will have the following group numbers: Group A = 1, Group B = 2, Group C = 3. The same groups, if sorted in descending order (Z to A), will have the following group numbers: Group C = 1, Group B = 2, Group A = 3. The term group number thus refers to the position of the group in the report, not to the data in the group; if a group of data changes its position in a report (relative to other groups), its group number changes as well.

Note: Only the innermost groups are numbered. For example, if the records are grouped first by city and then by state, a group name field will refer only to the current city group number, not to the current state group number.


Using the Links command

  1. Choose the Links command from the Edit menu. The Links dialog box appears.
  2. Select one or more links.
  3. Make the desired changes.
  4. When finished, click Close to return to the report.
Related topics

Links command


Using the Log On/Off Server command

To log off a server
  1. Choose the Log On/Off Server command from the Database menu.
  2. The Data Explorer shows the various server types and the servers that are available to your system. Browse through the folders to the server you wish to log off.
  3. Click Log off.
To log on to a server
  1. Choose the Log On/Off Server command from the Database menu.
  2. The Data Explorer shows the various server types and the servers that are available to your system. Browse through the folders to the server you wish to log off.
  3. Click Log on.
  4. A dialog box appears, requesting server-specific login information. Use this dialog box to identify yourself and to specify the database you want to activate.
  5. Enter the requested login information and click OK. The program logs you onto the specified server and returns you to the Design tab.

Note: If you want to activate multiple databases from the same server, you need to log on to the server each time you want to activate another database.

Related topics

Log On/Off Server command


Using the Page Setup command

  1. Choose the Page Setup command from the File menu. The Page Setup dialog box appears with the current margin settings displayed and the Use Default Margins check box selected.
  2. Accept the default margins or enter new margins.
  • To accept the default margins, click OK. The program returns you to the Design tab.
  • To change the margins, enter your new margins in the Top, Left, Bottom, and/or Right Margin edit boxes. When you change any of the default margins, the program clears the Use Default Margins check box.
  • To restore the margins to their default settings, select the Use Default Margins check box.
  3. Click OK. The program returns you to the Design tab where your new margins are now in place.
Related topics

Page Setup command


Using the Page Number Field command

  1. Choose the Special Field command from the Insert menu. The Insert Fields dialog box appears with the Others tab selected. Select the Page Number command from the list that appears in the scroll box.
  2. Drag the frame to the desired insertion point and click to place it.

Note: The Section command on the Format menu allows you to reset the page number for invoices, statements, and so on

Related topics

Set Print Date/Time command


Using the Paragraph Formatting command

Use the Paragraph Formatting command to set alignment and indentation for a paragraph within a text object.

  1. Click within the text object that you want formatted and choose the Paragraph Formatting command from the Format menu. The Format Editor appears with the Paragraph Formatting tab (Format Editor) selected.
  2. Select the desired alignment from the Alignment list.
  3. Enter the desired indentations (in inches) into the appropriate edit boxes.
  4. Click OK.

Note: The unit of measurement used in the dialog box (inches or centimeters) is based on the Measurement setting in the International section of the Windows Control Panel (English = inches, Metric = Centimeters).


Using the Paste command

To paste text within a text object
  1. Position the I-beam cursor at the place where you want the text to appear and click.
  2. Choose the Paste command from the Edit menu. The program pastes the text behind the text cursor.
To paste an object
  1. Choose the Paste command from the Edit menu.
  2. Drag the object outline to the place where you want the object to appear, and click to place the object.
Related topics

Paste command


Using the Record command

  1. Choose the Record command from the Edit Selection Formula menu on the Report menu. The Record Selection Formula Editor appears, displaying the current record selection formula.
  2. You can use the full range of operator, functions, and data field to edit the formula. This formula restricts the range of data that will print. For example, if you want to extract only those records where the item number begins with AA, you can use the Subscript operator in the selection formula:

    {file.Item number} [1 to 2] = "AA"

  3. Edit your formula.
  4. Click Accept when finished. The program limits the report to the records specified.

Note:

  • No object frame appears when you create a selection formula; the formula is simply stored in the report.
  • Your record selection formula must be Boolean; that is, it must result in a Yes or No answer.
  • You can not use commas in the numbers you enter in a formula. Enter only the number itself.
Related topics

Record command


Using the Refresh Report Data command

With a report open, choose the Refresh Report Data command from the Report menu. The Refresh Report Data dialog box appears. Click OK. The program runs the report again and retrieves new data.

Related topics

Refresh Report Data command


Using the Remove from Report command

  1. Choose the Remove from Report command from the Database menu. The Remove from Report dialog box appears. As you select a database from the list, the program displays the location (path) of that database in the Location box at the bottom of the dialog box.
  2. Select the database you want to delete, and click Remove.
  • If the report does not contain fields from this database, the program removes the database from the report.
  • If the report does contain fields from this database, the program prompts you to remove the fields from your report before it removes the database from the active list.

    Note: The fields that need to be deleted can be found in the report itself, in the selection formula, in the sort order, or in a formula field. Check all possibilities.

  3. Click Done when finished.
Related topics

Remove from Report command


Using the Save Data with Report command

Use the Save Data with Report command to save the report definition and the underlying data with your report. When this command is active, then when the report is opened again, it will include the data that was available the last time it was saved.

When this command is inactive, the data will refresh each time the report is opened. The report will include the most recent data available.

  1. Choose the Save Data with Report command command from the File menu.

    A check shows that the Save Data with Report option is active. By default, this option is active.

  2. Switch the check mark on/off as desired. The program will save data accordingly.
  • If you save your data with the report, your report will require more disk space (enough for the report template and the data), but the program will not need to retrieve the data before printing.
  • If you save only the definition, your report will require somewhat less disk space (enough for the template only) but the program will need to retrieve the data before it prints the report.

Note: When the program saves the data with the report, it compresses the data in order to take less disk space. It decompresses the data when it opens the report.


Using the Section command

  1. Choose the Section command from the Format menu. The Section Expert appears. The Sections list in the dialog box lists all of the sections in the current report.
  • By default the Sections list contains five listings: the Report Header section, the Page Header section, the Details section, the Page Footer section, and the Report Footer section.
  • If you have added groups or subtotals, the program creates a group header section (Group header #n) and a group footer section (Group footer #n) for each unique group.
  • If you have added summaries, the program creates a group header section (Group header #n) and a group footer section (Group footer #n) for each summary.

    Note: Group sections are numbered consecutively in the order in which they were created, and they appear on the list in the format: Group header #n:file.triggerfieldname or Group footer #n:file.triggerfieldname.

  • If you have added a grand total (sum, average, count, and so on), the program creates a Grand Total section to hold the value. Only one Grand Total section will appear on the list.
  2. Select the option(s) of interest, and click OK to finish formatting the section.

    Not all options are available for formatting all sections. For example, the New Page Before and New Page After options are not available when you format the Page Header section. The program already generates a page break before each Page Header section, and since a header can not stand alone on a page, there is no need for the Page Break After option.

For maximum efficiency in formatting sections, do the following
  1. Right-click the section of interest in the gray area at the left of the Design tab.
  2. Choose the Format Section command from the shortcut menu that appears. The program takes you directly to the Section Expert.
  3. Make your formatting selections as described above.
Related topics

Section command


Using the Set Alias command

  1. With a report open in the active window, choose the Set Alias command from the Database menu. The Set Alias dialog box appears. The Databases list contains a list of aliases used in the current report, and the first alias on the list is highlighted. The Location box at the bottom of the dialog box indicates the name and path of the database that is using the highlighted alias.
  2. Select the alias of interest and click the Set Alias button. The Alias Name dialog box appears with the alias displayed in the Alias Name box.
  3. Type your new alias in the Alias Name box, and then click OK. The program returns you to the Set Alias dialog box. The new alias has replaced the old alias in the Databases box but the location remains the same.
  4. Click Done. The program replaces the old alias with the new one. Fields already placed in the report using the old alias are now identified with the new alias ({old.fieldname} is now {new.fieldname}).

    The Set Alias command does not affect the aliases used in formulas. When you change an alias, you must make certain that you change any formula references to the old alias as well. For example, if you change the "company" alias to "customer", you must make certain that you change any formula references to that alias from {company.fieldname} to {customer.fieldname}. If you don't, the program will not be able to locate the referenced field, and it will return an error message. Formula references include both formulas used in the report and selection formulas.

Note: Set Alias changes the alias only, not the database location. If you want to change the location of a database (if you want to find the database in a new location), choose the Set Location command from the Database menu.

Related topics

Set Alias command


Using the Set Location command

If your report is accessing a Data File directly:

  1. Choose the Set Location command from the Database menu. The Set Location dialog box appears. The Databases list contains a list of active databases appears in the Databases box (the large box on the left).
  2. Select the database for which you want to change the location. When you highlight a database on the list, the program displays the location (path) of that database in the Location box at the bottom of the dialog box.
  3. Set the new location for the database:
      • If you want to set the database location to the location of the active report, click the Same As Report button. The program will now look for the database in the directory in which you have saved the report.
      • You cannot use the Same As Report button until you have saved the report.
      • If you want to set the database location to a location other than the location of the active report, click the Set Location button. The Choose Database File dialog box appears.
      • If you want to choose a database with a different name, type the new name in the Database Name box at the top of the dialog box.
      • If you want to change the directory or disk location of the file, set the new location in the Directory box. When you make a change in the box, the program displays the new location in the Directory box.
      • If you want to change both the name and the location, you can enter in the new name and include the new path in the Database Name box, or you can type the new name in the Database Name box and select the new location from the Directory box.
  4. Click Done. The program changes the report to reflect the new name and location.

If your report is accessing a data source via a protocol such as SQL/ODBC/ADO/RDO/OLEDB, and so on, you will see a different set of dialog boxes to help you set the database location.

Related topics

Set Location command


Using the Set Print Date/Time command

  1. Choose the Set Print Date/Time command from the Report menu. The Set Print Date/Time dialog box appears.
  2. Click the Today's Date/Time option to print the current date. The current date is determined by the settings in the Date/Time Control Panel on your Windows system.
  3. Click the Other option to set the date that is printed by the Print Date field.
  4. Set the Year, Month, and Day by entering in a new value in the appropriate text box.
  5. Click OK. When the report is printed, the Print Date field will display the specified date.

Note: Changes you make with this command will affect formulas with functions that contain reference to the current date (Aged30days, AllDatesToToday, and so on). When you change the print date, these functions do their calculations based on the new print date.

Related topics

Set Print Date/Time command


Using the Subtotal command

  1. Select the field that you want to subtotal.
  2. Choose the Subtotal command from the Insert menu. The Insert Subtotal dialog box appears.
  3. Use this dialog box to set the conditions that trigger the printing of a subtotal.
  4. Click OK. The program automatically inserts the subtotal into the group section of your report. If you have already entered other subtotals for the same field, the program creates a new section for the new subtotal.
Related topics

Subtotal command


Using the Summary command

  1. Select the field that you want to summarize.
  2. Choose the Summary command from the Insert menu. The Insert Summary dialog box appears.
  3. Select a calculation option from the first list.
  4. The second list contains a list of the fields and formulas being used in the report. Click the arrow button to reveal the list, and select from that list the field that you want the program to use for triggering summaries.
      • The program will first sort report data based on this field.
      • Then it will go down the report grouping and summarizing the data whenever the value in the sort-and-group-by field (the trigger field) changes.
      • If you select a date or Boolean field, you can further narrow your selection.
  5. The next scroll box lists the four sort directions.

    The default direction is ascending order. If you want to change the sort direction, click the scroll arrow to reveal the options and then select one of them.

  6. Click OK. The program sorts, groups, and summarizes your data, and then places the summary in the group section of your report. You can then move it to the desired position.
Related topics

Summary command


Using the Summary Field command

  1. While in the Design tab, select the summary of interest.
  2. Choose the Summary Field command from the Edit menu. The Change Summary Operation dialog box appears.
  3. Select the desired summary operation. When you click OK, the program changes the summary to conform to your new selection.
Related topics

Summary Field command


Using the Summary Info command

Use the Summary Info command to read or include the following information with your report: comments, author, keywords, title, subject and template information. Summary information accompanies the report but does not appear in the report itself.

  1. Choose the Summary Info command from the File menu. The Document Properties dialog box appears with the Summary tab active.
  2. Enter/edit the desired information.
  3. Click the Statistics tab to read document statistics
  4. Click OK to return to your report.

Note: You can enter a Comment of any length up to one hundred lines. The text wraps automatically to fit the lines within the margins of the edit box.


Using the Tabs command

Use the Tabs command to set the tab position and alignment for paragraphs in a text object.

  1. Double-click the text object you want to format and choose the Tabs command from the Format menu. The Text Format dialog box appears with the Tabs tab (Text Format) active.
  2. Enter the desired tab position into the position edit box.
  3. Specify the desired tab alignment by choosing the appropriate option button.
  4. Click the Set button to set the tab.
  5. Repeat steps 2 through 4 to set additional tab positions.
  6. Click OK to return to your report.

Note: The unit of measurement used in the dialog box (inches or centimeters) is based on the Regional setting in the Windows Control Panel (for example English(United States) = inches, English(United Kingdom) = Centimeters).

Note: You can also set indentation, margins, and tabs by double-clicking the text object and using the in-place ruler.


Using the Verify Database command

  1. With the report active in the Design tab, choose the Verify Database command from the Database menu.
  2. A message box appears, asking whether you want to verify all the files in the report including those that are not being used.
      • Click Yes to verify all the files in the report, used or unused.
      • Click No to verify only those files used in the report.
      • If your report is using ADO, RDO, or DAO to access data then a dialog box will be displayed allowing you to change the command to be executed. When you are satisfied with the command click Finish.
  3. Another message box appears:
      • If the underlying database is unchanged, you will get the following message:

        Database is up to date.

      • Click OK to return to the Design tab.
      • If the underlying database has changed, you will get the following message:

        The database file ([filename]) has changed. Proceed to fix up the report?

      • If you click Yes, the program revises the report to the current version of the database.
      • If you click No, the program attempts to print the report without first adapting it to the current version of the database.
Related topics

Verify Database command


Using the Verify on Every Print command

The Verify on Every Print command is a lock that triggers the Verify Database command command every time you print in order to:

  • print with the current version of the active database
  • reset the record buffer to the current record size
  1. Choose the Verify on Every Print command from the Database menu.

    A check mark indicates that the command is active. By default, the command is inactive.

  2. Switch the check mark on/off as desired. The program will activate or deactivate the command accordingly.


Dialog Box Reference

This section describes the dialog boxes available in Seagate Crystal Reports.


Alias Name dialog box

This dialog box appears when you click the Set Alias button in the Set Alias dialog box, or when you select a new database, if you have cleared the Use Default Alias option (on the Database tab of the Options dialog box). That option is selected by default. The Use Default Alias option tells the program to automatically use the database name (minus the extension) as the default alias. For example, the program will automatically generate the alias xtreme for the xtreme.mdb database.

Use the Alias Name dialog box to change the alias assigned to the selected database:

  • if you want to use the alias currently displayed in the box, click OK
  • if you want to change the alias, type in a new alias and then click OK.

Note:

  • Changes you make via this dialog box do not affect the aliases already used in formulas. When you change an alias, you must make certain that you change any formula references to the old alias as well. For example, if you change the "company" alias to "customer," you must make certain that you change any applicable formula references from {company.FIELDNAME} to {customer.FIELDNAME}. If you do not make these changes, the program will not be able to locate the referenced field, and will return an error message. Formula references can be found in both formulas used in the report and selection formulas.
  • The Set Alias command changes the alias, and not the database location. If you want to change the location of a database (tell Seagate Crystal Reports to find the database in a new location), choose the Set Location command from the Database menu.
Related topics

Set Alias command

Options command

Database tab

Set Alias dialog box


Allow Reporting On dialog box

This dialog box only appears when you have selected the Reprompt user when connecting check box on the Database tab of the Options dialog box. When you log on to a server and add a table by using the Add Database to Report command from the Database menu, the Allow Reporting On dialog box appears.

Use the options in this dialog box to select the data that you want to report on.

Tables

When you select this check box, the program will report on database tables. This option is selected by default.

Views

When you select this check box, the program will report on virtual tables. This option is selected by default.

Synonyms

When you select this check box, the program will allow you to report on the virtual tables that are available on some hosts. This option is not selected by default.

System Tables

When you select this check box, the program will report on system tables. These tables are typically used by the system administrator only, but are available for use if you have the appropriate permissions. This option is not selected by default.

Procedures

When you select this check box, the program will allow you to report on the result sets from stored procedures (if you are using SQL systems that support stored procedures).

Table Name LIKE

This box allows you to enter the SQL LIKE function to specify the kinds of table names you want to appear in the Data Explorer. You can use the underscore character (_) or the percent sign character (%) as wildcards with this function. The underscore character specifies any single character while the percent sign signifies any character string. For example, DAV_ would match DAVE but not DAVI; whereas DAV% would match both DAVE and DAVID. A table name Like C% would display only those tables that have a table name beginning with the letter C.

Creator LIKE

This box works exactly like Table name Like, except that the LIKE function is used to select the Creator (or Alias) of the table, not the table name itself. For example, Creator Like C% would display only those tables that had an owner beginning with the letter C.

COUNT the tables first

This option will count the tables and give you a warning if there are more than the specified number.

Related topics

Database tab

Options dialog box

Data Explorer


Browse and Paste Data dialog box

This dialog box appears when you click the Browse Data button in the Formula Editor.

Use the Browse and Paste Data dialog box to preview the data type, length, and content of any field and to paste a value into your formula or selection criteria.

  • The source of the field (alias) and the field name appear as the title for the dialog box.
  • The data type for the field (string, number, and so on) appears just below the title.
  • A list of field values appears in the scroll box.

When you are finished reviewing the field data, click the Done button or select a value and click the Paste Data button to paste the value into your formula.

Note:

  • If you need to select multiple values (for example, if you want to include records in which the field value is one of three values), the insertion point automatically moves to the next box after you paste data in the current box.
  • When you browse a field, by default you see the first 500 unique values of the field. You can change this for the current report by clearing the Select Distinct Data for Browsing option in the Report Options dialog box. You can change the default setting by clearing the Select Distinct Data for Browsing option on the Database tab of the Options dialog box.

If Select Distinct Data for Browsing is not selected, browsing returns the unique values in the first 500 records.

Note: Note that since most SQL servers do not support selecting distinct records for long data types such as memo and blob fields, selecting and browsing distinct records are not supported for such fields.

If you fail to connect to a database because it is unavailable or password-protected, you can still browse on saved data.

Related topics

Browse Data dialog box


Browse Data dialog box

This dialog box appears when you click the Browse Data button in a dialog box or when you choose the Browse Data option from the shortcut menu on a selected field.

You can browse data for example:

  • from the Choose Field dialog box
  • in the Select Expert
  • from the Field Explorer.

Note: From the Field Explorer, you can browse database fields, formula and SQL expression fields.

Use the Browse Data dialog box to preview the data type, length, and content of any field.

  • The source of the field (alias) and the field name appear as the title for the dialog box.
  • The data type for the field (string, number, and so on) appears just below the title.
  • The list contains a list of field values.

Note: When you browse a field, by default you see the first 500 unique values of the field. You can change this for the current report by clearing the Select Distinct Data for Browsing option in the Report Options dialog box. You can change the default setting by clearing the Select Distinct Data for Browsing option on the Database tab of the Options dialog box.

If Select Distinct Data for Browsing is not selected, browsing returns the unique values in the first 500 records.

Note: Note that since most SQL servers do not support selecting distinct records for long data types such as memo and blob fields, selecting and browsing distinct records are not supported for such fields.

If you fail to connect to a database because it is unavailable or password-protected, you can still browse on saved data.

Related topics

Browse Field Data command


Change Group dialog box

This dialog box appears when you choose the Change Group Expert command from the Report menu.

Use the Change Group dialog box to reposition groups and to edit the criteria used for triggering and sorting groups.

Groups

This list lists all the groups in the report.

When you enter a group, that group appears directly above and below the Details section. When you add a second group, it appears between the Details section and the first group. The third group is between the Details section and the second group, and so on. Thus, when you look at the Design tab, the Group Header for the first group is the top group header, and the Group Footer for the first group is the bottom group footer.

This group list reflects the group footer order of groups; the bottom group in the list is the first group, the group next to the bottom is the second group, and so forth.

When you select a group in this list, the program activates those buttons that apply to the selected group.

Options

When you click this button the Change Group Options dialog box appears. Use this dialog box to edit the criteria used for triggering and sorting groups.

Move Up

Use this button to move the selected group up in the group hierarchy. For example, if you grouped first by state and then by country, the country group is at the top of the list followed by the state group. If you decide that you want your data grouped by country first and then, within each country, by state, you need to move the state group up. To do this, select the state group and click the Move Up button. When you run your report, the grouping will take place in the new order.

Move Down

Use this button to move the selected group down in the group hierarchy. For example, if you grouped first by state and then by country, the country group is at the top of the list followed by the state group. If you decide that you want your data grouped by country first and then, within each country, by state, you need to move the country group down. To do this, select the country group and click the Move Down button. When you run your report, the grouping will take place in the new order.

Related topics

Change Group Expert command


Change Group Options dialog box

This dialog box appears when you click the Options button in the Change Group dialog box.

Use the Change Group Options dialog box to edit an existing group.

Database field

Use this list to select a new database field to group by.

Order

Use this list to select the sort order for your group.

Customize Group Name Field

The group name field is displayed in the group tree and in the group header. By default, the group name field has the same values as the group field. Select this check box to change the group name field to:

  • a database field
  • a group name formula that returns a string value, to generate values for a group name field.

For example, you could group on the Customer ID, but display the Customer Name as the group name.

Alternatively, you could group on the Customer ID, but use the following formula to display both the Customer ID and the Customer Name in the group name:

ToText ({Customer.CustomerID}) + " : " + {Customer.CustomerName}

Note: You cannot include a field that is evaluated at runtime, such as a running total field, summary field or another group name field, in a group name formula.

Keep group together

Select this check box to keep your groups from breaking across pages.

Repeat group header on each new page

If you want your groups to break across pages, select this check box to repeat the group header for every successive page.

Related topics

Change Group dialog box

Insert Group dialog box

Specified Order tab

Others tab


Change Icon dialog box

This dialog box appears when you click the Change Icon button in the Convert dialog box.

Use the Change Icon dialog box to change the appearance of the icon you are using to represent an OLE object in your report.

Current

Displays the current icon in your report.

Default

Displays the default icon in your report.

From File

Enables you to select an icon from the specified file. You can choose any icon in an icon file, a library file, or an executable file. Select the icon from the scroll box below the file name. Click the Browse button to select a different file.

Label

Specifies the icon label that appears in the report.

Browse

Click the Browse button to select a different file containing icons. You can use choose one of the icons in an icon file, a library file, or an executable file.

Related topics

Convert dialog box

Inserting OLE objects into reports


Change Geographic Map dialog box

The Change Geographic Map dialog box opens when you choose the Change Geographic Map command from the Analyzer menu, or from the map's right-click menu. Change Geographic Map is available only when you are working with a map on the Analyzer tab.

Use this dialog box to specify the map you'd like to see if you want to have your data values presented with a different geographic map. For example, if the data used on your map applies only to Asia, you can choose the map of Asia instead of the default World map. This change gives you a more detailed map of Asia for a better presentation of your data.

Current Map

This box displays (for viewing) the geographic map that is currently used for the map selected on the Analyzer tab. The same geographic map is highlighted in the Candidate Maps box.

Candidate Maps

This box displays a list of the possible geographic maps you can select for your report. Highlight the geographic map of your choice and click OK, or double-click the Candidate Map itself. Your map on the Analyzer tab changes to the appropriate geographic map.


Change Map Title dialog box

The Change Map Title dialog box opens when you choose the Change Map Title command from the Analyzer menu, or from the map's right-click menu. Change Map Title is available only when you are working with a map on the Analyzer tab.

Use this dialog box to specify or change the title you'd like to use for your map. The dialog box is empty if you did not specify a map title on the Text tab of the Map Expert. Otherwise, the title you specified earlier appears in the Change Map Title dialog box.

Enter a new title, or edit an existing one in the dialog box and click OK when you are done. The new title appears on your map in the Analyzer and Preview tabs.

Related topics

Map Expert


Change Summary Operation dialog box

This dialog box appears when you use the Change Summary Operation command. The command is available when you:

  • right-click a summary field and choose the Change Summary Operation command from the shortcut menu,
  • when you choose Summary Field command from the Edit menu,
  • when you click the Set Summary Operation button on the Data tab of the Map Expert. This button is only active when you have cleared the Don't summarize values check box, and when you have selected a field in the Map Values list.

Use the Change Summary Operation dialog box to set or change the summary operation for the selected field.

Summary

Select a summary operation from the list. Use the Summary list to set the summary operation for the summary field.

Related topics

Summary functions


Character Separated Values dialog box

This dialog box appears when you use the Export command to export a file in Character Separated Values format. From the Export dialog box, select the Character Separated Values from the Format list; the Character Separated Values dialog box appears.

Use this dialog box to specify the character(s) you want used to separate fields and to specify single or double quotes as a delimiter to surround non-numeric fields.

Separator

When you export a report to a character separated file, you need to specify the character that will be used to separate one field from the next (the field delimiter) in that file. Enter any keyboard character in this box and the program will use that character as a separator.

When you import the file into another application, that application will be able to separate the data into fields whenever it sees the character you specify.

Note: It is best not to specify quotation marks as your separator, since they are already used to surround non-numeric fields.

Delimiter

When you export a report to a character separated file, the program encloses all non-numeric fields in quotation marks. You need to specify whether the program should use single (') or double (") quotes. Using the keyboard, type the kind of quotation marks you want in this box.

Related topics

Export command

Export dialog box


Choose Cube dialog box

The Choose Cube dialog box allows you to choose the data cube to work with in your report. This dialog box appears when you click Connect in the Connect to OLAP DB Servers.

Choose Cube

Click a cube.

Related topics

Creating an OLAP report


Choose Export File dialog box

This dialog box appears when you click the OK button in the Number and Date Format dialog box which you can open by choosing the Export command from the Print menu (under the File menu).

Use the Choose Export File dialog box to specify the file name (and path) to which you want to export the file.

  • Using the Save in list, specify the folder in which you want to save the file.
  • In the File name box, specify the file name you want to use.
  • Click Save. The program exports the data to the file you specified.
Related topics

Export command

Exporting a report


Choose Field dialog box

This dialog box appears when you choose the Select Expert command on the Report menu if you do not have a field selected.

Use the Choose Field dialog box to select a field for record selection.

Fields

This list displays the report fields available in your report for use in record selection.

Browse

Click Browse to browse the data in the selected field.

Related topics

Select Expert


Choose OLAP Type dialog box

The Choose OLAP Type dialog box allows you to choose the type of OLAP data source to work with in your report. This dialog box appears when you click Server Type on the Data tab of the OLAP Report Expert.

When working with OLAP grid objects, the Choose OLAP Type dialog box contains the following OLAP types for you to select from:

  • Essbase Cube
  • IBM DB2 Cube
  • OLE DB for OLAP
  • Informix MetaCube
  • Holos HDC Cube.

Each of these types, except the last, require you to connect to a server. The last type, the Holos HDC Cube, requires you to enter the path for an HDC cube location.

Connect To Servers

This dialog box opens when you choose Essbase Cube, IBM DB2 Cube, or Informix MetaCube. Enter the OLAP Server name and your user ID and password to connect to the server.

Connect to OLAP DB Servers

This dialog box opens when you choose OLE DB for OLAP. Enter the OLE DB Provider name, the OLAP Server name, your user ID and password, and any parameters required to connect to the server.

Browse for Database

This dialog box opens Holos when you choose Holos HDC Cube. Enter the path and name of your HDC cube, or click Browse. Browse opens the Add a Holos default file dialog box so you can search for your HDC cube.


Choose Profile dialog box

This dialog box appears when you export to Microsoft Exchange. Please refer to your Microsoft Exchange documentation for more information.


Choose Tables To Use In Visual Linking dialog box

This dialog box appears when you click the Add/Remove Tables button in the Visual Linking Expert.

Use the Choose Tables to Use in Visual Linking dialog box to choose the tables you want to link in your report using the Visual Linking Expert.

Linked Tables

This list box displays all those tables that are currently linked.

Visible Tables

Visible tables are the tables you want to use in your report. When you add a new data file to your report by clicking the Add Table button, the program lists all the tables in that data file in the Visible Tables box unless there are more tables than you might practically use in a report. In that case the tables are listed in the Invisible Tables box and you can select the tables from that box that you want to make visible.

All tables in the Visible Tables box are available for linking and appear in the Field Explorer, the Formula Editor, and so on. When you link a table from the Visible Tables box, the program moves the table name from the Visible Tables box to the Linked Tables box.

Invisible Tables

Invisible tables are the tables you do not want to use in your report. Tables listed in the Invisible Tables section will not appear in the Field Explorer, the Formula Editor, and so on.

  • To make an invisible table visible, select the table in the Invisible Box and click the Add button with the left arrow. This adds the tables to the Visible Box. You can also click the Add All button with the left arrow to add all the tables to the Visible section.
  • To make a visible table invisible, select the table in the Visible Box and click the Add button with the right arrow. This adds the tables to the Invisible Box. You can also click the Add All button with the right arrow to add all the tables to the Invisible section.
Add Table

Use the Add Table Button, to add further database tables to your report. When you click the Add Table button, the Data Explorer appears. Use this dialog box to select the database file or files you want to add to your report. Each time you select a file and click the Add button, the database file is added to the Visible Tables box unless there are more tables in the data file to practically use in a report. In this case the tables are added to the Invisible Tables box.

When you have added the database or databases you need, click Close to return to the Choose Tables To Use In Visual Linking dialog box. The database or databases you added will be in the Visible Tables box.

Perform Smart Linking

When the option is selected, Smart Linking is activated. When the option is not selected, Smart Linking is inactive.

When Smart Linking is turned on, and you click OK in the Choose Tables To Use In Visual Linking dialog box, Smart Linking identifies suggested link fields automatically and performs the links. You can verify the links performed by Smart Linking in the Visual Linking Expert.

Add Index

Click this button to add an index to the currently selected table. The dialog box that opens is a standard Windows search dialog box, called Attach New Index.

Table Description

When you click this button, the Table Description dialog box appears giving you a description of the currently selected table.

All (>>)

Click this button to add all the tables displayed in the Visible Tables list to the Invisible Table list.

Add (>)

Click this button to add the selected table in the Visible Tables list to the Invisible Table list.

Remove (<)

Click this button to remove the selected table from the Visible Tables list box and add it to the Visible Table list.

Remove All (<<)

Click this button to remove all the selected tables from the Visible Tables list box and add them to the Visible Table list.


Color dialog box

The Color dialog box opens when you choose Custom from any list of colors.

Use this dialog box to specify the color you'd like to use on your report if one of the default values will not do. This dialog box is the same as the Color dialog box available in many Microsoft Office products.

Basic colors

This grid displays an assortment of pre-defined colors and shades. These choices allow you to use color shades to represent data ranges in your reports. For example, a best selling item might be bright blue, while subsequent items are represented by darker shades of blue.

Custom colors

This grid displays colors you have created by using Define Custom Colors (until you define custom colors, the grid contains only white sample boxes).

Define Custom Colors

Click Define Custom Colors to see the custom color palate. Click and drag in the color and/or solid palates to see a sample of the color as you create it. You can also define custom colors by entering settings in the boxes below the palates.

Once you have defined a custom color, click Add to Custom Colors to add your new color to the Custom colors grid.


Convert dialog box

This dialog box appears when you choose the Convert Picture Object command from the Edit menu if you have a picture object, or when you choose the Convert command from the Linked Bitmap Image Object submenu of the Edit menu if you have a linked bitmap.

Use the Convert dialog box to convert the selected picture object from its current format to a new format. If your report contains a picture object in a format that you can't edit in one of your applications, use this command to convert the picture to a format that you can edit.

Convert to

Click this to convert the embedded information to a different type. This is useful if you no longer have the program that was used to create the information, or if you want to display the information in a different format than the original type allows. Select the new object type from the list.

Object Type

Lists all the available file types that the object can be converted to.

Activate as

Click this to open the embedded object by using a different program that is compatible with the original object type. This does not permanently convert the object.

Display As Icon

Specifies whether the embedded object will appear in the report as an icon or whether the actual contents of the object will always be visible. Note that some object applications only display objects as icons.

If you select Display as Icon, you can open the object in your document by double-clicking its icon.

Change Icon

Click this button to change the icon that represents the embedded object in your report.

Related topics

Convert Picture Object command


Convert Database Driver dialog box

This dialog box appears when you choose the Convert Database Driver command from the Database menu.

Use the Convert Database Driver command to change the database driver with which you connect to a particular database, for example when moving from an ODBC driver to a native driver.

Convert Database Driver on next Refresh

Select this check box to change the driver the program uses when running your report. You cannot set the name of the driver unless you have selected this check box. This option lets you direct the program to use a different database driver (PD*.DLL):

  • the next time it refreshes data
  • if you are not saving data with the report, the next time you open the report.
To

Use this list to select the new driver.

OK button

When you click OK, the database driver is converted. Depending on the type of database driver you selected, you may be prompted for server or data source information.

The Map Fields dialog box appears if the report database has changed since you last ran the report.

Related topics

Convert Database Driver command


Create Parameter Field dialog box

This dialog box appears when you click the New button when the Parameter Fields entry is selected in the Field Explorer. The Parameter Fields entry is selected in the Field Explorer when you choose the Parameter Field command from the Insert menu.

Use the Create New Parameter Field dialog box to create a parameter field that you can use in a formula, in a record selection formula, or in the body of the report itself.

Name

Enter the name you want to assign to the parameter field in this box. This is the name that will appear in the Fields list in the Formula Editor and it will be used to identify the field when the field is used in the report or in a formula.

Note: When a parameter field name appears, the program puts a question mark at the beginning of the name, to identify it as a parameter field. Thus, if you name a parameter field "Prompt 1," the name will appear in the field list in the Formula Editor as "?Prompt1."

Prompting Text

Enter the text you want the program to use for your prompt into this box. For example, if you are prompting for a state value, you might want to enter a prompt like "Enter state of interest." You can use approximately 20 characters/spaces in your prompt.

Value Type

Select the data type of the parameter field from this list. For example, if you are going to be prompting for a value in a numeric field, select "Number."

Allow multiple values

By selecting the Allow multiple values check box, you can select more than one default value for your parameter field. You can choose more than one default value for your parameter field after you click the Refresh button on the Standard toolbar.

Discrete value(s)

By selecting the Discrete value(s) option, you can select only discrete, or singular, values for your parameter field. If you have Allow multiple values selected, you will be able to select more than one discrete value for your parameter field, though those discrete values will continue to function singularly as opposed to a range value. You can choose discrete values for your parameter field after you choose the Refresh Report Data command.

Range value(s)

By selecting the Range value(s) option, you can select a range of values for your parameter field. For example, if you've selected a currency field, your parameter field (with range value selected) could equal any number that falls between $10,000 and $100,000.

Discrete and Range Values

This option is only available if you select the Allow multiple values check box.

Selecting this option enables you to choose both discrete and range values for your parameter field.

Allow editing of default values

The Allow editing of default values check box is, by default, selected. With this check box selected, you can edit values in the parameter field after the parameter field has been added to the report. To edit default values, click the Refresh button and select Prompt for new parameter values.

Set default values

Click the Set default values button to set the default prompt settings for the parameter field you are creating.

Related topics

Parameter Field command

Creating a parameter field

Field Explorer


Create Running Total Field dialog box

The Create Running Total Field dialog box appears when you select Running Total Fields in the Field Explorer and then click the New button. This is the same as the Edit Running Total Field dialog box that appears when you edit a running total field in the Field Explorer or directly from the report. This description applies to both dialog boxes.

Use these dialog boxes to create or edit running total fields. Running totals are totals that are displayed on a record by record basis. Running Totals total all records (in the report, in the group, and so on) up to and including the current record. For example, if your first three records have values of 2, 4, and 7, the running total for each of the three records would be as follows:

2 + 0 = 2

2 + 4 = 6

6 + 7 = 13

Available Tables and Fields

Lists all tables and fields in the report. Choose the field you want to summarize (the field on which a running total will be based) from this list.

Add (>)

Use the Add button (>) to copy a field from the Available Tables and Fields list into the Field to summarize list.

Running Total Name

Type the name of your running total, for example Last Year's Sales, into the Running Total Name box.

Field to summarize

The Field to summarize list will display a field you select from the Available Tables and Fields list. The running total you are creating will be based on the field in the Field to summarize list.

Type of summary

Use the Type of summary list to select from a number of summary options. The summary type you choose will determine the running total calculation. For example, if you chose Customer.Last Year's Sales as the field to summarize, you can choose to have your running total field perform sum, average, or sample variance calculations on the selected field, to name only a few summary types.

Note: Summary-type options change depending on the field you chose to summarize. For example, you will have one set of summary types when creating a running total for Customer.Last Year's Sales, and you will have a different set of summary types when creating a running total for Customer.Region.

For each record

Use the For each record option to have your running total evaluate each record in a field.

On change of field

Use the On change of field option to have your running total perform its evaluation only when a specified field has changed.

On change of group

Use the On change of group option to have your running total perform its evaluation only when a specified group has changed.

Use a formula

Select the Use a formula option to have your running total use a formula when performing its calculations.

Never

Use the Never option to lock your running total field. With the Never button selected, your running total will perform its calculations on that field throughout the entire report.

On change of field

Use the On change of field list to have your running total evaluate or reset when a designated field changes.

Note: Use the Add button (>) to copy a field from the Available Tables and Fields list to the On change of field list.

On change of group

Use the On change of group list to have your running total evaluate or reset when a designated group changes.

Note: Use the Add button (>) to copy a field from the Available Tables and Fields list to the On change of field list.

Use a formula

Select the Use a formula option to have your running total use a formula to determine when to reset.

Related topics

Creating running totals


Cross-Tab Group Options dialog box

This dialog box appears when you click Group Options in the Format Cross-Tab dialog box.

Use the Cross-Tab Group Options dialog box to create or modify group options for any row or column field used in the cross-tab report. The Group Options button is not available for summarized fields.

Things to consider when grouping on Date fields

When your groups are based on a Date field, the program activates two additional list boxes. The conditions in these boxes enable you to further define sorting and grouping specifications and display specifications.

Related topics

Format Cross-Tab dialog box

Common tab

Use the Common Tab to select the field you want to group on and specify the sort order for.

Sort Order

This list shows the sort direction options. The default option is in ascending order. If you want to change the sort direction, click the box to reveal other options and make your selection from the list.

Note: The additional lists for a Date field include choices for grouping by time periods (each week, each month, and so on) and selecting whether to display the first or last date in a period.

Customize Group Name Field

Use this check box if you want to display a name different from the one chosen by default. By default, the group name on the cross-tab is the same as that of the of the column or row you are grouping on. Selecting this check box makes all options below it active.

Choose From Existing Field

Select this option to create a customized group name from an exiting database field. For example, your cross-tab may be grouped on Customer ID, but you would rather display the Customer Name.

Use a Formula as Group Name

Select this option to create a customized group name from a formula. Clicking the formula button opens the Group Name Formula Editor.

Related topics

Format Cross-Tab dialog box

Specified Order tab

The Specified Order tab appears whenever you select in specified order as a sort order from the Insert Group dialog box or the Change Group Options dialog box.

Use the Specified Order tab when you want to set up custom groups. Custom groups are freeform groups that are not necessarily triggered by any one field value. You define the groups and you specify the individual values that belong in each.

Named Group

Use this box to enter the name you want for your specified order group.You can also browse and select values in the database field to use as group names. For example, if you are creating specified groups to represent regions in the USA, you might look at the list and choose Alaska and Hawaii to be regions of their own.

The box below displays the fields you have selected and the groups you have created as specified order groups.

Up arrow

Click this button to move the highlighted group higher in the list.

Down arrow

Click this button to move the highlighted group lower in the list.

New

Click this button to open the Define Named Group dialog box where you can create a new named group. If you entered a new name in the Named Group list on the Specified Order tab, it appears as the Group Name on the Define Named Group dialog box.

Edit

Click this button open the Define Named Group dialog box where you can edit a group you've highlighted in the Named Group list.

Delete

Click this button to delete the highlighted group.

Related topics

Format Cross-Tab dialog box

Others tab

The Others tab appears whenever you create a new Named Group on the Specified Order tab of the Cross-Tab Group Options dialog box.

Use the Others tab to specify what should be done with database fields that are not chosen as part of your specified order groups.

Discard all others

Select this option if you do not want to print the unselected fields in the groups for your Cross-Tab. If you summarize groups, values in the discarded groups will not be summarized nor will they be included in any grand total if you have one.

Put them all together, with the name

Select this option and enter a name if you want to put all unselected fields in one group. The default name for this group is Others. If you summarize groups, the values in the group will be summarized and will be included in any grand total.

Leave in their own groups

Select this option if you want the unselected fields to form their own groups. If you summarized groups, the values in the group will be summarized and will be included in any grand total.


Curve Fit & Stat Lines dialog box

This dialog box appears when you right-click a data series item on a chart in the Analyzer tab to bring up the shortcut menu, then click Curve Fit and Stat Lines.

Use the Curve Fit & Stat Lines dialog box to fit one or more statistical lines or curves to a series of data on the chart

Curve Types

Shows the available curve types.

Show Curve(s)

Shows the curves that will be displayed on the chart.

Add

Click the Add button (>) to copy the selected curve type from the Curve Types list to the Show Curve(s) list.

Remove

Click the Remove button (<) to remove the selected curve from the Show Curve(s) list.

Remove All

Click the Remove All button (<<) to remove all curves from the Show Curve(s) list.

Show Color same as Series

Use this option to show the curve in the same color as the selected series item on the chart.

Show Formula

Use this option to display the formula of a regression line (linear, log, exponential, and so on).

This option is only available when a regression or polynomial curve is selected in the Show Curves list.

Show Correlation Coefficient

Use this option to display how closely a curve fit line intersects with the data-points it is charting.

This option is only available when a regression or polynomial curve is selected in the Show Curves list.

Smooth Factor

Type a value (between 10 and 1000) in this box to control the smoothness of the curve or regression line. The higher the number, the smoother the curve.

This option is only available when a Smooth, Regression or Polynomial curve is selected in the Show Curves list.

Order

Type a value to specify the order of the curve. The options vary, depending on the curve.

Moving Average

Order determines the number of values within a period. If you enter 3 for the number of periods, the first 3 values (P1, P2, P3) will be averaged. One value is then shifted over to take another 3-value average (P2, P3, P4). This continues (in groups of 3) until the final value is reached.

Polynomial

Order 0 | Draw line at the mean.
Order 1 | Draw linear regression line.
Order 2 | Draw second order curve.
Higher order | Draw higher order polynomials.

Financial/Scientific

Click Financial to plot the average of each period at the right end of the period.

Click Scientific to plot the average of each period in the middle of the period.

These options are only available when a Moving Average curve is selected in the Show Curves list.


Custom Style dialog box

Currency Symbol tab

Use the Currency Symbol tab (click Customize on the Number tab of the Format Editor) to set detailed formatting options for currency fields in your report.

Enable Currency Symbol

Select this check box if you want to display currency symbols in your currency fields.

Fixed

Click this option if you want the program to place the currency symbol in the first (far left) position in the field. The program will leave extra space between the symbol and the currency if the field is justified to the right.

For example:

$ 325.00

$ 401,325.00

Floating

Click this option if you want the program to place the currency symbol as close to the currency amount as possible so that there are never any extra spaces between the symbol and the amount.

For example:

$401,325.00

$325.00

One Symbol Per Page

Select this check box if you want the program to displays/print a currency symbol only once per page, beside the first number/currency value that appears on the page for each field. No currency symbols will appear beside any of the other values for that field on the page.

Position

This list displays all the available positions for the currency symbol.

Currency Symbol

Use this box to enter the desired currency symbol.


Number tab

Use the Number tab (click Customize on the Number tab of the Format Editor) to set detailed formatting options for number fields in your report.

Use Accounting Format

When you select this option:

  • the negative symbol used and its position is determined by the Windows Regional Settings (it will be either the minus sign or the brackets)
  • the dash will be automatically chosen for "Show Zero Values as" (zero values are automatically displayed as dashes ('-') in your report
  • the currency symbol is fixed on the left side.
Suppress if Zero

When you select this check box, nothing is printed in a column of number field data if it the value is zero.

Decimals

When you are setting up a custom format for a number field object, use this list to set the Decimals property for that object. This option allows you to specify the number of decimal places you want to print. You can specify from 0 to 10 decimal places. When you choose the number of decimal places you want, the program changes the sample number at the bottom of the dialog box to show you the results of your selection.

Rounding

When you are setting up a custom format for a number field object, use this list to set the Rounding property for that object. This property allows you to specify the number of places you want to round to. When you choose the number of places you want, the program changes the sample number at the bottom of the dialog box to show you the results of your selection.

Negatives

When you are setting up a custom format for a number field object, this property enables you to specify the way you want negative values to appear. Your options are:

-1.23 | Prints negative values with a leading minus sign (-100.00, -225.73, -1,000,000).
1.23- | Prints negative values with a trailing minus sign (100.00-, 225.73-, 1,000,000.00-).
(1.23) | Prints negative values in parentheses [ (100.00), (225.73), (1,000,000) ].

Set the Negatives property to fit your needs. The program changes the sample number at the bottom of the dialog box to reflect the property you choose.

Reverse Sign for Displaying

You can reverse the sign for debit and credit amounts in financial reports by selecting this check box.

Allow Field Clipping

The Allow Field Clipping check box determines whether overflow field representation is enabled for the selected field(s).

  • Select this check box to disable overflow field representation. This means that if the value in the field is too large for the field, the value will be truncated. For example, if you have a field that is sized to allow 5 characters, and the value in the field is 3708.19, the field will print the value: 3708.1 (assuming that the field values are right-justified).
  • Clear this check box to disallow field clipping and enable overflow field representation. With overflow field representation enabled, values that are too large for their fields will be represented by a string of # signs. For example, if you have a field that is sized to allow 5 characters, and the value in the field is 3708.19, the field will print: #####. This lets you know that the field needs to be resized (or that you need to select the Can Grow property).
Decimal separator

When you are setting up a custom format for a number field object, the Decimal box allows you to type in the character(s) you want to use as a decimal separator. The default is a decimal point (.). If you want to change the separator, replace the character in the edit box with the separator of your choice. The program modifies the sample number at the bottom of the dialog box as you type in your characters.

Note: The box does not expand as you type in your separation characters; you are limited to the number of characters the box will hold.

Thousands Separator

The Thousands separator property allows you to choose the way you want numbers over 999 to appear on your reports.

  • When you select the property (check mark), the program inserts a comma (,) or another separator of your choice as a thousands separator character for amounts over 999. Your numbers are printed like this: 1,000.00, 10,000.00, 999,000.00.
  • When you clear the property you deactivate the thousands separator character. Your numbers are printed like this: 1000.00, 10000.00, 999000.00.
Symbol

This box displays the current thousands separator. The default is a comma (,). If you would like to use a different thousands separator, type it in this box. The changes you make in this box do not apply unless you select the Thousands Separator check box.

Leading Zero

Leading Zero allows you to include a zero, if you wish, before the decimal point in decimal amounts less than one.

  • Select this property if you want the program to include a zero before the decimal point whenever you have a decimal amount less than one (0.001, 0.9999, 0.755).
  • Clear this property if you do not want the leading zero (.001, .999, .755).
Show Zero Values as

This list contains the options available for displaying values of zero (0) in the selected field.

Related topics

Format Editor

Formatting


Date tab

Use the Date tab (click Customize on the Date / Time tab of the Format Editor) to set detailed formatting options for date fields in your report.

Date Type

The Regional Settings dialog box in the Windows Control Panel allows you to specify default date formats for use with any Windows program. You can specify the month/day/year separator and the order in which the date elements appear. These dialog boxes also allow you to specify a short date style (like 12/24/96 or 16 Mar, 1996) and a long date style (like Sunday, April 21, 1996).

This list lets you:

  • choose one of the two default styles
  • choose Custom to create your own style in the Format Editor.

Select the option that fits your needs. The program modifies the sample date at the bottom of the dialog box to demonstrate the style you have chosen.

Calendar Type

If you are using Windows NT/95/98 your operating system may support more than one calendar type. For instance, your operating system may support a native calendar (Japanese), a Gregorian calendar (in the local language) and a Gregorian English calendar. If your operating system supports multiple calendar types you may use the Calendar Type list to select a calendar type for the date field.

Month

If you want to create a custom format for a date field object, use this list to specify the way you want the program to print/display the month part of the date. Your options are:

3 | Prints a month as a number. If the month number is only a single digit, it prints the number without a leading zero.
03 | Prints the month as a number. If the month number is only a single digit, it prints the number with a leading zero.
Mar | Prints a three letter abbreviation for the month.
March | spells out the full name of the month.

Choose the option that fits your needs. The program modifies the sample date at the bottom of the dialog box to reflect your choice.

Day

If you want to create a custom format for a date field object, use this list to specify the way you want the program to print/display the day part of the date. Your options are:

1 | Prints the day as a number. If the day number is only a single digit, it prints the number without a leading zero.
01 | Prints the day as a number. If the day number is only a single digit, it prints the number with a leading zero.

Choose the option that fits your needs. The program modifies the sample date at the bottom of the dialog box to reflect your choice.

Year

If you want to create a custom format for a date field object, use this list to specify the way you want the program to print/display the year part of the date.

99 | Prints the year in its short, two digit format.
1999 | Prints the year in its long, four digit format.

Choose the option that fits your needs. The program modifies the sample date at the bottom of the dialog box to reflect your choice.

Era/Period Type

Use the Era/Period Type list to select either a short or long era/period of time.

YMD, DMY, MDY options

If you want to create a custom format for a date field object, use these options to select the order in which you want the elements of the date to appear. Your options are:

MDY | Prints the date in the order Month, Day, Year.
DMY | Prints the date in the order Day, Month, Year.
YMD | Prints the date in the order Year, Month, Day.

Select the option that fits your needs. The program modifies the sample date at the bottom of the dialog box to demonstrate the sequence you have chosen.

Type

When you are setting up a custom format for a date field object, if you want the name of the day (or an abbreviation of that name) to appear before the rest of the date, use this option to set the format for that name. Your options are:

Short | Prints an abbreviation of the day name before the date (for example, Fri).
Long | Prints the full day name before the date (for example, Friday).
None | Does not print a day name before the date.

Choose the option that fits your needs. The program modifies the sample date at the bottom of the dialog box to reflect your choice.

If you set this property to Short or Long, you need to specify the character(s) you want to use to separate the name from the date itself. You do that in the Separator box.

Separator

When you are setting up a custom format for a date field object, if you set the Leading Day Type property to short or long (so a day name or abbreviated day name appears before the date), you need to specify the character(s) you want to use to separate the name from the date itself. You do that in this box. Within practical limits, you can use as many characters as you need. For example,

  • to separate a date name from a date, you may use Comma+Space (, ) as your separators
  • to separate a date name abbreviation from a date, you may use Period+Comma+Space (., ) as your separators.

Type in the characters you want to use. The program modifies the sample date at the bottom of the dialog box as you do.

Enclosures

Use the Enclosures list to select parentheses or square brackets as an enclosure for date/time fields on your report.

Position

Use the Position list to select either a Leading or a Trailing position.

Prefix

Use the Prefix box to create a prefix for dates in your date field, for example, DATE.

First Separator

When you are setting up a custom format for a date field object, the program enables you to specify the separators, if any, that you want to use to separate the date elements. Since each date has three elements (YMD, DMY, or MDY), you can specify two different separators. The first separator goes between the first and second elements, the second separator goes between the second and third elements. Type the character(s) you want to use for the first separator in this box. Within practical limits, you can use as many characters as you need. For example,

  • if you are using a short format, all numbers, you may want to specify a forward slash (/) as the first separator and as the second separator as well (like 12/25/96)
  • if you are using a long format with the month spelled out, you may not want to use any separator between the first and second elements and then use a comma between the second and third (like March 22, 1998).
Second

When you are setting up a custom format for a date field object, the program enables you to specify the separators, if any, that you want to use to separate the date elements. Since each date has three elements (YMD, DMY, or MDY), you can specify two different separators. The first separator goes between the first and second elements, the second separator goes between the second and third elements. Type the character(s) you want to use for the second separator in this box. Within practical limits, you can use as many characters as you need. For example,

  • if you are using a short format, all numbers, you may want to specify a forward slash (/) as both the first and second separators (for example, 12/25/96)
  • if you are using a long format with the month spelled out, you may not want to use any separator between the first and second elements and then use a comma between the second and third (like March 22, 1998).
Suffix

Use the Suffix box to create a suffix that follows the dates in your date field.


Time tab

Use the Time tab (click Customize on the Date / Time tab of the Format Editor) to set detailed formatting options for time fields in your report.

12 Hour

Select this check box if you want the time to be displayed in a 12 hour format.

24 Hour

Select this check box if you want the time to be displayed in a 24 hour (military time) format.

00:00-11:59

Use this box to specify the characters you want to use to identify the time between midnight and noon if you want to use something other than the default, AM.

12:00-23:59

Use this box to specify the character(s) you want to use to identify the time between noon and midnight if you want to use something other than the default, PM.

Symbol position

Use the Symbol position list to select the placement for the AM or PM symbols in your time field. For example, you can choose to have the AM symbols appear before or after the time.

Note: Symbol position is only available for the 12-hour time format.

Hour

This list shows all the possible formats for the hour display. Choose the format you want. When you do, the program formats the sample time at the bottom of the dialog box to reflect your choice.

Minute

This list shows all the possible formats for the minute display. Choose the format you want. When you do, the program formats the sample time at the bottom of the dialog box to reflect your choice.

Second

This list shows all the possible formats for the seconds display. Choose the format you want. When you do, the program formats the sample time at the bottom of the dialog box to reflect your choice.

Hr/Min Separator

Use this box to enter the character(s) you want to use to separate hours and minutes in your time field.

Min/Sec

Use this box to enter the character(s) you want to use to separate minutes and seconds in your time field.


Customize Map dialog box

The Customize Map dialog box appears when you choose Change Map Type from the Analyzer menu. You can also choose the option from the right-click shortcut menu on the Analyzer Tab. In either case, Change Map Type appears only when viewing a map on the Analyzer tab.

This dialog box allows you to change your map type and to set the options for the map type you select. The Customize Map dialog box contains much the same functionality as the Map Expert's Type Tab.

The Customize Map dialog box provides five basic map types (all types may not be available for every map), each suitable for a different strategy of data analysis. When deciding which map type best fits your report, you should consider the type of data you want to analyze. For example, if you want the map to display one data item for each geographic division (city, state, country, and so on), then you might use a Ranged, Dot Density, or Graduated map. On the other hand, if you want the map to display more than one value for each new geographic division, then you could use a Pie Chart map or a Bar Chart map.

Map Type

Use this list to select a map type and to activate the related mapping options.

The map types are:

  • Ranged
  • Dot Density
  • Graduated
  • Pie Chart
  • Bar Chart.
Options

Use the Options area to select the appearance of the map values displayed on the map. The options available in the Customize Map dialog box vary depending on the map layout you selected.

For more information about the options available for each map type, see:

  • Ranged Option view
  • Dot Density Option view
  • Graduated Option view
  • Pie Chart Option view
  • Bar Chart Option view.
Related topics

Map Expert


Ranged Option view

A Ranged map breaks data into ranges, assigns a specific color to each range, and then codes geographic areas on the map by color in order to display the range. You can use a ranged map to display sales figures in a range of equal intervals. You can then use shades of color to code sales regions according to those figures. This type of map is useful for determining the regions of highest sales simply by looking at the colors it displays.

Number of intervals

Use this box to enter the number of intervals you want to use as a range. Your map and its legend change accordingly. You can enter a number between 1 and 16. The default is 5.

Distribution method

Use this list to assign range intervals in such a way that the values fit one of the available criteria:

  • Equal count
    Assigns intervals so that the same number of regions (or as close to the same number of regions as possible) appear in each interval.
  • Equal ranges
    Assigns intervals so that the summary values in each interval are numerically equal.
  • Natural break
    Assigns intervals using an algorithm that attempts to minimize the difference between the summary values and the average of the summary values for each interval.
  • Standard deviation
    Assigns intervals so that the middle interval breaks at the mean (or average) of the data values, and the intervals above and below the middle range are one standard deviation above or below the mean. Standard deviation is the square root of the variance. This option projects how various values in a set of values deviate from the mean for that set.
Color of highest interval

Use this list to select the color you'd like to use for the highest (largest) interval in your range. This color becomes the top end of your color range.

Color of lowest interval

Use this list to select the color you'd like to use for the lowest (smallest) interval in your range. This color becomes the bottom end of your color range.

Allow empty intervals

Select this check box if you want to see empty intervals on your ranged map. This option is selected by default.


Dot Density Option view

A Dot Density map displays a dot for each occurrence of a specified item. For example, you might create a United States map that shows one dot for each national park. The purpose of a Dot Density map, then, is to provide an overall impression of the distribution of the specified item. Such a map is not a very accurate means of showing detailed information, but is a good way to give an impression of distribution.

Size of dots

Click Small or Large to define the size of the dots you want on your Dot Density map.


Graduated Option view

A Graduated map is much like a Ranged map in that it shows one symbol per instance of a specified item. Use a Graduated map for displaying data that is linked to points rather than precise geographical areas (as is the case with Ranged map types). For example, a map of an individual region could use graduated circles to represent the sales for each office. The size of each circle would be proportional to the sales (or to the sales range) of the office it represents. A Graduated map provides a more efficient representation of point data than a Ranged map does, and it uses sized symbols rather than colors to distinguish variations in the values of the items it represents.

You can choose the symbol you want to use on your Graduated map. Each symbol is proportional in size to the value of the item it represents (within a range of three sizes).

Symbol style

Click Customize to open the Symbol Style dialog box. You can use this dialog box to choose and format a symbol.


Pie Chart Option view

A Pie Chart map displays a pie chart over each geographic area. Each slice of the pie represents an individual data item and shows that item's percentage in the whole. You can use this map type to compare the distribution of several items within a particular region. You can also specify that the pie charts be sized proportionately, so that, as with the symbols in a Graduated map, the pie charts will appear in various sizes, depending on the underlying data values. This allows you to compare the totals between regions.

Size of pies

Use the slider to choose Large, Medium, or Small as the size of the pies to display on your map.

Proportional sizing

Select this check box to specify that the pie charts on your map will be sized proportionately depending on the underlying data values.


Bar Chart Option view

A Bar Chart map works like a Pie Chart map, but may be more useful for certain sets of data. Typically, you would use a Bar Chart map for items that do not total 100% (that is, for data items that do not make a whole, or for data items that are unrelated).

Size of bars

Use the slider to choose Large, Medium, or Small as the size of the bars to display on your map.


Data Explorer

Overview

The Data Explorer provides an integrated tree view of all data sources you can use with Seagate Crystal Reports. With the Data Explorer, you can:

  • create a report using one of the currently connected data sources
  • create a report based on a customized "Favorites" list of data sources (which you also maintain within the Data Explorer)
  • create a report based on a list of recently accessed data sources (that the Data Explorer automatically maintains for you)
  • create a report by connecting to an existing data source (for example, a data file residing locally, or an ODBC data source that has already been set up)
  • create a report by first creating a new connection (for example, a new ODBC data source, or an OLE DB File Data Link).


Tree view

The main window of the Data Explorer shows a tree view of possible data sources you can select when creating a report. The tree is made up of folders for:

  • Current Connections
    shows a list of data sources you are currently connected to.
  • Favorites
    shows a list of data sources you commonly use and have maintained in your Favorites list.
  • History
    shows a list of data sources you have used recently. The last five data sources used are displayed.
  • ODBC
    shows a list of ODBC data sources you have already configured for use. You can use Create New Data Source to configure a new ODBC data source.
  • File Data Sources
    shows a list of standard PC databases that reside locally. You can use Find Database File to browse for a PC database using the Open dialog box.
  • More Data Sources
    shows a list of other data sources that can be accessed through OLE DB and native drivers.


Buttons and shortcut menu

Buttons and shortcut menus are available in the Data Explorer. You can right-click any item in the Data Explorer to see a shortcut menu with the following options:

  • Add to Report
    Use this option to add a table or stored procedure to your new report. This option is also available by clicking the Add button on the Data Explorer.
  • Add to Favorites
    Use this option to add a selected data source to the Favorites folder. This option is also available by clicking the Add Favorite button on the Data Explorer.
  • Remove from Report
    Use this option to remove a table or stored procedure from your report. This option is also available by clicking the Remove button on the Data Explorer.
  • Properties
    Use this option to obtain detailed information on the selected item. This option is available only from the Shortcut menu.
  • Rename Favorite
    Use this option to rename a data source in the Favorites folder. This option is available only from the Shortcut menu.
  • Delete Favorite
    Use this option to remove a data source from the Favorites folder.

The following buttons complement the selection available on the Shortcut menu:

  • Add
    Adds the selected table or stored procedure to the report. A check mark is added in front of the name of tables or stored procedures added to the report.
  • Remove
    Removes the selected table or stored procedure from the report. The check mark in front of the name of the table or stored procedure is removed.
  • Add to Favorites
    Adds the selected data source to your Favorites folder.
  • Delete Favorite
    Removes the selected data source from your Favorites folder.
  • Options
    Provides access to the options you can set globally on the Database tab of the Options dialog box.
  • Help
    Displays an on-line help topic for the Data Explorer.
  • Close
    Closes the Data Explorer and continues on to the Design tab with the Field Explorer visible.

Finding, connecting to, and creating new data sources

Several options are available within the folders of the Data Explorer to help you find, connect to, or create new data sources.

ODBC folder

You can choose the options Create New Data Source, or Connect Using File Data Source from within the ODBC folder.

The Create New Data Source option guides you through the creation of a new ODBC data source by providing a creation Expert. After you have created a data source, it is added to the ODBC folder.

The Connect Using File Data Source lets you select an ODBC file data source located outside the default directory. Use the ODBC File DSN dialog box to locate the file DSN you want to connect to.

Existing data sources shown under the ODBC folder display a power cord icon when a connection has been made.

File Data Sources folder

You can use the Find Database File option to browse for a file data source to connect to. After double-clicking this option, the Open dialog appears. Use the familiar Windows layout of the Open dialog box to find and open the file data source of your choice.

More Data Sources folder

OLE DB Data Sources

You will find two options under the OLE DB subfolder:

  • Make New Connection
    This option lets you create a Data Link (an OLE DB data source using a non-file-based Data Link) using the Data Link Properties dialog box.
  • Connect Using Data Link File
    This option lets you connect to an existing Data Link File, or create a new Data Link File using the Select Data Link File dialog box.
Other Data Sources

For other type of data sources within the More Data Sources folder, you can make a connection by double-clicking it in the tree view. Subsequent connections allow you to select Make New Connection in the same subfolder.

Existing data sources shown under the ODBC folder display a power cord icon when a connection has been made.


Define Description dialog box

This dialog box enables you to define a description for a default parameter value. It appears when you click the Define Description button in the Set Default Values dialog box.

Enter the description in the box and click OK.


Define Named Group dialog box

This dialog box appears when you click either the New button, or the Edit button on the Specified Order tab of the Insert Group dialog box.

When you use specified order grouping, you have to use the Define Named Group dialog box to create the groups and to specify the values in each when you group in a specific order.

Named Group

Type the name you want to use for the group into this box. By default the name will appear in the group header section.

For example, if you have a group that contains customers from Arizona, Washington, and California, you can call that group "Western Region" by typing that name in this box.

There is a tab for the named group in which you can specify the selection criterion. Select a type of selection criterion from the list. To add another selection criterion, click the New tab.

Browse Data

Click this button to browse the field data. You can select data from the dialog box that opens and click the Paste button to paste data to the Selection list. Click the Done button to return to the Define Named Group dialog box.

Tabs

The tabs display the fields whose values you are using to create the group. The tabs are all related to the same group, and each tab relates to a specific portion of the query used to create the group. When you click a tab, the appropriate portion of the query appears in the dialog box. If you want to expand the query, click the New tab.

  • To edit a named group, click the tab for that group.
  • To create a new group, click the New tab.
Related topics

Specified Order tab

Insert Group dialog box

Grouping data

Sorting data

Creating custom groups


Delete Group dialog box

This dialog box appears when you choose the Delete Group command command from the Edit menu.

Use the Delete Group dialog box to delete existing groups from your report. Select a group from the list and then click OK to delete it. Click Cancel to close the dialog box without deleting a group.

Related topics

Sorting, Grouping, and Totaling


Display Properties dialog box

The Display Properties dialog box appears when you click the Display button on the Layer Control dialog box. The Display Properties dialog box allows you to further manipulate the mode and Zoom layering of a selected layer.

Display within Zoom Range

By clearing this check box, the selected layer is shown at all zoom levels of the map. By selecting this check box, the selected layer will only be shown within the range set in the Min Zoom and Max Zoom boxes.

Min Zoom

Use this box to set a minimum zoom level for the selected layer.

Max Zoom

Use this box to set a maximum zoom level for the selected layer.

Related topics

Layer Control dialog box


Document Properties dialog box

This dialog box appears when you choose the Summary Info command from the File menu.

Use the Document Properties dialog box to:

  • add summary data to your report (to help you and other users identify the report)
  • view the statistical information the program generates for each report.
Related topics

Summary Info command

Using the Summary Info command


Summary tab

Use the Summary tab to add summary information to your report file. You and other users can later use this information to help identify the content of the report.

Author

Type the name(s) of the report author(s) in this box.

Keywords

Type keywords that will help identify the content of the report in this box.

Comments

Type comments that you want saved with the report in this box. These comments might help describe the content of the report, the reason for the report's creation, and so on.

Note: If you include these comments on a report using the Special Field called Report Comments, only the first 256 characters will be displayed.

Title

Type the report title in this box. A title entered here can be added to the report by using the Special Field called Report Title.

Subject

Type the overall subject of your report in this box.

Template

If you created the report by using another report as a template, type the name of that template here.

Save preview picture

Select this check box if you'd like to create a picture of the first page of the report so you can see it when selecting a report in the Open dialog box. This check box is not selected by default.

Related topics

Summary Info command

Using the Summary Info command

Document Properties dialog box

Statistics tab


Statistics tab

Use the Statistics tab to view the document management information that the program generates for the report.

Last Saved By

This tab displays the name found in the Author box on the Summary tab the last time you saved the report. If there was no name present when you last saved the report, this line is blank.

Revision number

This line displays the number of times the report has been revised. Each new report begins with the revision number set to zero (0). That value increases by one each time you save the report, even if you made no changes before saving.

Total Editing Time

This line displays the total number of minutes since you opened the report for editing, regardless of whether or not you have actually edited the report during that time.

Note: This value does not refresh while the dialog box is open. Each time you open the Document Properties dialog box, the program updates the value.

Last Printed

This line displays the date and time your report was sent to a printer.

Note: The value does not update when you export or preview the report.

Created

This line displays the date and time that your report was initially created.

Last Saved

This line displays the date and time that your report was last saved.

Related topics

Summary Info command

Using the Summary Info command

Document Properties dialog box

Summary tab


Edit Parameter Field dialog box

This dialog box appears when you select a parameter from the Parameter Fields list in the Field Explorer and then click the Edit button. It also appears when you select a parameter in a report and choose Parameter from the Edit menu, or when you right-click a parameter and choose Edit Parameter from the shortcut menu.

Use the Edit Parameter Field dialog box to change the prompting text, value type, default value(s), and/or option for the selected parameter field.

Name

When editing a parameter field, this box displays the parameter's name, but is not available for you to change the name.

Prompting text

The current prompting text for the selected parameter field is shown in this box. This is the message that appears when the program prompts you for a value. Edit the prompting text to fit your needs.

Allow multiple values

By selecting the Allow multiple values check box, you can select more than one default value for your parameter field after you click the Refresh button on the Standard toolbar. This option is not selected by default.

Discrete value(s)

By selecting the Discrete value(s) option, you can select only singular values for your parameter field. If you have Allow multiple values selected, you will be able to select more than one discrete value for your parameter field, though those discrete values will continue to function singularly as opposed to a range value. You can choose discrete values for your parameter field after you click the Refresh button on the Standard toolbar. This option is selected by default.

Range value(s)

By selecting the Range value(s) option, you can select a range of values for your parameter field. For example, if you've selected a currency field, your parameter field (with range value selected) could equal any number that falls between a lower and upper limit you set.

Discrete and Range Values

By selecting the Discrete and Range Values option, you can enter both discrete values and values in ranges.

Allow editing of default values when there is more than one value

With the Allow editing of default values when there is more than one value check box selected, you can edit values in the parameter field after the parameter field has been added to the report. To edit default values, click the Refresh button and select Prompt for new parameter values. This check box is selected by default.

Set Default Values

Click this button to open the Set Default Values dialog box. Use the Set Default Values dialog box to create a list of default values for the parameter field you are creating.

Related topics

Field Explorer


Edit Running Total Field dialog box

The Edit Running Total Field dialog box appears when you select a running total field from the list in the Field Explorer and then click the Edit button. It also appears when you select a running total field in a report and choose Running Total Field from the Edit menu, or when you right-click a running total field and choose Edit Running Total from the shortcut menu.

For details about the options available in this dialog box, see the Create Running Total Field dialog box.


Enter Parameter Values dialog box

This dialog box appears when you run a report that includes a parameter field, or when you refresh the data for that report.

Use the Enter Parameter Values dialog box to supply a parameter value if you want the program to run the report using a value other than the default value. This dialog box includes a list that included each parameter field in the report.

Parameter Fields

When the Enter Parameter Values dialog box appears, it displays a list of all the parameter fields in your report. You can select any parameter field in the list to set new value for it.

If prompting text was specified when the parameter field was created, that text appears below the Parameter Fields list on the Enter Parameter Values dialog box. The text changes as you select new parameter fields from the list.

Value options

The bottom part of the Enter Parameter Values dialog box contains a field or fields for you to enter the value(s) you want to use when running your report.

The fields that appear in this area vary depending on a number of things such as:

  • the data type of the field the parameter is based on (String, Currency, Boolean, Date/Time, and so on)
  • whether the parameter is range limited (in other words, if it allows you to enter a start and end value)
  • whether the parameter allows the use of multiple values.

For example, if you created a parameter based on a date field and allowed a range to be specified, the value options on the Enter Parameter Values dialog box would include:

  • Start of range
    select a value from a calendar to represent the first date in the range (including the date specified if you want)
  • End of range
    select a value from a calendar to represent the last date in the range (including the date specified if you want)
  • No lower Bound
    select this check box to specify a date range with no start date
  • No upper Bound
    select this check box to specify a date range with no end date.
Related topics

Refresh Report Data command

Refreshing report data

Creating a parameter field


Enter Search Name dialog box

The Enter Search Name dialog box opens when you choose Find Field from the Fields tab of any Report Expert except the OLAP Report Expert.

Use this dialog box to specify the name of the field you want to find.


Export dialog box

This dialog box appears when you choose the Export command from the Print menu (under the File menu).

Use the Export dialog box to export your report to an electronic file in a format that can be read by another software application. For example, you could export your report in Microsoft Excel format and then open it in Excel as a normal spreadsheet file.

The Export facility supports several popular word processing, database, and spreadsheet formats, as well as a number of standard data interchange formats.

Format

This is a list of all the possible export formats for your report. Select a format from this list.

Destination

Lists all the possible destinations for your report. Select the destination you want from this list.

You can export to:

  • an application
  • a file
  • an Exchange folder
  • Lotus Notes database
  • Microsoft Mail.
Related topics

Exporting a report

Export command


Field Explorer

Overview

The Field Explorer is used to insert, modify or delete fields on the Design and Preview tabs of Seagate Crystal Reports. You'll see the Field Explorer after you have:

  • selected a data source for a new report
  • clicked the Insert Fields button on the Standard toolbar
  • selected Database Field, Formula Field, Parameter Field, Special Field, Running total field, or SQL Expression Field from the Insert menu.

The Field Explorer displays a tree view of database fields and special fields that you can add to your report. It also shows formula fields, SQL expression fields, parameter fields, group name fields, and running total fields that you have defined for use in your report.

Fields that have already been added to the report, or fields that have been used by other fields (such as formula fields, groups, running total fields, summaries, and so on) have a check mark in front of them.

Toolbar and shortcut menu

The toolbar provides buttons with tool tips and hot-key combinations. You can right-click any item in the tree view to bring up a shortcut menu.

The toolbar and the shortcut menu offer these functions:

  • Insert to Report
    Use this option to add a field to the report. You can insert more than one field at a time by selecting multiple fields, right-clicking, and choosing Insert to Report.

    Alternatively, to insert a field, you can drag and drop it in the Design or Preview tabs.

  • Browse Data
    Use this option to browse data for a database field or formula field.

    When you right-click a database field, the shortcut menu has Insert to Report and Browse Data enabled.

  • New
    Use this option to create a formula field, SQL expression field, parameter field or running total field.
  • Edit
    Use this option to modify an existing formula field, SQL expression field, parameter field or running total field.
  • Rename
    Use this option to modify the name of an existing formula field, SQL expression field, parameter field or running total field.
  • Delete
    Use this option to remove a formula field, SQL expression field, parameter field or running total field. You can also select multiple fields, right-click, and choose Delete to remove them all at once.
  • Move Parameter Up (or Down)
    Use this option to change the order of parameter fields.

    When you right-click a parameter field, all the functions except Browse Data are enabled.

Related topics

Database Field command

Formula Field command

Parameter Field command

Creating a parameter field


Tree view

Database Fields

Use the Database Fields branch of the tree to add database fields to your report. Fields are listed by table.

If there are many active tables, or if the number of fields in a table is very large, only the table name for each of the tables appears. When you click the + sign in front of the table, or double-click the table name itself, the program displays the fields in that table. Double-click the table name again and the program displays only the table name.

You insert database fields by dragging them into the report, or by selecting them and then clicking Insert to Report. You can select multiple fields using the Shift-click or Ctrl-click combinations.

Each field added to the report has a check mark added in front of its name in the Field Explorer.

Insert to Report

Click this button to insert the selected field(s) in your report. When you do, the program displays a placement frame. Move that frame where you want it on the report and click to place it.

Browse

Click this button to browse the data in the selected field.

Related topics

Database Field command

Using the Database Field command

Field Explorer


Formula Fields

Use the Formula Field branch of the tree as a gateway for editing, renaming, or deleting formulas, creating new formulas, or inserting formula fields into your report.

The formula list displays the names of all the formula fields currently in your report. You insert formula fields by dragging them into the report, or by selecting them and then clicking Insert to Report.

Each formula field added to the report has a check mark added in front of its name in the Field Explorer.

Insert to Report

Use this button to insert the formula field selected in the Formula Fields list into your report.

New

This button opens the Formula Name dialog box where you can specify a name for your formula. This option is available from the root of the Formula Fields branch so you can create a new formula for your report even when there are no existing formulas.

To add a new formula, add a name in the Formula Name dialog box, click OK, and create a formula in the Formula Editor.

Edit

This button opens the Formula Editor and displays the currently selected formula for you to edit.

Rename

This button lets you rename the formula you select in the Formula Fields list. Formula Fields can be renamed in the standard Windows fashion.

Delete

This button deletes the formula field selected in the Formula Field list. If the formula is already on the report, you are asked to confirm the deletion as it will also be deleted from the report.

Related topics

Formula command

Field Explorer

Working with the Formula Editor


SQL Expression Fields

Use the SQL Expression Fields branch of the tree as a gateway for editing, renaming, or deleting SQL Expression fields, creating new SQL Expression fields, or inserting SQL Expression fields into your report.

The SQL Expression Fields list displays the names of all the expression fields currently in your report. You insert SQL Expression fields by dragging them into the report, or by selecting them and then clicking Insert to Report.

Each SQL Expression field added to the report has a check mark added in front of its name in the Field Explorer.

Insert to Report

Use this button to insert the SQL Expression field selected in the SQL Expression Fields list into your report.

New

This button opens the SQL Expression Name dialog box where you can specify a name for your expression. This option is available from the root of the SQL Expression Fields branch so you can create a new SQL Expression for your report even when there are no existing expressions.

To add a new SQL Expression, add a name in the SQL Expression Name dialog box, click OK, and create a expression in the SQL Expression Editor.

Edit

This button opens the SQL Expression Editor and displays the currently selected expression for you to edit.

Rename

This button lets you rename the expression you select in the SQL Expression Fields list. SQL Expression Fields can be renamed in the standard Windows fashion.

Delete

This button deletes the expression field selected in the SQL Expression Fields list. If the expression is already on the report, you are asked to confirm the deletion as it will also be deleted from the report.


Parameter Fields

Use the Parameter Fields branch of the tree as a gateway for editing, renaming, deleting, creating new, or inserting parameter fields into your report.

The Parameter Fields list displays the names of all the parameter fields currently in your report. You insert Parameter fields by dragging them into the report, or by selecting them and then clicking Insert to Report.

Each Parameter field added to the report has a check mark added in front of its name in the Field Explorer.

Insert to Report

Use this button to insert the Parameter field selected in the Parameter Fields list into your report.

New

This button opens the Create Parameter Field dialog box where you can specify the details for your parameter. This option is available from the root of the Parameter Fields branch so you can create a new parameter for your report even when there are no existing parameters.

To add a new Parameter Field, add a name, prompting text, and value type in the Create Parameter Field dialog box. After choosing options and setting default values, click OK.

Edit

This button opens the Edit Parameter Field dialog box and displays the currently selected parameter for you to edit.

Rename

This button lets you rename the parameter you select in the Parameter Fields list. Parameter Fields can be renamed in the standard Windows fashion.

Delete

This button deletes the parameter field selected in the Parameter Fields list. If the parameter is already on the report, you are asked to confirm the deletion as it will also be deleted from the report.

Move Up and Move Down buttons

Use the Move Up and Move Down buttons to change the order of parameter fields in the Parameter Fields list. These buttons become available as needed.

Related topics

Parameter command

Creating a parameter field


Group Name Fields

You can insert an existing Group Name field shown in the Field Explorer by selecting Insert to Report. Unlike a formula field, parameter field, or running total field, however, you cannot create a Group Name field through the Field Explorer. (A Group Name field is created when you insert a group.)

The Group Name Fields list displays the Group Name fields currently in your report.

Insert to Report

Click this button to insert the Group Name field selected in the Group Name Fields list.

Related topics

Group Name Field command

Field Explorer


Running Total Fields

Use the Running Total Fields branch of the tree as a gateway for editing, renaming, deleting, creating new, or inserting Running Total fields into your report.

The Running Total Fields list displays the names of all the Running Total fields currently in your report. You insert Running Total fields by dragging them into the report, or by selecting them and then clicking Insert to Report.

Each Running Total field added to the report has a check mark added in front of its name in the Field Explorer.

Insert to Report

Use this button to insert the Running Total field selected in the Running Total Fields list into your report.

New

This button opens the Create Running Total Field dialog box where you can specify the details for your Running Total. This option is available from the root of the Running Total Fields branch so you can create a new Running Total for your report even when there are none existing.

To add a new Running Total Field, add a name, field to summarize, and Evaluate/Reset criteria in the Create Running Total Field dialog box and click OK.

Edit

This button opens the Edit Running Total Field dialog box and displays the currently selected Running Total for you to edit.

Rename

This button lets you rename the Running Total you select in the Running Total Fields list. Running Total Fields can be renamed in the standard Windows fashion.

Delete

This button deletes the Running Total field selected in the Running Total Fields list. If the Running Total is already on the report, you are asked to confirm the deletion as it will also be deleted from the report.

Related topics

Creating running totals


Special Fields

Page Number

Use the Page Number Field to insert a field that prints the current page number. These fields are most often placed in the Page Header or Page Footer sections.

Related topics

Using the Page Number Field command

Total Page Count

Use the Total Page Count Field to print the total number of pages in the report. You can use this field in a variety of instances. For example, you can use it in combination with the Page Number Field to create a text object that reads "Page x of y" where x is the Page Number Field and y is the Total Page Count Field. These fields can be placed in any section of your report, depending on how often you want them to print.

Page N of M

Use the Page N of M Field to insert a field that specifies the page number and the total number of pages in the report. For example, a field value of Page 1 of 8 would indicate the first page in an eight-page report.

Report Title

Use the Report Title Field to include a field that contains the title you specified using the Summary Info command on the File menu. This field can be placed in any section of your report, depending on how often you want it to print.

Report Comments

Use the Report Comments Field to include a field that contains the comments you specified using the Summary Info command on the File menu. This field can be placed in any section of your report, depending on how often you want it to print.

Note: Only the first 256 characters of the comments you entered on the Summary tab of the Document Properties dialog box dialog box are displayed.

File Path and Name

Use the File Path and NameField command to insert a field that displays the file path and file name for the report.

File Author

Use the File Author Field command to include a field that displays the name of the author of the report (as specified in the Document Properties dialog box).

File Creation Date

Use the File Creation Date Field command to include a field that displays the date when you created the report.

Print Date

Use the Print Date Field to include the current date when the report prints. This field can be placed in any section of your report, depending on how often you want it to print. The date can be changed by using the Set Print Date/Time command on the Report menu.

Print Time

Use the Print Time Field to include a field that contains the time when the report prints. This field can be placed in any section of your report, depending on how often you want it to print.

Data Date

Use the Data Date Field to include a field that contains the date the data was last retrieved (refreshed). This field can be placed in any section of your report, depending on how often you want it to print.

Data Time

Use the Data Time Field to include a field that contains the time the data was last retrieved (refreshed). This field can be placed in any section of your report, depending on how often you want it to print.

Modification Date

Use the Modification Date Field to include a field that contains the date the report was last modified. Modified refers to any modification (including something as simple as moving a field). When you modify the report and print it, the program prints the modification date even if you have not saved the report before printing. This field can be placed in any section of your report, depending on how often you want it to print.

Modification Time

Use the Modification Time Field to include a field that contains the time the report was last modified. This field works the same way as the Modification Date. This field can be placed in any section of your report, depending on how often you want it to print.

Record Number

Use the Record Number Field to number each record printed in the Details section of your report.

Group Number

Use the Group Number Field to number each group in your report. You can place this field in either the Group Header or Group Footer section of your report.

Related topics

Using the Group Number Field command

Record Selection Formula

Use the Record Selection Formula Field to insert a record selection formula field into your report. (Use the Select Expert to create a record selection formula for your report.)

Group Selection Formula

Use the Group Selection Formula Field to insert a group selection formula field into your report. (Use the Select Expert to create a group selection formula for your report.)


Find dialog box

The Find dialog box allows you to locate text in a report. This dialog box appears when you choose Find from the Edit menu.

Find what

Type the text you want to search for, paste it from the clipboard or click a recent entry from the list.

Find Next

Click this button to find and select the next occurrence of the text specified in the Find what box.

Match case

Select or clear this check box to control whether the exact sequence of upper and lower case letters in the search text should be considered.

Match whole word only

Select or clear this check box to control whether only whole words are to be found instead of searching for text within words.

Direction

Specifies which direction to search starting from the current cursor position. Click Up to search toward to start of the report or Down to search toward the end of the report.

Advanced Find

Click this button to call the Search Expert.

This button is only available in the Preview tab.


Find dialog box (Formula Editor)

The Find dialog box allows you to locate text in the Formula Editor and replace it if required. This dialog box appears when you click the Find/Replace button on the Formula Editor toolbar.

Find what

Type the text you want to search for, paste it from the clipboard or click a recent entry from the list.

Find Next

Click this button to find and select the next occurrence of the text specified in the Find what box.

Replace with

Type the text you want to replace the find text with.

Mark All

Click this button to mark all occurrences of the find text.

This option is only available when Edit Text is selected.

Replace

Click this button to search for text that matches the find text, then replace it with the text in the Replace with field.

This option is only available when Edit Text is selected.

Replace All

Replaces all occurrences of the find text with the text in the Replace with field.

This option is only available when Edit Text is selected.

Search

Click an option to specify the type of text to search for.

Direction

Specifies which direction to search starting from the current cursor position. Click Up to search toward to start of the report or Down to search toward the end of the report.

Match Case

Select or clear this check box to control whether the exact sequence of upper and lower case letters in the search text should be considered.

Match whole word only

Select or clear this check box to control whether only whole words are to be found instead of searching for text within words.


Font dialog box

The Font dialog box appears when you click any one of the field/section buttons on the Fonts tab in the Options dialog box.

Use the Font dialog box to change the fonts, the font size, and/or the font style for text and data fields on your reports.

Font

Lists all the available fonts. Click a font name to select a different font.

Font style

Lists the available styles for the specified font. Click a font style to select a different style.

Size

Lists the available point sizes for the specified font. Click a size to change the size of the font.

Strikeout

Specifies whether the font should appear with strikeout marks.

Underline

Specifies whether the font should appear with underlines.

Script

Lists the available language scripts for the selected font. Select the one that is appropriate for the language that you are running on your computer.

Sample

Shows a sample of how the text will appear with the specified font settings.

Related topics

Options dialog box

Formatting


Format Cross-Tab dialog box

This dialog box appears when you choose the Cross-Tab command from the Insert menu, or when you select an existing cross-tab and choose the Format Cross-Tab command from the Format or right-click menus.

Use the Format Cross-Tab dialog box to create a cross-tab quickly and easily. Cross-tabs are used in reports to present summarized data in a row/column structure, similar to that of a spreadsheet. These reports are easy to read, and they are particularly useful for making rapid comparisons and identifying trends.

The Format Cross-Tab dialog box makes it easy for you to set up sophisticated cross-tab reports in a hurry. To use this dialog box:

  • Select the field(s) you want to use as column headings and place them in the Columns list.
  • Select the field(s) you want to use as row headings and place them in the Rows list.
  • Select the field that you want summarized and place it in the Summarized Field box. (A summarized field is the field that you want to displayed at the row/column intersections and totaled at the end of each row and at the bottom of each column.)

Note: In order to print a Cross-Tab report, you must enter at least one summarized field in the Format Cross-Tab dialog box. That is the only field required.

Related topics

Cross-Tab command


Cross-Tab tab

The Cross-Tab tab contains the basic functionality you need to create a cross-tab. You can define rows, columns, and summarized fields. As well, you can create groups and formulas directly from this tab.

Columns

This list displays the fields that you have selected as column headings for your cross-tab. If you have multiple column headings, they will appear on your report in the order in which they appear on this list.

To add a column heading to this list, select a field from the Available Fields list and then drag it onto the list, or click the Add Column button.

Rows

This list displays the fields that you have selected as row headings for your cross-tab. If you have multiple row headings, they will appear on your report in the order they appear on this list.

To add a row heading to this list, select a field from the Available Fields list and then drag it onto the list, or click the Add Row button.

Summarized Fields

This list displays the fields that you have selected as summarized field headings for your cross-tab. If you have multiple summarized field headings, they will appear on your report in the order they appear on this list.

To add a summarized field heading to this list, select a field from the Available Fields list, then drag it onto the list, or click the Add Summarized Field button.

Available Fields

This list displays all the tables and fields that you have activated for use in the report.

Select the field you want to use and drag it into the appropriate list, or click the appropriate Add button. Repeat this process to add additional fields.

Add Row

Click this button to add row headings to your cross-tab. Fields selected in the Available Fields list are moved to the Rows list.

Add Column

Click this button to add column headings to your cross-tab. Fields selected in the Available Fields list are moved to the Columns list.

Add Summarized Field

Click this button to add summarized fields to your cross-tab. Fields selected in the Available Fields list are moved to the Summarized Field list.

Remove

Click this button to remove the selected heading or summarized field from your cross-tab.

Group Options

When you click this button, the Cross-Tab Group Options dialog box appears. Use this dialog box to enter a group for your cross-tab. Group Options is available only for rows and columns.

Change Summary

When you click this button, the Change Summary Operation dialog box appears. Use this dialog box to change the summary type of the cross-tab's summarized fields. Change Summary is available only for summarized fields.

New Formula

When you click this button, the Formula Name dialog box appears. Enter a name for your new formula and then click OK. The Formula Editor appears so you can create the new formula.

Edit Formula

When you click this button, the Formula Editor appears. Use the Editor to edit the selected formula. Edit Formula is available only when a formula field is selected in one of the lists.

Browse

Use Browse to view the values for a field you have selected in the Available Fields or Summarized Field lists.

Related topics

Formula Editor

Insert Group dialog box

Change Summary Operation dialog box


Style tab

The Style tab allows you to choose a pre-defined style for your cross-tab's grid. An example of each style appears on the right side of the screen as you highlight its name.

Note: The color of the style you select may not appear correctly if your screen resolution is set to 256 colors. Increase the resolution to correct this.

If you select any of the pre-defined grid styles, the settings for it appear on the Customize Style tab. You can create a custom style based on any of the pre-defined styles by choosing it and modifying the settings on the Customize Style tab. Once you have created a custom style, a new option, called Custom, is added to the list on the Style tab.


Customize Style tab

Use the Customize Style tab to format your cross-tab's grid with background color, gridlines, and cell margins.

Columns

This list displays the columns you selected for your cross-tab. Select the field for which you want to customize the style.

Rows

This list displays the rows you selected for your cross-tab. Select the field for which you want to customize the style.

Suppress Subtotal

Use this check box to suppress the subtotal for a selected field. You must first have a field selected in either the Rows list or the Columns list.

Suppress Label

Use this check box to suppress the label of a suppressed subtotal field. This check box is inactive if the Suppress Subtotal check box is not selected.

Alias for Formulas

Enter an alias name for the selected row or column field. Creating an alias shortens long field names, which is useful later when you refer to a field in a conditional formatting formulas. The field's original name is shown in this box by default.

Background Color

Use this list to select a color for the selected row or column field.

Show Cell Margins

Select this check box to have the program automatically format the cells of the cross-tab. When this check box is not selected, any extra space (white space) within the cells of the cross-tab will be eliminated and the contents of the cells will be adjusted to utilize the least amount of space in your report as possible.

Indent Row Labels

Select this check box to indent row labels on your cross-tab. Use the inches box to specify the size of the indent you want to see.

Format grid lines

When you click this button, the Format Grid Lines dialog box appears. In this dialog box, you can define whether the grid lines are shown or not, as well as the color, style, and width you'd like the grid lines to have.

Repeat Row Labels

Select this check box to have the program repeat row labels on every page for cross-tabs that print across more than one page.

Keep Columns Together

Select this check box to have the program keep columns together on every page for cross-tabs that print across more than one page.

Row totals on Top

Select this check box if you want row totals to appear at the top of the cross-tab rather than at the bottom (the default position).

Column totals on Left

Select this check box if you want column dimensions to appear on the left of the cross-tab rather than on the right (the default position).

Suppress Empty Rows

Select this check box to have the program remove empty rows from the cross-tab. When this check box is selected, any rows whose fields do not contain any records will be hidden.

Suppress Empty Columns

Select this check box to have the program remove empty columns from the cross-tab. When this check box is selected, any columns whose fields do not contain any records will be hidden.

Suppress Row Grand Totals

Select this check box to have the program remove the grand total from rows in the cross-tab.

Suppress Column Grand Totals

Select this check box to have the program remove the grand total from columns in the cross-tab.


Format Editor

With the Format Editor, you can change the appearance of report fields and other report objects. At its simplest, the Format Editor has one tab. Other tabs are added as you select other field types (Date/Time, Boolean, Hyperlink, and so on).

The Format Editor appears when:

  • you click any of the buttons on the Fields tab of the Options dialog box
  • you right-click a report field and choose Format Field from the shortcut menu
  • you have a text object selected and you choose Format Text, Border and Colors, Font, or Paragraph Formatting from the Format menu
  • when you right-click a text object and choose the Change Border, Change Font, Paragraph Formatting, or Set Tabs command from the shortcut menu
  • when you select a line, or box and choose Format Line, or Format Box from the Format menu.

Note: The formatting options available on the Format menu change depending on the type of report object you have selected.

The Format Editor contains tabs specific to the type of field specified on the fields tab of the Options dialog box, or to the type of field you selected.


Boolean tab (Format Editor)

Use the Boolean tab to select the format for the return values of Boolean fields in your report.

Boolean Text (Boolean tab/Format Editor)

This list includes all the formats in which Boolean fields can be displayed. Select the desired format from this list.


Border tab (Format Editor)

Use the Border tab to format the borders, background fill, and drop shadows for selected fields on your report. Using the options on the border tab, you can create a variety of effects that can enhance both the look of your report and highlight important data.

Left (Border and Color tab/Format Editor)

This list contains the different line styles available. Your choices include single, double, dashed, and dotted line borders. Select the desired style and the program will insert the specified border on the left side of the field. The default value is None.

Right (Border and Color tab/Format Editor)

This list contains the different line styles available. Your choices include single, double, dashed, and dotted line borders. Select the desired style and the program will insert the specified border on the right side of the field. The default value is None.

Top (Border and Color tab/Format Editor)

This list contains the different line styles available. Your choices include single, double, dashed, and dotted line borders. Select the desired style and the program will insert the specified border on the top of the field. The default value is set to None.

Bottom (Border and Color tab/Format Editor)

This list contains the different line styles available. Your choices include single, double, dashed, and dotted line borders. Select the desired style and the program will put the specified border on the bottom of the field. The default value is None.

Tight Horizontal (Border and Color tab/Format Editor)

Select this check box to trim the border to the size of the field.

  • When this check box is not selected, the border will be the same size for each record.
  • When this check box is selected, the border will be trimmed to match the size of each individual record.
Drop Shadow (Border and Color tab/Format Editor)

Select this check box if you want to print a drop shadow below and to the right of the field. When the check box is not selected, the program does not print a drop shadow.

Border (Border and Color tab/Format Editor)

This list contains the colors available for use as borders. Select the desired color from this list.

Background (Border and Color tab/Format Editor)

Select this check box if you want to change the background color. When you select this check box, a list appears to the right, allowing you to select a new background color.

Background (Border and Color tab/Format Editor)

This list contains the colors available for the background color. Select the desired color from this list.

Related topics

Formatting


Common tab (Format Editor)

Use the Common tab to set properties like suppress, horizontal alignment, and keep object together, for a desired field.

Suppress (Common tab/Format Editor)

Select this check box if you want to suppress the selected field. The field values won't appear on the Preview tab, nor will they print.

Horizontal Alignment (Common tab/Format Editor)

This list contains the horizontal alignment types available for the field (for example, left, center, and right).

Keep Object together (Common tab/Format Editor)

Select this check box if you want to keep all the objects from a given section together on the same page. If there is enough room to keep them on the current page, the program will print them on the current page. If there is not enough room, the program will print them on the next page.

Note: If you have objects that are larger than a page, this property will not work.

Close border on page break (Common tab/Format Editor)

If an object has a border and the object is split over two pages, you have two options: put a border around each part of the split object, or display each part of the object with a partial border. Select this check box to display a full border.

Can Grow (Common tab/Format Editor)

This check box is useful for objects that contain variable length strings, such as memo fields.

  • Select this check box if you want the program to expand the object frame vertically when the text within the object is larger than the frame.
  • Clear this check box to truncate the data when the value is larger than the frame.

By default, the Can Grow option is off.

Max number of lines (Common tab/Format Editor)

If you have selected the Can Grow check box, you can use this box to specify the maximum number of lines by which the program can expand an object frame. Simply enter the desired number of lines into this box or enter a 0 (zero) if you do not want to set a limit.

Tool Tip Text (Common tab/Format Editor)

You can add Tool Tip text for the selected field by clicking the Format Formula Editor button and entering text within quotation marks. Tool Tip text appears when you leave your mouse pointer over a field for a few seconds.

Note: Show Tool Tips in Preview must be selected on the Options dialog box in order for Tool Tips to appear on the Preview tab.

Text Rotation (Common tab/Format Editor)

This list contains the rotation options available for the selected field. Use the Text Rotation options to vertically align the fields and text-based objects on your report.

Suppress if duplicated (Common tab/Format Editor)

Select this check box if you don't want the program to print field values that are duplicated when it prints the report.

Related topics

Formatting

Vertical placement


Number tab (Format Editor)

Use the Number tab to set the formatting options for number or currency fields in your report.

Style (Number tab/Format Editor)

From this pre-defined list, choose a number/currency style to apply to the field selected on your report. When you choose System Default Currency Format, the program uses the number and currency formats from the Regional Settings Properties dialog box in the Windows Control Panel.

Note: You can create a custom number/currency format by clicking the Customize button. Your customized style appears in the style list as Custom Style.

Currency Symbol (Number tab/Format Editor)

Select the Display currency symbol check box if you want to display currency symbols in your currency fields.

Fixed (Number tab/Format Editor)

Click this option if you want the program to place the currency symbol in the first (far left) position in the field. The program will leave extra space between the symbol and the currency if the field is justified to the right.

For example:

$ 325.00

$ 401,325.00

Floating (Number tab/Format Editor)

Click this option if you want the program to place the currency symbol as close to the currency amount as possible so that there are never any extra spaces between the symbol and the amount.

For example:

$401,325.00

$325.00

Customize

Use this button to see more detailed formatting options on two tabs, called Currency Symbol and Number.

Related topics

Currency Symbol tab

Number tab


Date / Time tab (Format Editor)

Use the Date / Time tab to set the formatting options for the date and time fields in your report.

Style (Date / Time tab/Format Editor)

From this pre-defined list, choose a date/time style to apply to the field selected on your report. When you choose System Default Long Format or System Default Short Format, the program uses the time and date formats from the Regional Settings Properties dialog box in the Windows Control Panel.

Note: You can create a custom date/time format by clicking the Customize button. Your customized style appears in the style list as Custom Style.

Customize

Use this button to see more detailed formatting options on three tabs, called Data/Time, Date, and Time.

Related topics

Date tab

Time tab


Format Box tab (Format Editor)

The Format Box tab appears in the Format Editor when you right-click a box that you have created and choose Format Box from the shortcut menu that appears. You can also select this option from the Format menu.

Use the Format Box tab to change the fill, border, width and style of your box.

Style (Border)

This list shows all the available line styles for your box; such as: single, double, dashed, and so on.

Width (Border) options

Click the button which represents your desired border line width.

Color (Border)

This list shows all the available colors for your box. Select the desired color from this list.

Drop Shadow

Select this check box if you want to have a drop shadow below and to the right of your box.

Color (Fill)

If you select this check box, the Color list appears showing all the available colors to fill your box.

Close Border on Page Breaks

Select this check box if you want the program to convert box segments into finished boxes when the program splits a box due to a line break. For example, if you have a one inch square box which is split in half, the segment on the first page is missing a bottom, the segment on the second page is missing a top. When this property is selected, the program adds the bottom to the first box and the top to the second, creating a finished half inch box on each page.

Extend to Bottom of Section when Printing

Select this check box if you want the program to allow the box to extend to the bottom of the section.

Suppress

Select this check box if you do not want the box to print.

Related topics

Format Editor

Box command

Adding and editing boxes


Format Line tab (Format Editor)

This tab appears in the Format Editor when you right-click a line and choose the Format Line command from the shortcut menu. You can also select this option from the Format menu.

Use the Format Line tab to set the formatting specification for a line in your report.

Style

This list shows all the available styles for your line, such as: single, double, dashed, and so on.

Width options

Click the button that represents the line width you want to use.

Color

This list shows all the available colors for your line.

Move to bottom of Section when Printing

This option is typically selected when you are printing a line next to a field that may produce variable length output (a memo field, for example) and you format that field using the Can Grow (Common tab/Format Editor) option. In this case, if the program needs to grow the section to accommodate field output, it will grow the line to the bottom of the section as well.

  • Select this check box if you want the line to always extend to the bottom of the section regardless of the length of the section.
  • Clear the check box if you want the line to be the same length in each section, regardless of section size.
Suppress

Select this check box if you do not want the line to print.

Related topics

Format Editor

Line command

Adding and editing boxes


Picture tab (Format Editor)

Use the Picture tab to format bitmap graphics. The Format Graphic command is available on the Format menu. It is also found on the shortcut menu when you right-click a selected graphic object in your report.

Crop From edit boxes

Cropping refers to "cutting" away those portions of your graphic that you do not want to print (although you can use cropping to add white space between the graphic and the frame that surrounds it as well). Using the cropping box, specify the size of the piece you want to cut off the top, bottom, left, and/or right side of your graphic:

  • positive numbers cut into the graphic the amount specified
  • negative numbers add the specified amount of white space between the outer edge of the graphic and the frame.

Note: All cropping activities begin at the outer edge of the graphic.

Scaling edit boxes

Scaling refers to the length and width of a graphic as a percentage of the original length and width. For example, if the original graphic is one inch wide, that width is automatically assigned a width scaling value of 100% by the program. To double the width of the graphic using the Scaling options, you would change Scaling Width to 200% (twice the size of the original). Likewise, to reduce the width of the graphic to one--half inch (half the size of the original), you would change Scaling Width to 50%. Scaling Height works in the same way.

If you want to resize the graphic as a percentage of the original height and width, enter the new scaling percentages.

The program stores a copy of each graphic in its original size. All scaling settings refer back to that original size. For example, if you have a graphic that was originally a four inch square and you have resized it to a two inch square, the Scaling box will show settings of Width = 50% and Height = 50%. Those percentages refer back to the original. If you want to resize the graphic again to a one inch square, you will have to enter scaling values that again refer back to the original Width and Height, not the current values. Entering values of Width = 25% and Length = 25% will reduce the original four inch square to a one inch square.

Size edit boxes

Size refers to the absolute (measured) length and width of a graphic. For example, if a graphic is originally a one inch square, each of the Size settings will initially be set at one inch. To double the length and width of the graphic (to make a two inch square), reset the Size settings to two inches each. To reduce the size of the graphic to a half inch square, reset the Size settings to a half inch each.

Note: When you change the Size settings, the program automatically recalculates the Scaling settings, and when you change the Scaling settings, the program automatically recalculates the Size settings. The recalculated settings appear when you next open the Picture tab of the Format Editor.

Original size information

This box displays the original dimensions of the graphic (its dimensions when first inserted into the report). Sizing, scaling, and cropping do not affect this figure nor can you change it directly; it is simply provided as a reference.

Reset

When you click this button, any changes you have made to your graphic will be reset to the defaults displayed in the Original size display box.

Related topics

Format Editor


Hyperlink tab (Format Editor)

Use this tab to create a hyperlink to a web site, a field value, an e-mail address, a file, or another Seagate Crystal Report file. The hyperlink is saved with your report and is available to other users as a way of viewing additional information.

Note: If you create a hyperlink to another Seagate Crystal Report file, you are creating an on-demand subreport. Just as one subreport cannot contain another subreport, you cannot create a hyperlink between two subreports.

Hyperlink type (Hyperlink tab/Format Editor)

Click the type of hyperlink you want to create. The available types are:

  • No hyperlink
  • A website on the Internet
  • Current field value
  • An e-mail address
  • A file
  • Another Crystal report file.

Hints about how to use each of these options are provided on the bottom of the tab in the Helpful Hints section.

Note: Not all hyperlink types are available at all times. The object you select and its location on the report determine which types are available.

Hyperlink Information

Use this section of the tab to enter the appropriate hyperlink information (the URL of a web site, for example). Hyperlink information is available for all Hyperlink types except No hyperlink and Current field value.

Browse

Use Browse to search for files using the Open dialog box. Browse is available only for A file and Another Crystal report file.

Helpful Hint

Use these hints to learn how each Hyperlink type works and what it will add to your report.


Rounding tab (Format Editor)

The Rounding tab appears in the Format Editor when you right-click a box that you have created and choose Format Box from the shortcut menu. You can also select Format Box from the Format menu.

Use the Rounding tab to create boxes with rounded corners, as part of your report. Move the slider to the right to increase the curvature of the box corners. The box that you started with gradually changes to an eclipse or circle, depending on how far you move the slider to the right.

Once the appropriate shape is created, the program remembers the position of the slider and applies it unless you discard your changes in the Format Editor.


Tabs tab (Format Editor)

Use the Tabs tab to set, delete, modify and edit tabs in a text object.

If your text object is in edit mode, this tab appears on the Text Format dialog box.

Tab Stop Position box

Enter the desired tab stop position in this box. Tab stops are measured in inches.

Alignment options

Choose from four alignment option for the selected tab stop: left, right, center, and decimal.

Set button

Once you have entered a tab stop position into the Tab Stop Position box, click this button to set it.

Delete button

When you click this button, the selected tab stop is deleted.

Delete All button

When you click this button all the defined tab stops are deleted.


Subreport tab (Format Editor)

Use the Subreport tab to select or clear the On-demand subreport and Re-import when opening options.

On-demand subreport

Select this checkbox to create a hyperlink to a subreport.

Re-import when opening

Select this checkbox to refresh the data and formatting each time the subreport opens.


Font tab (Format Editor)

Use the Font tab of the Format Editor to change the fonts, the font size, and the font style for text and data fields on your reports.

If your text object is in edit mode, this tab appears on the Text Format dialog box.

Font

This list contains all the fonts that you have installed for your system. The list appears with the font that is currently in use selected.

Style

This list contains four additional attributes that you can assign to the selected font. The list appears with the style that is currently in use selected.

  • Regular
    the standard, unmodified style
  • Bold
    changes the font to boldface
  • Italic
    changes the font to italic
  • Bold Italic
    changes the font to Bold Italic.
Size

This list includes common point sizes for the selected font. The list appears with the point size that is currently in use selected.

Color

Select the desired color from this list if you want to add color to the font.

Strikeout

When you select this check box, the program prints the strikeout character across the font.

Underline

When you select this check box, the program underlines characters typed in the selected font.

Character spacing exactly

Use this option to specify the value that each character in your selected font occupies. The value is defined as the distance in number of points measured from the start of one character to the start of the next. When you change the character spacing, you change only the spacing between adjacent characters, not the font size of the characters.

For example, if you specify a 14-point font with a character spacing of 14 points, each character will remain as a 14-point font size, occupying a space that is 14 points wide.


Paragraph Formatting tab (Format Editor)

Use the Paragraph Formatting tab of the Format Editor to set formatting options for paragraphs in a text object.

If your text object is in edit mode, this tab appears on the Text Format dialog box.

First Line

Enter the distance in inches (or the default measurement for your report) that you want the first line of the paragraph to be indented from the left margin of the page.

Left

Enter the distance in inches (or the default measurement for your report) that you want the paragraph to be indented from the left margin of the page.

Right

Enter the distance in inches (or the default measurement for your report) that you want the paragraph to be indented from the right margin of the page.

Line spacing

Enter the spacing you want for lines as a multiple of the font size you are using, or as an exact number of points.

Of

Use this box to enter the multiple you want to use (if you selected Multiple for Line Spacing), or the number of points (if you selected Exact for Line Spacing).

Text interpretation

Use this list to select the type of pre-formatted data (string or memo fields only) or text you are inserting in a field. Seagate Crystal Reports extracts information about the font, size, style, color, and paragraph and displays the data or text with the specified attributes.

Your choices are:

  • "none" to interpret the string or memo field or imported text as if it contains plain text
  • "RTF Text" to interpret the string or memo field or imported text as if it contains Rich Text Format data
  • "HTML Text" to interpret the string or memo field or imported text as if it contains HTML data.


Format Grid Lines dialog box

The Format Grid Lines dialog box allows you to control the appearance of grid lines. This dialog box appears when you click Format grid lines on the Customize Style tab of the Cross-Tab and OLAP Report Experts.

Grid line diagram

Shows the grid layout based on the current settings. Click a section then specify the grid display settings.

Grid section

Click a section then specify the grid display settings.

Show Grid Lines

Select or clear this check box to show or hide all grid lines.

Color

Click a color for the item selected in the Grid line location list.

Style

Click a line style for the item selected in the Grid line location list.

Width

Click a line width for the item selected in the Grid line location list.

Draw

Select or clear this check box to show or hide the item selected in the Grid line location list.

Draw Grand Total Line Only

Select or clear this check box to show or hide the grand total grid line. When the grand total grid line is shown, the lines usually displayed at the grid line location are hidden.

This option is only available from the Cross-Tab Expert.


Format OLAP Grid Object dialog box

See OLAP Report Expert.


Format Other Dimensions dialog box

This dialog box appears when you click the Other Dimensions button on the Data tab of the Map Expert or OLAP Report Expert. Note that this button is available when you click the OLAP layout button, which appears if you are connected to an OLAP data source.

Use the Format Other Dimensions dialog box to set field values for your other dimensions.

Other Dimensions

This list displays the remaining dimensions in the OLAP Grid. Use the list to select the dimensions for which you want to set the field values.

Select a field value

Use this button to select the fields you want displayed in an OLAP Grid object, for the dimension you have selected in the Other Dimensions list. When you click this button, the Select a Field for Dimension dialog box appears.

The field value you select in that dialog box will appear in the list to the right of the other dimension name.


Formula Editor

Use the Formula Editor to create and edit formulas. The Formula Editor contains four main windows.

Window | Description of contents
Report Fields | Report fields contain all database fields accessible for your report. They also contain any formulas or groups already created for the report.
Functions | Functions are prebuilt procedures that return values. They perform calculations such as average, sum, count, sin, trim, and uppercase.
Operators | Operators are the "action verbs" you use in formulas. They describe an operation or an action to take place between two or more values. Examples of operators: add, subtract, less than, and greater than.
Formula text window | Area where you create or edit a formula.

Note: Changing the syntax from Crystal syntax to Basic syntax or vice versa will change the list of functions in the Functions window as well as the list of operators in the Operators window. The functions and operators differ from syntax to syntax.

Create a formula by double-clicking on any of the components listed in the Report Fields, Functions, or Operators trees. When you choose a component, the required syntax is also inserted. You can also manually enter a formula.

When you are finished creating or editing a formula, click Check to identify any errors in the formula and click Save and Close to save the formula and return to your report.

Related topics

Creating a formula and inserting it into a report

Formula Editor buttons

Formula syntax

Operators

Functions

Using Formulas

Formulas In Action


Formula Name dialog box

This dialog box appears when you select Formula Fields in the Field Explorer and then click the Edit button.

Use the Formula Name dialog box to specify a name for your formula.

New Name

Use this box to type in the name of your new formula.

Related topics

Field Explorer


Go To dialog box

This dialog box appears when you choose the Go To command from the Report menu.

Use the Go To dialog box to jump a particular page while previewing the report. You can jump to:

  • a specific page number
  • the first page of the report
  • the last page of the report.
Page

Click this option to jump to a specific page in your report. In the box, enter the number of the page that you want to jump to.

First page

Click this option to jump to the first page of the report.

Last page

Click this option to jump to the last page of the report.


Group Name Formula Editor

This dialog box appears when you are customizing a group name field. In the Insert Group dialog box, click Customize Group Name Field and then click Use a Formula as Group Name. Click the Formula button to open the Formula Editor.

Note:

  • You can only use Crystal syntax when creating a formula.
  • No field placement box appears when you create a selection formula; the formula is simply stored in the report.
  • Your group selection formula must be Boolean, that is, it must result in a Yes or No answer.
  • You cannot use commas in numbers you enter in a formula. Enter only the number itself.
Related topics

Formula Editor

Formula Editor buttons

Formula syntax

Operators

Functions


Group Selection Formula Editor

This dialog box appears whenever you choose the Group command from the Edit Selection Formula menu (under the Report menu).

Use the Group Selection Formula Editor to edit a group selection formula that limits the groups the program uses when preparing your report.

You can use the full range of report fields, operators, and functions to create a formula that restricts the range of data to print.

Note:

  • You can only use Crystal syntax when creating a formula.
  • No field placement box appears when you create a selection formula; the formula is simply stored in the report.
  • Your group selection formula must be Boolean, that is, it must result in a Yes or No answer.
  • You cannot use commas in numbers you enter in a formula. Enter only the number itself.
Related topics

Formula Editor

Formula Editor buttons

Formula syntax

Operators

Functions


Hierarchical Options dialog box

This dialog box appears when you choose the Hierarchical Grouping Options command from the Report menu.

Available Groups

Select the group that you want to sort hierarchically from the list.

Sort Data Hierarchically

Select this check box to sort the data in the selected group hierarchically.

Instance ID field

Select the field you want to organize hierarchically.

Note: It will normally be the same field that you grouped by.

Parent ID field

Select the field by which you want the Instance ID field organized.

For example, for a company hierarchal report, select the data field listing whom the employee reports to.

The type of the Instance ID and the Parent ID must be the same. For example, they both must be strings (text) or numbers.

Group Indent field

Enter the amount you want to indent for each subgroup.

Note:

  • The top level of the hierarchy is determined by group instances that match the Instance ID and Parent ID.
  • If a group instance is not connected to any Parent ID, it appears at the top of the hierarchy.
Related topics

Grouping data hierarchically


Insert Grand Total dialog box

This dialog box appears when:

  • you choose the Grand Total command from the Insert menu
  • you right-click a database field and choose the Insert Grand Total command from the shortcut menu that appears.

Use the Insert Grand Total dialog box to select the kind of grand total you want to appear on your report.

Note: You cannot sum or average a text, Boolean, or date field.

Summary Function

Select the summary function that you want to use for the grand total.

Related topics

Grand Total command

Using the Grand Total command


Insert Group dialog box

This dialog box appears when you choose the Group command from the Insert menu.

Use the Insert Group dialog box to group your data without summarizing the data in the groups. This is a useful command, for example, for dividing a customer list into state or ZIP code groups.

This dialog box contains three tabs:

  • the Common tab
  • the Specified Order tab
  • the Others tab.
Related topics

Group command

Using the Group command

Sorting, Grouping, and Totaling

Common tab

Use the Common tab to select the field you want to group on and then specify the sort order for your grouping.

Fields

This list contains the fields and formulas used in your report. Select the field that you want to use for grouping.

Sort Order

This list contains four sort direction options. The default is in ascending order. To change the sort direction, click the box to reveal the options and make your selection from the list.

Note: The lists that appear in this area of the Common tab differ depending on the date type of the field selected. For example, a Date field contains a list of choices for grouping by time periods (each week, each month, and so on).

Customize Group Name Field

Use this check box if you want to display a name different from the one chosen by default. By default, the group name is the same as that of the of the field you are grouping on. Selecting this check box makes all options below it active.

Choose From Existing Field

Select this option to create a customized group name from an exiting database field. For example, your report may be grouped on Customer ID, but you would rather display the Customer Name.

Use a Formula as Group Name

Select this option to create a customized group name from a formula. Clicking the formula button opens the Group Name Formula Editor.

Keep group together

Select this check box to keep groups from being split across a page. This will force groups to stay together. If there is enough room to keep them on the current page, the program will print them on the current page. If there is not enough room, the program will print them on the next page.

Repeat group header on each new page

Select this check box if you want the program to print a new group header at the top of each page if a group is spread over several pages. Otherwise, a group header prints only at the beginning of the group.


Specified Order tab

The Specified Order tab appears whenever you select in specified order as a sort order from the Insert Group dialog box or the Change Group Options dialog box.

Use the Specified Order tab whenever you want to set up custom groups. Custom groups are freeform groups that are not necessarily triggered by any one field value. You define the groups and you specify the individual values that belong in each.

Named Group

This list enables you to browse a list of the values in the field you are grouping. You can select a value from that list if you want to use it as a group name. For example, if you are setting up a California group and the value California appears among the field values, you can select that name from the list.

The box below displays the fields you have selected and the groups you have created as specified order groups.

Up arrow

Click this button to move the highlighted group higher in the list.

Down arrow

Click this button to move the highlighted group lower in the list.

New

Click this button to open the Define Named Group dialog box where you can create a new named group. If you entered a new name in the Named Group list on the Specified Order tab, it appears as the Group Name on the Define Named Group dialog box.

Edit

Click this button open the Define Named Group dialog box where you can edit a group you've highlighted in the Named Group list.

Delete

Click this button to delete the highlighted group.

Related topics

Insert Group dialog box

Others tab

Sorting, Grouping, and Totaling


Others tab

Use the Others tab to set up what you want the program to do with all values not included in any of the specified groups.

Discard all others

Select this option if you do not want to print the unselected fields in the groups for your report. If you summarize groups, values in the discarded groups will not be summarized nor will they be included in any grand total if you have one.

Put them all together, with the name

Select this option and enter a name if you want to put all unselected fields in one group. The default name for this group is Others. If you summarize groups, the values in the group will be summarized and will be included in any grand total.

Leave in their own groups

When you click this option, the your specified groups are shown in the order you specified. Remaining groups are displayed normally. If you summarized groups, the values in the group will be summarized and will be included in any grand total.

Related topics

Insert Group dialog box

Specified Order tab


Insert Object dialog box

This dialog box appears when you choose the OLE Object command from the Insert menu.

Use the Insert Object dialog box to insert an object into you report. You can either insert an existing object, or create a new one.

Create New object

Click this option to create a new object and embed it in your report. When the Create New option is active, the Object Type list is displayed.

Create from File

Click this option if you would like to embed or link an object that already exists. For example, if you have created and saved a spreadsheet file in Microsoft Excel and you want to use it as an object, click Create from File and then select the file name via the File box.

The program displays the File box as well as the Browse button and Link check box whenever you select Create from File. See Insert Object dialog box (Create from File).

Object Type

This box lists all of the object types available on your system.

Note: This list is based on the registration database. When OLE server applications are installed on your system, they are responsible for registering themselves with that database. If you have server applications on your system but they do not appear on this list, the applications may not have registered themselves properly.

Select the type of object you would like to embed in your report.

Related topics

OLE Object command

Inserting OLE objects into reports


Insert Object dialog box (Create from File)

This dialog box appears when you choose the Create from File option in the Insert Object dialog box.

Use the Insert Object dialog box (Create from File) to insert an already existing object.

File

Use this box to type in the path and file name of the file you want to use as an OLE object. Be sure that the file you select can be used as an OLE object. If you are not sure, check the documentation for the application that was used to create the file to see if the application is an object application.

Browse

If you are not sure of the path and file name of the object file, click the Browse button. The Browse dialog box appears. Use the Drives, Directories, and File lists to locate the file you want to use. When you click OK, the program automatically writes the path and file name into the File box.

Link

Select the Link check box if you want to create a linked object. When a linked object is activated from within a report, the original file is opened inside the application that was used to create it. Any changes you make directly affect the original file also.

If you want the data in an object to remain available to other applications, and always reflect the most current changes to the data, remember to link the object to the report.

Display As Icon

Specifies whether the embedded object will appear in the report as an icon or whether the actual contents of the object will always be visible. Note that some object applications only display objects as icons.

If you select Display as Icon, you can open the object in your document by double-clicking its icon.

Change Icon

Click this button to change the icon that represents the embedded object in your report.

Related topics

Insert Object dialog box


Insert OLAP Grid Object dialog box

See OLAP Report Expert.


Insert Subreport dialog box

This dialog box appears with the Subreport tab active when you choose the Subreport command from the Insert menu, or when you click the Insert Subreport button on the Supplementary toolbar.

Use the Insert Subreport dialog box to insert a subreport into your report. Once the dialog box appears, you can either choose an already existing report to insert as a subreport or create a new report from scratch.

Choose a report

When you choose this option, the Report File name box under the option is activated. Enter the name of the report you want to use as a subreport. If you do not know the name of the report, click Browse to find the file.

Report File name

Enter the full path for the report file you want to insert as a subreport. If you do not know the exact path click Browse to find the desired file.

Browse

Click the Browse button to find a report you'd like to include as a subreport. Double-click the report, or select Open and you are returned to the Insert Subreport dialog box. Notice that the file path to the report you just selected is now in the Report file name box.

Create a subreport

When you choose this option, the Report Name edit box under the option is activated. Enter a name for the subreport and then click the Report Expert button to create the new subreport.

Report Name

Enter the name you would like to assign to your new subreport and then click the Report Expert button to create your new report.

Report Expert

Click this button to open the Subreport Expert. Follow the directions on the tabs to create a new subreport.

On-demand subreport

Select this check box if you want your subreport to be On-demand. Data for an On-demand subreport is not read from the database until you drill down on the hyperlink used to represent it. Otherwise, subreport data is collected at the same time as the data for the container report.

Related topics

Subreports


Link tab

When the Insert Subreport dialog box appears, it contains two tabs: Subreport and Link. The Link tab cannot be accessed until you enter a report name into the Report File name box or until you create and save a new report using the Create a subreport option.

Note: The Link tab has the same functionality as the Subreport Links dialog box. For more information, see the Subreport Links dialog box.

For Subreport

Use this list to select the subreport that you want linked to the data in the container report. This list is active only if you have multiple subreports.

Available fields

The Available fields box lists all of the fields available in the container report to which you can link your subreport.

Add (>)

Click the Add button (>) to copy a field from the Available Fields box into the Field(s) to link to box.

Remove (<)

Click the Remove button (<) to remove a field from the Field(s) to link to box.

Field(s) to link to

The Field(s) to link to box displays the currently selected fields to which you intend to have your subreport link.

Subreport parameter field to use

The Subreport parameter field to use list appears when the Field(s) to link to box contains at least one field name. Use the Subreport parameter field to use list to determine the subreport field on which the container report and the subreport are linked.

Select data in subreport based on field

Use the Select data in subreport based on field check box to activate the Select data in subreport based on field list.

After you select this check box, choose a field from the list below to organize the subreport data based on a specific field. Clear this check box to have the subreport adopt the organization used in the primary report.


Insert Subtotal dialog box

This dialog box appears when you choose the Subtotal command from the Insert menu, or when you right-click a number or currency field and choose the Insert Subtotal command from the shortcut menu.

Use the Insert Subtotal dialog box to set the conditions for printing a subtotal.

Note:

  • If you choose the In specified order option, the Specified Order tab appears.
  • When you add a new Named Group, the Others Tab appears.
Fields

This list contains the fields and formulas being used in the report. Click the list to see its contents and select the field that you want to use for subtotaling.

Sort Order

This list contains four sort direction options. The default is in ascending order. To change the sort direction, click the box to reveal the options and make your selection from the list.

Note: The lists that appear in this area of the Common tab differ depending on the date type of the field selected. For example, a Date field contains a list of choices for grouping by time periods (each week, each month, and so on).

Keep group together

Select this check box to keep groups from being split across a page. This will force groups to stay together. If there is enough room to keep them on the current page, the program will print them on the current page. If there is not enough room, the program will print them on the next page.

Repeat group header on each new page

Select this check box if you want the program to print a new group header at the top of each page if a group is spread over several pages. Otherwise, a group header prints only at the beginning of the group.

Related topics

Subtotal command

Subtotaling data


Insert Summary dialog box

This dialog box appears when you click Insert Summary on the Standard toolbar, or when you choose the Summary command from the Insert menu.

Use the Insert Summary dialog box to summarize the data in a field in your report.

Note:

  • You cannot sum or average a text, Boolean, date/time, time, or date field.
  • If you choose the In specified order option, the Specified Order tab appears.
  • When you add a new Named Group, the Others Tab appears.
Summary types

This list contains all the summary operations available for use in your report. Select the desired operation.

Fields (to summarize)

This list displays the fields and formulas used in the report. Select the field that you want to summarize.

Fields (to sort and group by)

This list displays the fields and formulas used in the report. Select the field that you want to sort and group by.

Sort direction

This list contains four sort direction options. The default option is in ascending order. To change the sort direction, click the box to see the options, then make your selection from the list.

Show as a percentage of

Select this check box if you want to calculate the percentage total of one group within a broader grouping. For example, you can show the percentage of sales in each city based on the total sales for each country.

After you select the check box, you can choose the total or group you want the comparison to be based on.

Note: The percentage option is available only when the result of a summary operation is numeric.

Keep group together

Select this check box to keep groups from being split across a page. This will force groups to stay together. If there is enough room to keep them on the current page, the program will print them on the current page. If there is not enough room, the program will print them on the next page.

Repeat group header on each new page

Select this check box if you want the program to print a new group header at the top of each page if a group is spread over several pages. Otherwise, a group header prints only at the beginning of the group.

Related topics

Summary command

Using the Summary command


Layer Control dialog box

The Layer Control dialog box appears when you:

  • choose the Change Map Layers command from the Analyzer menu
  • select Change Map Layers from the shortcut menu on the Analyzer tab.

Use this dialog box to add, remove or change layers on your map. For example, you could rearrange the layers so that the Major Cities layer appears above the Highway layer, or so that the Capitals layer appears above the Top 20 Cities layer.

Note: It may be necessary to zoom in on the map to view layer changes.

Layers

The Layers list contains the layers options for your map.

Up

Use the Up button to move a layer up in the Layers list.

Down

Use the Down button to move a layer down in the Layers list.

Add

Use the Add button to add a layer to the Layers list.

Remove

Use the Remove button to remove a layer from the Layers list.

Visible

Use the Visible check box to make a layer visible on the map. If this check box is not selected, the selected layer will be hidden.

Automatic Labels

Use the Automatic Labels check box to specify whether the layer is labeled automatically on the map.

Display

Click the Display button to bring up the Display Properties dialog box. The Display Properties dialog box allows you to further manipulate the mode and zoom layering of a selected layer.

Related topics

Display Properties dialog box


Link Dimension dialog box

This dialog box appears when you click the Add (>) button in the Format OLAP Grid Object dialog box.

Use the Link Dimension dialog box to link a dimension to a relational field, either in the report or in a database.

Relational Fields

This list displays all of the relational fields available for use in your report.

Link Dimension to Relational Field(s)

This list displays all of the relational fields that the current dimension will be linked to.

Add (>)

Click this button to add a selected field from the Relational Fields list to the Link Dimension to Relational Fields(s) list.

Add All (>>)

Click this button to add all of the fields listed in the Relational Fields list to the Link Dimension to Relational Fields(s) list.

Remove (<)

Click this button to remove a selected field from the Link Dimension to Relational Fields(s) list.

Remove All (<<)

Click this button to remove all the fields from the Link Dimension to Relational Fields(s) list.

Order

Use the Order buttons to move a selected field up or down in the Link Dimension to Relational Fields(s) list. The dimension will be linked to the first relational field that is found. Fields that appear higher in the list will be searched for first.


Link Options dialog box

This dialog box appears when you have a link line selected and you click the Options button in the Visual Linking Expert.

Use the Link Options dialog box to specify join types and the criteria the program is to use when linking a single table to two or more other tables (A to B, A to C).

Link description

This box describes the selected link. The field(s) listed on the left are the link from field(s) and the field(s) listed on the right are the link to field(s).

Index In Use

This list displays the index that is currently in use. If you click the arrow it also lists the other indexes that are available for the link as well as the option <no specific index>.

Fields In Index

This box lists the fields that are included in the index that is currently selected in the Index in Use list.

Allow partial text matches

This check box is for Paradox and dBASE users. Use it to specify whether the program should have partial text matching enabled when linking.

When linking to two files from this file options

Three different options for looking up records are available:

  • Look up both files at the same time
  • Look up all of one file, then all of the other
  • Look up all combinations of the two files.
SQL Join Type options

The program enables you to specify the type of join you want it to use when joining SQL tables.

Related topics

Linking indexed tables

Link relationships

Visual Linking Expert

SQL join types (ODBC data sources)


Links dialog box

This dialog box appears when you have a linked OLE object selected and you choose the Links command from the Edit menu.

Use the Links dialog box to update and modify existing object links in your report.

Links

Displays the current links used in the report, their type and the update status. To change the status of a link, click the link and then click Automatic or Manual.

Update

Specifies whether you want the selected link to be updated automatically or manually.

If you click Automatic, whenever you change the linked information in the original file, this report will be updated.

If you click Manual, you need to click Update Now when you want the information to be updated.

Update Now

Click this to update the information in the selected link.

Open Source

Click this to open the source file for the selected link.

Change Source

Click this to change the source file for the selected link.

Use this button to specify a new location for an object file, for example. When you click this button, the Change Source dialog box appears. Using this dialog box, select your new source. For example, if you have linked to Red.bmp and you have moved the bitmap from one directory to another, locate the new directory in this dialog box and select Red.bmp in that directory as your new source.

Break Link

Click this to disconnect the selected link. This is useful if you no longer want changes in the source file to be reflected in the current report. The object remains in the report as an unlinked, static object that cannot be edited via OLE.

Related topics

Links command

OLE

Using the Links command


Magnification Factor dialog box

This dialog box appears when you choose the Zoom command from the View menu.

Use the Magnification Factor dialog box to set the magnification factor for zooming in or out of your report.

Magnification Factor

Click this option to set the magnification to a particular percentage. Type the magnification factor into the box, for example 50%.

Fit One Dimension

Click this option to fit the page according to the width of the report in the Design or Preview tabs.

Fit Whole Page

Click this option to fit the whole page of the report in the Design or Preview tabs.

Reset

Click this button to reset the magnification factor to the default value of 100%.

Related topics

Zoom command

Design tab

Preview tab

Using the zoom feature


Map Fields dialog box

The Map Fields dialog box is used to link report fields to their corresponding database fields when changes are made to the structure of the database, or when moving a database from a direct access type to an SQL type. The Map Fields process helps you to make sure your reports print with the current version of the active database.

This dialog box opens when you choose any of the following Database menu commands (if the report database has changed since you last ran the report):

  • Verify Database command
  • Verify on Every Print command
  • Set Location command
  • Convert Database Driver command.
Unmapped fields (report fields)

The Unmapped fields list (upper left) shows the unmapped report fields for which the program detects a change in the active database.

Unmapped Fields (database fields)

The Unmapped fields list (upper right) shows the unmapped database fields for which the program detects a change.

Match Type

When the Match Type check box is selected, the Unmapped fields list (upper right) shows only the names of unmapped database fields that are of the same type as the field selected in the Unmapped fields list (upper left). When the Match Type check box is not selected, the Unmapped fields list (upper right) shows all unmapped database fields, regardless of the field type.

Map

Click Map to map the report field selected in the Unmapped fields list (upper left) to the database field selected in the Unmapped fields list (upper right).

Mapped fields (report fields)

The Mapped fields list (lower left) displays the names of mapped report fields. When you map report fields, those fields appear in this list.

Mapped fields (database fields)

The Mapped fields list (lower right) shows the mapped database fields. When you map database fields, those fields appear in this list.

Unmap

Click Unmap to unmap the report field selected in the Mapped fields list (lower left) and the database field selected in the Mapped fields list (lower right). After you click this button, the two fields are longer mapped.

Related topics

Remapping processes

Remapping when converting database drivers


Map Region Resolver dialog box

The Map Region Resolver dialog box opens when you choose the Resolve Mismatch command from the Analyzer menu, or from the map's right-click menu. Resolve Mismatch is available only when you are working with a map on the Analyzer tab.

Use this dialog box when the map you are working with uses a different geographic name from the one used in the database. For example, a map of Europe may use "United Kingdom" while the database uses the abbreviation "U.K." Until you resolve the data mismatch, the map will not be able to display any information for the selected geographic region.

Note: The first time you choose this command while creating or editing a report, a processing dialog box appears briefly.

Assign this heading

This list displays all the geographic headings used in your database that do not match a default heading. Select items from this list (one at a time) and resolve the mismatch by choosing a default heading in the To this keyword list.

To this keyword

Use this list to select and assign a keyword from the default headings. When you have made a choice, the mismatched heading in the Assign this heading list is linked to the default heading you selected in the To this keyword list.

Assign

Click Assign to resolve the mismatch and save the link between the database heading and the default heading. The new assignment is shown in the list on the bottom part of the Map Region Resolver dialog box.

Remove

Click Remove to delete the link between the database heading and the default heading. After removing the link, the database heading is unresolved. You can make another link for it if you choose.


Number and Date Format dialog box

This dialog box appears after you click OK in the Character Separated Values dialog box when exporting a report.

Use the Number and Date Format dialog box to:

  • set the number formats you have defined in your report to be used to export your data to the new disk file
  • set the date formats you have defined in your report to be used to export your data to the new disk file.
Same number format as in report

Select this check box if you want the number formats you have defined in your report to be used when exporting your data.

Same date format as in report

Select this check box if you want the date formats you have defined in your report to be used when exporting your data.

Related topics

Character Separated Values dialog box

Exporting a report


Object Size and Position dialog box

Use the Object Size and Position dialog box to change the height and width of the selected object, and to adjust the object's position from the top and side margins. All units are in inches.

X

Use the X box to change an object's horizontal position from the margin. All units are in inches.

Y

Use the Y box to change an object's vertical position from the margin. All units are in inches.

Height

Use the Height box to change an object's vertical height. All units are inches.

Width

Use the Width box to change an object's horizontal width. All units are inches.


Open dialog box

The Open dialog box appears when you choose the Open command from the File menu.

Use this dialog box to open the file with the name, file type, and location you specified.

Related topics

Open command


Options dialog box

This dialog box appears when you choose the Options command from the File menu.

Use the Options dialog box to configure the program—that is, to set up the program so that it works like you do. This dialog box offers a wide range of options for helping you work faster and easier.

Note: Many of these options also appear in the Report Options dialog box. Use the Options dialog box to change the default values for the program, use the Report Options dialog box to change the options for the current report.

Related topics

Options command


Layout tab

Use the Layout tab to set the default grid, ruler, preview page, and object format options.

View options

Show Rulers in Design

When you select this check box, the Ruler is displayed on the Design tab. This option is selected by default.

Show Rulers in Preview

When you select this check box, the Ruler is displayed on the Preview tab. This option is selected by default.

Show Guidelines in Design

When you select this check box, the program displays guidelines on the Design tab. This option is not selected by default.

Show Guidelines in Preview

When you select this check box, the program displays guidelines on the Preview tab. This option is not selected by default.

Show Hidden Sections in Design

When you select this check box, hidden and suppressed sections in your report are displayed on the Design tab. Report objects in these sections are shown on a gray background. This option is selected by default.

Show Short Section Names in Design

When you select this check box, the program abbreviates the section names that appear in the gray area on the left side of the Design tab (the gray area is reduced in size). This adds extra width to the report page and allows you to work with more of your report on the screen.

When you clear this check box, the program displays full section names and maintains the gray area at full width.

This option is selected by default.

Show Section Names in Preview

When you select this check box, the program displays abbreviations of the section names in a gray area on the left side of the Preview tab.

When you clear this check box, no section names are displayed and the entire width of the Preview tab is used to display the report page.

This option is selected by default.

Show Page Breaks in Wide Pages

When you select this check box, indicators are displayed on the Preview tab for page breaks in wide pages. This option is selected by default.

Show Tool Tips in Design

When you select this check box, the program displays tool tips when you are working on the Design tab. Tool tips show the name of a button when you leave your mouse pointer over it for a few seconds. This option is selected by default.

Show Tool Tips in Preview

When you select this check box, the program displays tool tips when you are working on the Preview tab. Tool tips show the name of a button when you leave your mouse pointer over it for a few seconds. This option is selected by default.


Field options

Show Field Names

When you select this check box, field names are displayed for each report field. When you clear the check box, symbolic characters (XXXX, 555, and so on) are displayed instead of field names. This option is selected by default.

Insert Detail Field Titles

When you select this check box, a default field title appears in the Page Header section whenever you insert a field in the Details section of the Design tab. The default title is the name of the field, underlined. This option is selected by default.

Insert Group Name with Group

When you select the check box, the program automatically enters the Group Name in the Group Header whenever you insert a new group. This option is selected by default.

Preview pages

Starts With options

These three options let you specify which level of magnification you want the program to use as a default when displaying reports on the Preview tab. You have the following choices:

  • Full Size
    Displays the report at full size and fits as much of the report into the Preview tab as possible. This option is selected by default.
  • Fit Width
    Adjusts the width of the report to match the width of the Preview tab.
  • Fit Page
    Adjusts the width and the height, in order to be able to display the entire page in the Preview tab.

See also the Report Options dialog box.

Create Group Tree

When you select this check box, the Group Tree View is shown on the Preview tab. This option is selected by default. See also the Report Options dialog box.


Grid options

Snap To Grid

When you select this check box, new database fields you insert snap to the nearest grid positions. When you clear this check box, new database fields are left where you place them. This option is not selected by default.

Show Grid in Design

When you select this check box, a grid is displayed on the Design tab. This option is not selected by default.

Show Grid in Preview

When you select this check box, a grid is displayed on the Preview tab. This option is not selected by default.

Free-Form Placement

When you select this check box, objects in your report can be placed anywhere in their respective sections. This option is selected by default.

Grid Size

This box lets you specify the size of the grid increments. The unit of measure used for grid increments is based on your settings in the International section of the Windows Control Panel.

Related topics

Preview tab


New Report tab

Use the New Report tab to set the default report directory and mail destination.

Report Directory

Use this box to set the default directory that the program uses when searching for and displaying existing reports.

Browse

Click this button to choose a report directory.

Mail Destination

This box lists all the possible destinations you can choose to export a report to e-mail. Click the arrow on the list and select a destination. Your choices are:

  • Application
  • Exchange Folder
  • Lotus Notes Database
  • Microsoft Mail (MAPI)
  • other mail destinations (depending on how your computer is configured).

When you have made a selection and open a mail-related dialog box in the program, it will open with your specified destination already selected.

Re-import Subreports When Opening Reports

When you select this check box, subreports are updated each time you open their containing reports. This option is not selected by default.


Database tab

Use the Database tab to set SQL/ODBC database options, the method you want to use to sort and display table and field names, and other advanced options.

Show

Tables

When you select this check box, the program allows reporting on database tables in your SQL/ODBC data sources. This option is selected by default.

Views

When you select this check box, the program allows reporting on virtual tables in your SQL/ODBC data sources. This option is selected by default.

System Tables

When you select this check box, the program allows reporting on system tables. These tables are typically used by the system administrator only but are available for use if you have the appropriate permissions. This option is not selected by default.

Synonyms

When you select this check box, the program allows reporting on virtual tables that are available on some hosts. This option is not selected by default.

Stored Procedures

When you select this check box, the program will allow reporting on the result sets from stored procedures if you are using SQL systems that support stored procedures. This option is not selected by default.

Table name LIKE

This box allows you to enter the SQL LIKE function to specify the kinds of table names you want to appear in the Data Explorer. You can use the underscore character (_) and the percent sign character (%) as wildcards with this function. The underscore character specifies any single character, and while the percent sign signifies any character string. For example, DAV_ matches DAVE only, while DAV% matches both DAVE and DAVID. Table name Like C% would display only those tables that have a table name beginning with the letter C.

Owner LIKE

This box works exactly like the Table name Like box except that the LIKE function here is used to select the Owner (or Creator or Alias) of the table, not the table name itself. For example, Owner Like C% would display only those tables that have an owner beginning with the letter C.

Reprompt user when connecting

When you select this check box, the program opens the Allow Reporting On dialog box before it opens the Data Explorer. The Allow Reporting On dialog box allows you to specify the types of data you want to appear in the Data Explorer. All of the options from the Show section of the Database tab appear in the Allow Reporting On dialog box.

List Tables and Fields by

By setting the options in this section of the Database tab, you can specify the text that you want the program to use for tables and fields.

  • Name
    If you select this option, the program identifies tables and fields using the actual name, for example, "Customer" table and "Customer Name" field. This option is selected by default.
  • Description
    If you select this option, the program identifies tables and fields using the description you have specified, for example, "Our Clients" table and "The names of all our customers" field.
  • Both
    If you select this option, the program identifies tables and fields using both the name and the description you have assigned, for example, "Customer - Our Clients" table and "Customer Name - The names of all our customers" field.

Sorting

Sort Tables Alphabetically

When you select this check box, tables are displayed throughout the program sorted in alphabetical order (instead of the order they appear in the database). This option is selected by default.

Sort Fields Alphabetically

When you select this check box, fields are displayed throughout the program sorted in alphabetical order (instead of the order they appear in the database table). This option is not selected by default.

Advanced Options

Use Indexes or Server for Speed

Select this check box to use the available indexes/servers to speed the record selection process. If this check box is cleared, the record section process may be much slower. This option is selected by default.

Note: If an index has a name that is different from the database it indexes, you need to identify the index for the program. You do this using the Link Options dialog box, which you can access via the Visual Linking Expert.

Perform Grouping on Server

Select this check box to have the program perform grouping on the server (server-side processing). Server-side processing allows you to set up a report that performs the majority of its processing on the server and pushes only relevant details to your computer. Server-side processing provides you with a number of benefits:

  • less time connected to the server
  • less memory needed to process the report on your computer
  • lower transfer time from the server to the client.

Server-side processing works only for reports based on SQL data sources (you cannot, for example, use server-side processing for a report based on a query, since a query is not an SQL data source).

This option is not selected by default. See also the Report Options dialog box.

Related topics

Server-side processing

Use Default Alias

Select this check box to use the default alias for each database you activate. The default alias is the name of the database in one word without the extension. For example, the default alias for the database Craze.mdb is "craze." Use this option if you are usually satisfied with the default alias and do not want to have to accept or change the alias whenever you activate a database. This option is selected by default.

Clear this check box to display the Alias Name dialog box whenever you activate a database. You can accept the default alias or enter a new one in the Alias Name dialog box.

Note: The "accept" option does not prevent you from later changing the alias for any active database. If you want to change an alias, use the Set Alias command on the Database menu.

Translate DOS Strings

When this check box is selected, the program assumes that any character code it finds in a dBASE string field is an ASCII code and it translates that code to a corresponding ANSI value so that the same character that appears in dBASE appears in your report.

Note: If you clear this check box and you have used upper ASCII characters in your dBASE string fields, the special characters will not be the same in your report as they are in the dBASE string field.

This option is selected by default. See also the Report Options dialog box.

Case-Insensitive SQL Data

Select this check box if you want to search for strings in your SQL data without checking the case. For example, if your report contains SQL data and the data is of mixed case (red, RED, Red), a case-sensitive search for "red" returns only "red." If you select this check box, the same query will return red, RED, and Red when using red as a record selection value. This option is selected by default. See also the Report Options dialog box.

Translate DOS Memos

When this check box is selected, the program assumes that any character code it finds in a dBASE memo field is an ASCII code and it translates that code to a corresponding ANSI value so that the same character that appears in dBASE appears in your report.

Note: If you clear this check box and you have used upper ASCII characters in your dBASE memo fields, the special characters will not be the same in your report as they are in the dBASE memo field.

This option is selected by default. See also the Report Options dialog box.

Auto-Smart Linking

Use this check box if you want the program to automatically link your tables when you are using the Visual Linking Expert. This option is selected by default.

Cartesian Product

Use this check box to produce all possible combinations of the original data. This option is not selected by default.

Note: The Cartesian Product option applies to OLAP data sources and does not apply specifically to other direct access data sources. The option ensures a report shows all values of all dimensions (as opposed to all values of the first dimension by one value of the second dimension, which would be the result if the option was not selected). See also the Report Options dialog box.

Perform Query Asynchronously

When this check box is selected, the program uses asynchronous queries. The program normally sends an entire query to the database server. Selecting this option, however, allows the program and the ODBC database server (if it supports asynchronous queries) to transfer data back and forth. An advantage of using this option is you can cancel queries during processing more easily. This option is not selected by default. See also the Report Options dialog box.

Select Distinct Data for Browsing

When Select Distinct Data for Browsing is selected, you can see the first 500 distinct (unique) records when you browse the contents of a database field.

When Select Distinct Data for Browsing is not selected, browsing returns the unique values in the first 500 records.

Note: Note that since most SQL servers do not support selecting distinct records for long data types such as memo and blob fields, selecting and browsing distinct records are not supported for such fields.

See also the Report Options dialog box.


Editors tab

The Editors tab allows you to customize formatting options for the text you create in editors such as the Formula Editor or the SQL Expression Editor.

Font

Use the Font list to select from font options for text created in Editors. Changes to font affect all Editors elements.

Font size

Use the Font size list to select a font size for text created in Editors. Changes to font size affect all Editors elements.

Tab size

Use the Tab size box to enter the number of spaces that the program will use to indicate a <tab> in the text.

Element

The Element list contains four kinds of elements you can put into an Editor. By selecting the Comment or Keyword elements, you can change either the foreground or the background colors. The Text and Text Selection elements can only be formatted for Font, Font Size, and Tab Size.

Foreground

Use the Foreground list to change the text color of an Editor element. You have three separate color options for each element.

Note: The Foreground list becomes active for Text and Text Selection elements when the "Use Windows system color" check box is not selected.

Background

Use the Background list to change the background color of an Editor element. You have three separate color options for each element, including a custom option which brings up the Color dialog box for an even greater selection of background colors.

Note: The Background list becomes active for Text and Text Selection elements when the "Use Windows system color" check box is not selected.

Use Windows system color

Clear the Use Windows system color check box to activate the Foreground and Background lists for the Text and Text Selection elements.

Sample

The Sample box shows an example of how the Font, Font Size, Foreground Color, and Background Color changes you made will appear on the Editor.

Reset All

Click Reset All to return all formatting changes you have made on the Editors tab back to the original default settings.


Data Source Defaults tab

Data Directory

Use this box to enter the name (and path) of the Data Directory that you want to use for your report. If you do not know the full name and path, click the Browse button.

Browse

When you click the Browse button, the Choose Directory dialog box appears. Use the Directory scroll box and the Drives list to select the file of your choice. Click OK to return to the Database tab.

Database File Filter

Use this box to set the file filters the program will use in searching for and displaying databases. For example, if you set the filter to Paradox (*.db), the program will display files matching that extension in the Choose Database File dialog box, and in other dialog boxes that offer you database options. If you want to set multiple filters, use semicolons to separate them (*.db;*.dbf;*.mdb).

Index File Filter

Use this box to set the file filters the program should use in searching for and displaying indexes. If you set the filter to Paradox (*.px) for example, the program will display only files with that extension in the Attach New Index dialog box and other boxes that offer you index options. Indexes are of major importance in establishing links between multiple databases.

Default Dictionary

Use this box to enter the name (and path) of the default dictionary you want to use for your report. If you don't know the complete path, click the Browse button to locate the desired file.

Browse

When you click the Browse button, the Open dialog box appears. Use this dialog box to select the file of your choice. Click Open to return to the Database tab.


Reporting tab

The reporting options on this tab let you place a governor on data selection; they let you specify how you want Date/Time strings handled (if they are used in your report); and they let you specify whether or not data will be saved with your report.

Date-Time Field options

You have three options for converting Date-Time Fields:

  • Convert to String
  • Convert to Date
  • Keep Date-Time Type.

See also the Report Options dialog box.

Convert NULL Field Value to Default

Select this check box to have the program convert any null values to the database default. Some databases treat a null as a zero, some treat it as a blank, and some treat it as a special null value. This option is not selected by default. See also the Report Options dialog box.

COUNT Number of Records First

Select this check box (and then supply a maximum value in the Warn If More Than option) if you want to limit the number of records that can be included in a report. When you select the check box, the program will count the number of records first before building your report. By default, the check box is not selected.

Warn If More Than

Use this box to specify the maximum number of records the program can use in a report without first giving you a warning prompt. This option applies only to the Count Number of Records First check box.

Save Data With Report

When you select this check box, the program automatically saves database data with your report. Otherwise, the program saves the report itself, but it will need to retrieve the report data once again when you run the report. This option is selected by default. See also the Report Options dialog box.

Discard Saved Data When Loading Reports

Select this check box to discard saved data when loading reports. When you open a report, this function removes that report's current set of data from the database, so that you can enter new data while retaining the report's format and settings. This option is not selected by default.

Save Summaries With Report

Use this check box to determine whether the program will save the data summaries you create with the report. This option is selected by default. See also the Report Options dialog box.

Suppress Printing if No Records Selected

Use this check box to ensure reports cannot be printed if the database does not return any records. This option is not selected by default. See also the Report Options dialog box.

Show All Headers on Drill Down

Use this check box if you would like report drill-down views to included headers for all sections above the drill-down records. This option is not selected by default. See also the Report Options dialog box.

Autosave Reports After ... Minutes

Use this check box if you want reports to be saved automatically as you work on them. Use the Minutes box to specify the interval before and between autosaves. This option is not selected by default.

More Report Engine Error Messages

Select this check box to tell the program to offer more explanation in its error messages when a Report Engine error occurs. This option is selected by default. See also the Report Options dialog box.

Formula Language

Use this list to choose the formula language you want the program to use. You can choose between Crystal Syntax and Basic Syntax. Crystal Syntax is selected by default.


Fields tab

Use the Fields tab to set the default format for string, number, currency, date, time, date/time, and Boolean fields. The program will use the default formats for all field objects that have not been custom formatted.

String

Click this button to set default formatting properties for string field objects. When you click this button, the program takes you to the Common tab of the Format Editor.

Number

Click this button to set default formatting properties for number field objects. When you click this button, the program takes you to the Common tab of the Format Editor. A Number tab is also present in the Format Editor.

Currency

Click this button to set default formatting properties for currency field objects. When you click this button, the program takes you to the Common tab of the Format Editor. A Number tab is also present in the Format Editor.

Date

Click this button to set default formatting properties for date field objects. When you click this button, the program takes you to the Common tab of the Format Editor. A Date/Time tab is also present in the Format Editor.

Time

Click this button to set default formatting properties for time field objects. When you click this button, the program takes you to the Common tab of the Format Editor. A Date/Time tab is also present in the Format Editor.

Date/Time

Click this button to set default formatting properties for Date/Time field objects. When you click this button, the program takes you to the Common tab of the Format Editor. A Date/Time tab is also present in the Format Editor.

Boolean

Click this button to set default formatting properties for Boolean field objects. When you click this button, the program takes you to the Common tab of the Format Editor. A Boolean tab is also present in the Format Editor.

Related topics

Options dialog box

Layout tab

New Report tab

Database tab

Editors tab

Data Source Defaults tab

Reporting tab

Fields tab

Fonts tab


Fonts tab

Use the Fonts tab to change the fonts for any field in your report.

Fields

When you click this button, the Font dialog box appears. You can then set the font for all the fields in your report.

Summary Fields

When you click this button, the Font dialog box appears. You can then set the font for all the summary fields in your report.

Group Name Fields

When you click this button, the Font dialog box appears. You can then set the font for all the group name fields in your report.

Text Objects

When you click this button, the Font dialog box appears. You can then set the font for all the text objects in your report.

Field Titles

When you click this button, the Font dialog box appears. You can then set the font for all the field titles in your report.


Others dialog box

This dialog box appears when you click the Options button on the Group tab of the Report Expert.

Use the Others dialog box to specify what to do with those records that do not fit into the specified group. You can discard the records, place them together in a newly named group, or leave them as is.

Discard all others

When you click this option, the program will not print any groups not specified in the sort order list. If you summarize groups, values in the discarded groups will not be summarized nor will they be included in any grand total if you have one.

Put all others together, with the name

When you click this option, the program will create a group that will lump together all groups not specified in the sort order list. This group will appear after the specified groups. If you summarize groups, the values in the group will be summarized and will be included in any grand total. You can specify the name of the group using the Name edit box.

Put all others together, with the name

Use this box to specify the group name for the Others group. By default, the group will be named Others. To specify a group name, select the name Others, and enter the desired group name in the edit box.

Leave in their own groups

When you click this option, the program will print your specified groups in the order you specified them, and it will then group and print the remaining groups normally. If you summarized groups, the values in the group will be summarized and will be included in any grand total.


Page Setup dialog box

This dialog box appears when you choose the Page Setup command from the File menu.

Use the Page Setup dialog box to set the page margins for your report. The page margins specify the amount of white space between your report and the edge of the page. The dialog box displays default margins when it first appears.

Note: The program uses the non-printing areas established for your printer as default printer margins. Those margin settings appear in the Printer Margins dialog box. While you can set margins that fall inside the non-printing areas, parts of your report may be clipped if you do.

Top Margin

Enter the top margin in inches (or in the default value set for your report).

Left Margin

Enter the left margin in inches (or in the default value set for your report).

Right Margin

Enter the right margin in inches (or in the default value set for your report).

Bottom Margin

Enter the bottom margin in inches (or in the default value set for your report).

Use Default Margins

Select this check box to use the default page margin settings.

Related topics

Page Setup command

Using the Page Setup command


Paste Special dialog box

This dialog box appears when you choose the Paste Special command from the Edit menu.

Use the Paste Special dialog box to paste an OLE object into your report from the clipboard.

Paste

Click this to embed the copied information into your report.

Changes you make to the embedded object will not be reflected in the original file, and changes to the original file will not be reflected in this report.

Paste Link

Click this to link the copied information to your report.

Changes you make to the embedded object will be reflected in the original file, and changes to the original file will also appear in this report.

As

Enables you to select how the copied information is pasted into your report. This option is not available for all types of object. See OLE for details.

Display As Icon

Specifies whether the embedded object will appear in the report as an icon or whether the actual contents of the object will always be visible. Note that some object applications only display objects as icons.

If you select Display as Icon, you can open the object in your document by double-clicking its icon.

Change Icon

Click this button to change the icon that represents the embedded object in your report.

Related topics

OLE

Paste Special command


Preview Sample dialog box

This dialog box appears when you choose the Preview Sample command from the Print menu (under the File menu).

Use the Preview Sample dialog box to select how many records you want to preview.

All Records

Select this option to preview all the records available in the report.

First n records

Select this option to preview a specified number of records available in the report.

Related topics

Preview tab


Print dialog box

This dialog box appears when you choose the Printer command from the Print menu (under the File menu), or when you click the printer icon in the Preview tab.

Use the Print dialog box to set the specifications for your print job.

All

Select the All option to print all the pages in range on the open report.

Pages

Select the Pages option to print only a selected range of pages on the open report. Use the From and To boxes to enter the range of pages.

Copies

Type the number of copies you want to print.

Collate Copies

Select Collate Copies if you would like the printer to collate the report when multiple copies are printed. This is selected by default.

Related topics

Printer command


Print Setup dialog box

This dialog box appears when you choose the Printer Setup command from the File menu.

Use the Print Setup dialog box to select the printer, page orientation, and paper size you want to use to print the report. If you do not select a printer, the program will print to the Windows default printer.

No Printer

Select the No Printer check box when printing is not an option from a particular workstation.

Name

Find the name of the printer to which you can send reports in the Name list.

Properties

Click the Properties button to bring up the Properties dialog box for the selected printer.

Default Properties

Select the Default Properties check box to set all printer properties to their default settings.

Size

Use the Size list to select from a variety of paper- or envelope-size options.

Source

Use the Source list to select from a variety of feed or paper source options.

Orientation options

Select the Portrait option to print your report in a standard-letter orientation.

Select the Landscape option to print your report in landscape orientation.

Network

Click the Network button to connect to a network printer.

Related topics

Printer Setup command


Record Selection Formula Editor

This dialog box appears whenever you select the Record command from the Edit Selection Formula menu (under the Report menu).

Use the Record Selection Formula dialog box to set up a record selection formula that limits the records the program uses when preparing your report.

You can use the full range of report fields, operators, and functions to create a formula that restricts the range of data to print.

Interaction of the Selection Formula Editor and Select Expert

The Select Expert and the Selection Formula Editor are interactive. That is, record selection criteria you enter via the Select Expert (from the Report menu) automatically generates a record selection formula which can be reviewed and modified. Likewise, record selection formulas and modifications to existing record selection formulas automatically update the selection criteria in the Select Expert.

Note:

  • You can only use Crystal syntax when creating record selection formulas.
  • No field placement box appears when you create a selection formula; the formula is simply stored in the report.
  • Your record selection formula must be Boolean, that is, it must result in a Yes or No answer.
  • You cannot use commas in numbers you enter in a formula. Enter only the number itself.
Related topics

Formula Editor

Formula Editor buttons

Formula syntax

Operators

Functions


Record Sort Order dialog box

The Record Sort Order dialog box appears when you choose the Sort Records command from the Report menu.

Note: This command is also available as a button on the Standard toolbar.

Use the Record Sort Order dialog box to define how you want the records in your report to be sorted for printing. You can add and remove sort fields and define the sort direction ascending or descending) for the data in your report.

A sort field is a data field on which the sort procedure is based. A mailing list, for example, could be sorted, in ascending order, on the {customer.POSTAL CODE} field. In this case, the customers would be sorted so that those with the lowest postal codes would appear first and those with the highest postal codes would appear last.

Report Fields

Displays a list of the report fields currently in the report.

Sort Fields

Displays a list of the sort fields currently in the report.

Add

Adds the selected report field to the Sort Fields list.

Remove

Removes the selected sort field from the Sort Fields list.

Sort Direction

Sets the sort direction to ascending or descending.

Related topics

Sort Records command

Sorting, Grouping, and Totaling

Sorting single and multiple fields


Refresh Report Data dialog box

There are two versions of the Refresh Report Data dialog box. This dialog box appears when you click the Refresh button on the Standard toolbar, or choose the Refresh Report Data command from the Report menu.

If your report does not contain any parameter fields, a simple message box appears. Click OK to refresh the report data.

If your report does contain parameter fields, the Refresh Report Data dialog box enables you to run the report using the current parameter values or to enter new parameter values.

Use current parameter values

Click this option to run the report using the current parameter values.

Prompt for new parameter values

Click this option if you want to run the report with different parameter values. When you choose this option the Enter Parameter Values dialog box appears.

Related topics

Parameter Fields


Remove from Report dialog box

This dialog box appears when you select the Remove from Report command from the Database menu.

Use the Remove from Report dialog box to delete databases from the active list so they can no longer be used in your report.

The alias of each active database appears in the Databases box.

The name of the selected database and its path appears in the Location box.

Databases

Lists all the active databases used in the current report.

Location

Displays the referenced table, server type, server name, database and user ID of the selected table.

Remove

Click this button to remove the selected database.

Related topics

Remove from Report command

Using the Remove from Report command


Report Options dialog box

This dialog box appears when you choose the Report Options command from the File menu.

Note: These options also appear in the Options dialog box. Use the Options dialog box to change the default values for the program, use the Report Options dialog box to change the options for the current report.

Convert Date-Time Field

Using this list, specify if you want Date/Time string fields from Microsoft Access automatically converted to:

  • string format
  • date format
  • date-time format.
Preview Pages Start With

This list enables you to select the default level of magnification for displaying reports on the Preview tab.

  • Full Size
    Full size allows you to view your report at the highest magnification for easy reading. The page is larger than a standard VGA Preview tab. When you resize the Preview tab, the report size remains unchanged. All that changes is the amount of the report you can view at one time. You may need to use scroll bars to see all sections of your report.
  • Fit Width
    Fit Width adjusts the width of the report to the width of the Preview tab. When you resize the Preview tab (within realistic limits), the page image resizes as well. To see a larger image, you can expand the window.
  • Fit Page
    Fit Page adjusts the width and the length of the report to let you see a full page of your report in the Preview tab. When you resize the Preview tab (within realistic limits), the page image resizes as well. To see a larger image, you can expand the window.

By default, the selector is set to Fit Width.

Note: All of the functions available in the Preview tab are available at every magnification.

Convert NULL Field to Default

Selecting this check box forces the program to convert any null values to the database field default. Some databases treat a null as zero, some as a blank, and some as a special null value.

Translate DOS Strings

This option is like the Translate DOS Memos option. The only difference is that it is active for string fields instead of memo fields.

Note: If this check box is not selected and you have used upper ASCII characters in your dBASE string fields, the special characters will not be the same in your report as they are in the dBASE string field.

By default, the Translate DOS Strings check box is selected.

Translate DOS Memos

When you insert special characters in dBASE memo fields, you use the upper ASCII character set (those characters with decimal values between 128 and 255). When you insert special characters into Windows programs, you use ANSI codes to do so. If you include upper ASCII characters in dBASE memo fields and then use those fields to create a reports, the program would read the codes and assume they were ANSI codes were it not for the Translate DOS Memos option.

  • When Translate DOS Memos is activated (a check in the check box), the program assumes that any character code it finds is an ASCII code and it translates that code to a corresponding ANSI value so the same character that appears in dBASE appears in your report.
  • When the option is not checked, the program assumes that any character code it finds is already an ANSI code and it does no further translation.

Note: If this check box is not selected and you have used upper ASCII characters in your dBASE memo fields, the special characters will not be the same in your report as they are in the dBASE memo field.

By default, the Translate DOS Memos check box is selected.

Save Data with Report

Select this check box to save the current data with the report.

Save Summaries with Report

Select this check box to save summary information with your report.

Cartesian Product

Use this check box to produce all possible combinations of the original data. This option is not selected by default.

Note: The Cartesian Product option applies to OLAP data sources and does not apply specifically to other direct access data sources. The option ensures a report shows all values of all dimensions (as opposed to all values of the first dimension by one value of the second dimension, which would be the result if the option was not selected).

Perform Query Asynchronously

When this check box is selected, the program uses asynchronous queries. The program normally sends an entire query to the database server. Selecting this option, however, allows the program and the ODBC database server (if it supports asynchronous queries) to transfer data back and forth. An advantage of using this option is you can cancel queries during processing more easily. This option is not selected by default.

Suppress Printing If No Records

Select this option to suppress the printing of a report if that report does not contain any records.

Show All Headers on Drill Down

Use this check box if you would like report drill-down views to included headers for all sections above the drill-down records. This option is not selected by default.

Use Indexes Or Server for Speed

When you select this check box, the program uses available indexes/servers to speed the record selection process.

When you clear this check box, the program selects records without the use of indexes/specified servers (a much slower process).

Note: If an index has a different name than the database it indexes, you need to identify the index for the program. You do this using the Link Options dialog box, which is accessed from the Visual Linking Expert.

Perform Grouping On Server

This check box is only available if the Use Indexes or Server For Speed check box is selected.

Select this check box to have the program perform grouping on the server (server-side processing). Server-side processing allows you to set up a report that performs the majority of its processing on the server and pushes only relevant details to your computer. Server-side processing provides you with a number of benefits:

  • less time connected to the server
  • less memory needed to process the report on your computer
  • lower transfer time from the server to the client.

Server-side processing works only for reports based on SQL data sources (you cannot, for example, use server-side processing for a report based on a query, since a query is not an SQL data source).

This option is not selected by default.

Related topics

Server-side processing

More Report Engine Error Messages

Using this check box tells the program to use more verbose error messages when a Report Engine error occurs.

Case Insensitive SQL Data

This check box specifies whether or not the SQL data you use in the report becomes case sensitive. If the data you are using contains fields where the data is in both upper case and lower case, and you do not wish to categorize the data by this aspect, select this check box.

Note: Case Sensitive SQL data is not supported in the 32-bit standard edition of the program.

Select Distinct Records

Use this option to select only unique records from SQL tables in your database. By selecting this option in the Report Options dialog box, you set the option for the current report. Alternatively, you can set the option for all reports by switching on the Select Distinct Records command on the Database menu.

Select Distinct Data for Browsing

When you browse a field, by default you see the first 500 unique values of the field. You can change this for the current report by clearing this option. If Select Distinct Data for Browsing is not selected, browsing returns the unique values in the first 500 records.

Note: Note that since most SQL servers do not support selecting distinct records for long data types such as memo and blob fields, selecting and browsing distinct records are not supported for such fields.

Create Group Tree

Select this check box to create a Group Tree for use in the Preview tab. Using the Group Tree view, you can drill-down on group data.

Related topics

Report Options command

Options dialog box


Save As dialog box

This dialog box appears when you choose the Save As command from the File menu, you are working on a new report and have not yet saved it and use this dialog box to specify the name (and path) under which you want to save your report file, or you choose the Save command from the File menu while working on a new report that you have not yet saved.

Use the Save As dialog box if you have made changes to an existing report file and you want to save the changed version of your file under a different name. All changes you have made while working on the report will be saved to the new file and your original report file will remain unchanged.

Specify the name, location and type of the file that you are saving.

Related topics

Save As command


Seagate Crystal Report Gallery

This dialog box appears when you choose the New command from the File menu.

Use the Seagate Crystal Report Gallery to select a Report Expert for step-by-step help in creating a report, or create a report from scratch.

If you select the As a blank report option the Data Explorer appears.

You can select one of the following experts:

  • Standard

    The Standard Report Expert guides the creation of a typical report.

  • Form Letter

    The Form Letter Report Expert guides the creation of a letter that combines standard text with customer data.

  • Form

    The Form Report Expert guides the a report with letterhead or log graphics. This is commonly used to create invoices.

  • Cross-Tab

    The Cross-Tab Report Expert guides the creation of a report that contains a summarized grid.

  • Subreport

    The Subreport Report Expert guides the creation of a report that contains a second report. You can either include an existing report or create one.

  • Mail Label

    The Mail Label Report Expert guides the creation of a report with multiple columns. This is commonly used to create a sheet of address labels.

  • Drill Down

    The Drill Down Report Expert guides the creation of a report that displays summarized information and reveals the details when you drill down.

  • OLAP

    The OLAP Report Expert guides the creation of a report that contains a summarized grid based on an OLAP data source.

Note: The Add Index button on each Report Expert opens a standard Windows search dialog box. Use the Attach New Index dialog box to search for the index you'd like to add.

Related topics

Creating the report

Report Expert

Cross-Tab Objects

Subreports

Format Cross-Tab dialog box


Seagate Software Registration Wizard

The Seagate Software Registration Wizard appears when you start Seagate Crystal Reports, or when you choose the Register/Change Address command from the Help menu. Use the Registration Wizard to register your copy of Seagate Crystal Reports.

Once you have registered your copy of the program with Seagate Software, you will receive a registration number. Once you have entered the serial number, the Registration Wizard will no longer appear on startup.

There are two good reasons for registering:

  • registration entitles you to technical support, should you ever require assistance in using the product
  • registration assures you that you will be notified whenever the product is upgraded to offer new features, benefits, and efficiencies.
Related topics

Register/Change Address command

Product registration


Select a Field for Dimension dialog box

This dialog box appears when you click the Select button on the Other Dim Tab of the Insert OLAP Grid Object dialog box.

Use the Select a Field for Dimension dialog box to select a field value for the OLAP Grid other dimension that you have selected in the Insert OLAP Grid Object dialog box.

Field Values

Use this list to select the desired field value for the other dimension.

Related topics

OLAP Report Expert


Set Alias dialog box

This dialog box appears when you choose the Set Alias command from the Database menu. Use the Set Alias dialog box to select an alias that you want to change.

Databases

List the aliases used in the current report. The first alias on the list is selected.

Location

This information box at the bottom of the dialog box displays the referenced table, server type, server name, database and user ID of the selected alias.

Set Alias

Opens the Alias Name dialog box, in which you can change the alias of the selected database.

Related topics

Set Alias command

Using the Set Alias command


Set Default Values dialog box

Use the Set Default Values dialog box to specify the default prompts you want to appear with your parameter field. This dialog box appears when you click the Set default values button in the Create Parameter Field dialog box or the Edit Parameter Field dialog box.

Browse table

Use this list to pick the table you want to browse for fields/values to use for changing the Default Values for your parameter field.

Browse field

Use this list to pick the field you want to browse for values to use for changing the Default Values for your parameter field.

Select or enter value to add

Use the Select or enter value to add box to enter values in the Default Values list. You can type new values in the Select or enter value to add box and then press the add button (>), or you can select a value from the Select or enter value to add list (which will then be placed in the Select or enter value to add box) and then press the add button (>).

Add (>)

Use the add button to move values from the Select or enter value to add box to the Default Values list.

Add all (>>)

Use the add all button to move all values in the Select or enter value to add list to the Default Values list.

Delete (<)

Use the delete button to remove a value from the Default Values list.

Delete all (<<)

Use the delete all button to remove all values from the Default Values list.

Order arrow buttons

Use the Order arrow buttons to move a value up or down in the Default Values list. For example, if you created a value for a new employee, Zoe, and you would like the value Zoe to appear as the default value for the parameter field you are creating. You could select the value Zoe in the Default values list and continue to click that value until it was located at the top of the list, before, for example, the value Alex.

Default Values

Use this list to create a list of default values for the parameter field you are creating. The items you choose for the Default Values list may represent a subset of the items you chose in the Browse Table list and the Browse Field list. For example, if you selected {Customer.REGION} from the Browse Field list, perhaps you might designate AL, CA, and OR as your default values. To add those three values to the Default Values list, you would select the values in the Select or enter values to add list, and then you would click the add button to add the selected values to the Default Values list.

Import pick list

Click this button to import a text file containing a pick list of parameter values.

Export pick list

Click this button to export the pick list of parameter values to a text file.

Define description

Use this option to add a description to any value in the Default Values list. Clicking this button opens the Define Description dialog box.

Length limit

By selecting the Length limit check box for a String value, you can determine the minimum or maximum length for a parameter value entered on the Enter Parameter Values dialog box. This option is not selected by default.

Min Length

Use the Min Length box to limit the minimum number of characters that can appear in your String value parameter field. For example, if you choose the number 4 as your minimum length limit, the name of customer Dan could not be used because it is fewer than 4 characters long.

Max Length

Use the Max Length box to limit the maximum number of characters that can appear in your String value parameter field. For example, if you choose the number 5 as your maximum length limit, the name of customer Margaret could not be used because it is more than 5 characters long.

Edit mask

For a string parameter field, you can choose to enter an Edit Mask in the Edit Mask box, rather than specifying a range. The Edit Mask can be any of a set of masking characters used to restrict the values you can enter as parameter values (the edit mask also limits the values you can enter as default prompting values). For more information on using the Edit Mask, see To define entry type and format using the Edit Mask.

Note: When you enter an Edit Mask, the length options become inactive.

Display

Use the Display list to select how you'd like the Default Values in the Enter Parameter Values dialog box to appear. If you select Value and description, the default values are displayed as the values and their corresponding Descriptions. If you select Description, only the descriptions of the values are displayed.

Order

In the Order list, you can specify whether you want the default values sorted. The sorting order can be alphabetically ascending, alphabetically descending, numerically ascending, numerically descending, DateTime ascending, or DateTime descending.

Order based on

In the Order based on list, you can specify whether to sort default values based on value or description.

Note: If you apply numerical sorting to an alphabetic value or description, the default values will not be sorted.


Set Line Height dialog box

The Set Line Height dialog box enables you to change the line height of the selected text object. It appears when you choose the Change Line Height command from the Format menu.

Use this dialog box to change the line height to the default or by specifying an exact height and descent.

Note: You can also change the line height by dragging the handles of the selected text object.


Set Location dialog box

This dialog box appears when you choose the Set Location command from the Database menu.

Use the Set Location dialog box to specify a new database or a new location for the database used in the report.

Databases

List the aliases used in the current report. The first alias on the list is selected.

Location

This information box at the bottom of the dialog box displays the referenced table, server type, server name, database and user ID of the selected alias.

Set Location

Click this button to specify a different location or file for the selected database. When you click this button, the Data Explorer appears.

Same As Report

Click this button to set the location of the selected database to the same path as the report.

Convert to UNC

Click this button to convert the database field path to a universal naming convention format.

Related topics

Set Location command

Using the Set Location command


Set OLAP Database Location dialog box

This dialog box appears when you click the Set OLAP Cube Location command on the Database menu.

Choose a cube from the list or click Select and then choose an OLAP type from the dialog box.

Related topics

Choose OLAP Type dialog box

Updating an OLAP report


Set Print Date/Time dialog box

This dialog box appears when you choose the Set Print Date/Time command from the Report menu.

Use the Set Print Date/Time dialog box to set the date for your report. You can choose either today's date or specify another date.

Today's Date/Time

Select this check box to use today's date and time as your report date.

Other

Select this check box if you want to use a date other than today's as the report date. When you select this check box, the Year, Month, and Day edit boxes are activated where you can specify the desired print date.

Date

Use the Date list to select a future print date.

Time

Use the Time box to set the print time.


Show SQL Query dialog box

This dialog box appears when you choose the Show SQL Query command from the Database menu.

Use the Show SQL Query dialog box to edit the SQL Query.

The Show SQL Query dialog box displays the SQL query that the program is sending to your SQL server.

The query can have up to four parts:

SELECT

SELECT lists all of the fields used in the report, including fields used in formulas, totals, the sort order, the selection formula, and ranges. For example:

SELECT

DIV_INFO.DIVISION_ID, DIV_INFO.DIVISION_NAME,

DEP_INFO.DEPARTMENT_ID, DEP_INFO.DEPARTMENT_NAME

«Shows that the report is using the DIVISION_ID, DIVISION_NAME, DEPARTMENT_ID, and DEPARTMENT_NAME fields.»

FROM

FROM lists all the tables used in the report, and each table name is followed by an alias name. For example:

FROM

SYSADM.DIV_INFO DIV_INFO,

SYSADM.DEP_INFO DEP_INFO

«Shows that the report is using the DIV_INFO and DEP_INFO tables from the SYSADM database, and in each case, the alias name is the same as the table name.»

WHERE

WHERE specifies any links between tables and field ranges for the report. For example:

WHERE

DIV_INFO.DIVISION_ID = DEP_INFO.DIVISION_ID

«Shows that the DIV_INFO and DEP_INFO tables are linked via the DIVISION_ID fields.»

ORDER BY

ORDER BY sorts the data in alphabetic or numeric ascending or descending order. For example:

ORDER BY

DIV_INFO.DIVISION_ID ASC

«Sorts the records in ascending order by the values that appear in the DIV_INFO.DIVISION_ID field.»

Query

Use this edit box to edit the SQL Query. You can use the cut, paste and copy buttons as editing tools.

Cut

This button is used to cut selected text out of the SQL Query onto the Windows clipboard.

Paste

This button is used to paste text from the clipboard to the current cursor position in the Show SQL Query dialog box.

Copy

This button is used to copy selected text to the Windows clipboard.

Reset

This button undoes any changes you have made to the SQL query, restoring it to what the program had originally created.

Related topics

Show SQL Query command


SQL Expression Editor

The SQL Expression Editor is added to the Field Explorer when you create a report based ODBC data source. The Editor also appears when you choose the SQL Expression Field command from the Insert menu.

Use the SQL Expression Editor to create and edit SQL expressions that can be used in your reports. You can use:

  • fields:
    ({customer.CUSTOMER LAST NAME}, {customer.LAST YEAR'S SALES}, and so on)
  • numbers:
    (1, 2, 3.1416, and so on)
  • text:
    ("Quantity", " ", ":", 'your text', and so on)
  • operators:
    (+, -, and so on)
  • functions:
    (TrimRight (x), Length (x), and so on).

The SQL Expression Editor is used to combine these components into SQL expressions. The SQL Expression Editor allows you to type the components into the SQL expression directly, or, in the case of fields, functions, operators, group field values, and formulas, to select them from lists of those items that are available.

The SQL Expression Editor requires you to enter the various components according to a specific set of rules called syntax. Some examples of rules:

  • text enclosed in quotation marks
  • arguments enclosed in parentheses (where applicable)
  • referenced formulas identified with a leading @ sign, and so on.

The SQL Expression Editor checks the syntax and helps you debug (fix) problems before you enter the SQL expression field into the report.

SQL Expression

You build and edit your SQL expression in the large white SQL Expression box. There are a number of ways you can work with SQL expressions here:

  • you can select individual components from the Fields, Functions, and Operators tree boxes at the top of the SQL Expression Editor, and the program will enter them directly in this box
  • you can type your SQL expression in the box
  • you can use these two methods together
  • you can paste SQL expressions into the box that you cut or copied from other reports or from the Help system
  • you can cut or copy SQL expression text from the box to use in other reports or in printed documents
  • you can paste field values into your SQL expressions via the Browse Field Data button.
New

Click this button to create a new SQL expression field without leaving the SQL Expression Editor.

After you click New, the SQL Expression Name dialog box appears. Type in a name, click OK, and you are returned to the SQL Expression Editor with the name of your new SQL expression present in the Name list.

Save

Click Save to save the SQL expression you created.

Save and close

Click Save and close to save the SQL expression you created and then close the SQL Expression Editor. After clicking Save and close, you are returned to the Field Explorer.

Check

Use this button to test the syntax of your SQL expression and identify syntax errors (if they are any). Check is useful for interim syntax checks while you are building an SQL expression.

Name

The Name list shows all the SQL expression fields created for the report you are currently working on.

Undo

Click Undo to undo the last action performed in the SQL Expression Editor. For example, if you accidentally deleted a part of your SQL expression, you can recover it by clicking Undo.

Redo

Click Redo to have the program redo the last action.

Browse Data

This button lets you review values for the selected field and paste individual values directly into your SQL expression. When you select a field from the Fields Tree box and then click Browse Data, a dialog box appears with a scroll box listing the values for the selected field. The Browse Data dialog box shows:

  • the name of the selected field at the top of the dialog box
  • the data type of the field (number, string, and so on) listed immediately below the field name
  • the length of the field (not the length of the value) listed below the Type Field values listed in the scroll box.

To paste a field value directly into your SQL expression, select the value and click Paste Data (or double-click the value). The value is pasted at the insertion point in the SQL expression.

Find/Replace

Use Find/Replace to search the SQL Expression Editor for a specified word, number, or text string.

Toggle Bookmark

Use Toggle Bookmark to insert a bookmark at the beginning of a selected SQL expression line. After clicking Toggle Bookmark, a blue dot appears at the beginning of the selected SQL expression line.

To remove a single bookmark, position the insertion point in the line of text marked with a bookmark and click Toggle Bookmark. The blue dot disappears from the gray column left of the text line, indicating that the line is not bookmarked.

Bookmarks make it easy to navigate through long SQL expressions, allowing you to write and edit complex SQL expressions efficiently. For example, bookmarks can be used to mark:

  • frequently edited parts of an SQL expression, so you can find them easily when you want to revise the SQL expression
  • major sections of an SQL expression, so you can quickly navigate through long SQL expressions
  • the beginning of important SQL clauses, so you can easily jump from one to the next.
Next Bookmark

Use Next Bookmark to jump between bookmarks in the SQL Expression Editor.

Previous Bookmark

Use Previous Bookmark to jump back to the previous bookmark.

Clear All Bookmarks

Use Clear All Bookmarks to delete all bookmarks in the current SQL expression.

Sort Trees

Use Sort Trees to arrange all fields, functions, and operators in the trees in an alphabetical list.

Field Tree

The Fields Tree contains all the fields you can use in your SQL expressions. By default, Field Tree is activated, allowing you to view field options for your SQL expression. To hide the Field Tree, click the Field Tree button.

Function Tree

The Function tree contains all the functions you can use in your SQL expression. By default, the Function Tree button is activated, allowing you to view function options for your SQL expression. To hide the Function tree, click the Function Tree button.

Operator Tree

The Operator Tree contains all the operators you can use in your SQL expression. By default, the Operator Tree button is activated, allowing you to view operator options for your SQL expression. To hide the Operator Tree, click the Operator Tree button.

Help

Click Help to view on-line help information for the SQL Expression Editor.

Field Tree

This box displays a list of those fields that are available for use in your SQL expressions. You can resize, move, and anchor the Field Tree box, as needed.

Function Tree

This box displays a list of functions available for use in the SQL expression. When you select a function from the list, the program inserts it in the SQL expression at the insertion point To make your work easier, the function is inserted complete with its required syntax items (parentheses, commas, quotation marks, and so on) and the insertion point is moved to the point where you need to enter the first argument (if arguments are required).

You can resize, move, and anchor the Function Tree box, as needed.

Operator Tree

This box displays a list of operators available for use in the SQL expression. When you select an operator from the list, the program inserts it in the SQL expression at the insertion point.

You can resize, move, and anchor the Operator Tree box, as needed.


SQL Expression Name dialog box

Use the SQL Expression Name dialog box to enter a name for a SQL expression field you are creating.

New Name

Use this box to enter a name for a new SQL expression field you are creating.

Then click OK to open the SQL Expression Editor. You can use the SQL Expression Editor to enter the SQL expression.


Subreport Links dialog box

This dialog box appears when you choose the Subreport Links command from the Edit menu, or when you right-click the subreport object and choose the Change Subreport Links command from the shortcut menu that appears.

Use the Subreport Links dialog box to specify the field in the parent report that will serve as the link field to the data in the subreport.

For Subreport

Use this list to select the subreport that you want linked to the data in the container report. This list is active only if you have multiple subreports.

Available fields

The Available fields box lists all of the fields available in the container report to which you can link your subreport.

Add (>)

Click the Add button (>) to copy a field from the Available Fields box into the Field(s) to link to box.

Remove (<)

Click the Remove button (<) to remove a field from the Field(s) to link to box.

Field(s) to link to

The Field(s) to link to box displays the currently selected fields to which you intend to have your subreport link.

Subreport parameter field to use

The Subreport parameter field to use list appears when the Field(s) to link to box contains at least one field name. Use the Subreport parameter field to use list to determine the subreport field on which the container report and the subreport are linked.

Select data in subreport based on field

Use the Select data in subreport based on field check box to activate the Select data in subreport based on field list.

After you select this check box, choose a field from the list below to organize the subreport data based on a specific field. Clear this check box to have the subreport adopt the organization used in the primary report.

Related topics

Subreport Links command

Subreports


Symbol Style dialog box

The Symbol Style dialog box appears when you click Graduated on the Type tab of the Map Expert and then click Customize. The Symbol Style dialog box offers a variety of formatting and style options for your Graduated map symbol, including:

  • font type
  • font size
  • symbol options
  • color
  • rotation angle
  • background options
  • effects options.
Font

Use this list to change the font of your Graduated map symbol. The default font is Arial.

Font size

Use this list to change the font size of your Graduated map symbol. The default font size is 18.

Symbol

Use this list to change the symbol for your Graduated map. You have 224 symbols to choose from.

Color

Use this list to change the color of the symbol for your Graduated map.

Sample

The sample to the right of Font, Symbol, and Color shows you how the symbol for your Graduated map is affected by changes you make in the Symbol Style dialog box.

Rotation Angle

Use this box to change the rotation angle of your symbol as it appears on the Graduated map.

None

Use this option to display your Graduated map symbol without a background.

Halo

Use this option to display your Graduated map symbol with a Halo background.

Note: Halo backgrounds are most effective when the background color greatly contrasts the symbol color. For example, a white or yellow halo background will give a true halo effect to a navy blue symbol.

Box

Use this option to display your Graduated map symbol in a colored-background box.

Color

Use this list to select the background color for your Graduated map symbol.

Effects options

Use these check boxes to apply the following effects to your Graduated map symbol:

  • Bold
  • Italic
  • Drop Shadow.


Table Description dialog box

The Table Description dialog box is primarily a read-only dialog box that provides information on any table displayed in either the Visual Linking Expert or the Choose Tables To Use In Visual Linking dialog box.

  • To call up the dialog box from the Visual Linking Expert, double-click on any field in the table or right-click the field and then choose Description from the shortcut menu.
  • To call up the dialog box from the Choose Tables To Use In Visual Linking dialog box, select the table of interest and click the Table Description button.

Use the Table Description dialog box to get detailed information on the fields and indexes in the selected table.

Indexes section.

This section contains two lists and an Add and a Delete button.

  • The box on the left indicates all the indexes that the program has identified as being connected to the selected table. You can select any index in this box by clicking the index.
  • The box on the right indicates those fields that are components of the index currently selected in the box on the left.
Fields section

This section describes the following about a selected field:

  • if the field is part of an index
  • the field description
  • the field data type and length.

The fields section contains two lists and a Browse button.

  • The box on the left indicates all the fields in the selected table. You can select any field in this box by clicking on the field name.
  • The box on the right gives a description of the field and indicates if it is a component of any index.
  • When you click the Browse button, the program calls up a dialog box that indicates the name and source of the selected field, the field type, and the field length. It also displays a list of values in the selected field.
Related topics

Choose Tables To Use In Visual Linking dialog box

Visual Linking Expert


Technical Support Request dialog box

This dialog box appears when you choose the Technical Support Request command from the Help menu.

Use the Technical Support Request dialog box to request assistance with Seagate Crystal Reports from the technical support department.

You can fill out the technical support request form, print it out, and then FAX it or mail it to the technical support department for a timely response.

Related topics

Technical Support Request command

Technical support


Text Format dialog box

This dialog box opens when you double-click a text object (to put it in edit mode), right-click, and choose the Change Font, Paragraph Formatting, or Set Tabs command from the shortcut menu that appears.

Use the Text Format dialog box to change font types/styles, format paragraphs, and set tabs for a text object.

The Text Format dialog box has three tabs: Font, Paragraph Formatting, and Tabs.

Font tab (Text Format)

Use the Font tab of the Format Editor to change the fonts, the font size, and the font style for text and data fields on your reports.

Font

This list contains all the fonts that you have installed for your system. The list appears with the font that is currently in use selected.

Style

This list contains four additional attributes that you can assign to the selected font. The list appears with the style that is currently in use selected.

  • Regular
    the standard, unmodified style
  • Bold
    changes the font to boldface
  • Italic
    changes the font to italic
  • Bold Italic
    changes the font to Bold Italic.
Size

This list includes common point sizes for the selected font. The list appears with the point size that is currently in use selected.

Color

Select the desired color from this list if you want to add color to the font.

Strikeout

When you select this check box, the program prints the strikeout character across the font.

Underline

When you select this check box, the program underlines characters typed in the selected font.

Character spacing exactly

Use this option to specify the value that each character in your selected font occupies. The value is defined as the distance in number of points measured from the start of one character to the start of the next. When you change the character spacing, you change only the spacing between adjacent characters, not the font size of the characters.

For example, if you specify a 14-point font with a character spacing of 14 points, each character will remain as a 14-point font size, occupying a space that is 14 points wide.

Paragraph Formatting tab (Text Format)

Use the Paragraph Formatting tab of the Format Editor to set formatting options for paragraphs in a text object.

First Line

Enter the distance in inches (or the default measurement for your report) that you want the first line of the paragraph to be indented from the left margin of the page.

Left

Enter the distance in inches (or the default measurement for your report) that you want the paragraph to be indented from the left margin of the page.

Right

Enter the distance in inches (or the default measurement for your report) that you want the paragraph to be indented from the right margin of the page.

Line spacing

Enter the spacing you want for lines as a multiple of the font size you are using, or as an exact number of points.

Of

Use this box to enter the multiple you want to use (if you selected Multiple for Line Spacing), or the number of points (if you selected Exact for Line Spacing).

Text interpretation

Use this list to select the type of pre-formatted data (string or memo fields only) or text you are inserting in a field. Seagate Crystal Reports extracts information about the font, size, style, color, and paragraph and displays the data or text with the specified attributes.

Your choices are:

  • "none" to interpret the string or memo field or imported text as if it contains plain text
  • "RTF Text" to interpret the string or memo field or imported text as if it contains Rich Text Format data
  • "HTML Text" to interpret the string or memo field or imported text as if it contains HTML data.

Tabs tab (Text Format)

Use the Tabs tab to set, delete, modify and edit tabs in a text object.

Tab Stop Position box

Enter the desired tab stop position in this box. Tab stops are measured in inches.

Alignment options

Choose from four alignment option for the selected tab stop: left, right, center, and decimal.

Set button

Once you have entered a tab stop position into the Tab Stop Position box, click this button to set it.

Delete button

When you click this button, the selected tab stop is deleted.

Delete All button

When you click this button all the defined tab stops are deleted.

Note: The unit of measurement used in the dialog box (inches or centimeters) is based on the Regional setting in the Windows Control Panel (for example, English(United States) gives inches, English(United Kingdom) gives centimeters).


Toolbars dialog box

Use the Toolbars command to show or hide toolbars. There are four toolbars to choose from: Standard, Formatting, Supplementary Tools, and Analyzer Tools. Use the check boxes provided to show any or all of the toolbars.

Large buttons

Select this option to view the buttons on the toolbar in a larger format and font.

Show ToolTips

Select this check box to have the program show tool tips for the buttons on the toolbar. Tool tips appear with the name of the button when you leave your mouse pointer over a button for a few seconds. This check box is selected by default.

Related topics

Standard toolbar

Formatting toolbar

Supplementary Tools toolbar

Analyzer Tools toolbar


Welcome to Seagate Reports dialog box

This dialog box appears whenever you run Seagate Crystal Reports, unless you clear the Show welcome dialog at startup check box. You can also open this dialog box by choosing the Welcome Dialog command from the Help menu.

Use the Welcome to Seagate Reports dialog box to specify whether you would like to create a new report from scratch, open an existing report, or cancel the action.

Using the Report Expert

Click this button to create a new report using one of the report experts. The Seagate Crystal Report Gallery appears where you can select an expert to help you create your report.

Asa blank report

Click this button to create a new report from scratch. Choose the data on which to base your report from the Data Explorer.

Open an existing report

Click this button to open an existing report. An Open dialog box will appear where you can select the desired report and click OK to open it.

Show welcome dialog at startup

Select this option to have Seagate Crystal Reports show the Welcome dialog on startup.

If this option is not selected, the Welcome dialog will not appear on startup. Clear this option to have Seagate Crystal Reports show the Welcome dialog each time on startup.


Experts

This section describes the experts available in Seagate Crystal Reports.


Overview

The program includes a number of Experts that help you create several kinds of reports, prepare graphs, set up the overall report format, link related databases, select records and groups for inclusion in the report, and gather the files you need to include when you distribute the report with step-by-step instructions.

In some cases, Experts have a series of tabs numbered Step 1, Step 2, and so on. To use this kind of Expert, simply begin at Step 1 and proceed to the last step. When you have completed the last step, the Expert will do the rest of the work. It's that easy!

Some of the other Experts do not use the tab system. To use this kind of Expert, simply follow the instructions in the dialog boxes that appear and the Expert will lead you through otherwise complex procedures with a minimum of effort.


Report Expert

The Report Expert appears when you click the New button from the Standard toolbar and then choose one of the built-in Report Experts from the Seagate Crystal Report Gallery or when you choose the Report Expert command from the Analyzer menu.

Each Report Expert consists of several tabs that lead you through step-by-step instructions for creating the specified report.

There are eight Report Experts:

  • Standard Report Expert
  • Form Letter Report Expert
  • Form Report Expert
  • Cross-Tab Report Expert
  • Subreport Expert
  • Mail Label Report Expert
  • Drill Down Report Expert
  • OLAP Report Expert.

Each Expert guides you through the creation of a report by providing a series of tabs. Many of the experts have tabs unique to a specific type of report. For example, the Mail Label Expert has a tab that allows you to specify the type of mailing label you want to use.

The following sections describe the options and tabs available in the report experts.


Report Expert options

Design Report

When you are finished designing the report, you can click the Design Report button to view the report template in the Design tab of the Seagate Crystal Reports window. By viewing the report in the Design tab, instead of the Preview tab, you avoid immediately requesting data from the database. This option is helpful for Power users that want to quickly customize the look of the report without waiting for the program to obtain all of the report data. This is also useful if the report is based on a very large database and takes a long time to collect and display all data in the Preview tab.

Preview Sample

Click the Preview Sample button to display a report using either all the data from the database or only a small selection of data. The report is generated and displayed in the Preview tab. This option is useful when you want to design and work with the report layout without having to wait for all data to be generated. Some reports can take long periods of time to be generated, forcing you to wait to preview and edit the layout. By previewing only a sample of the entire database, you save time and effort creating your report.

Each of the tabs on the report experts is described in the following sections.


Data tab

The Data tab appears in the Report Expert when you click any of the Expert buttons in the Seagate Crystal Report Gallery when creating a new report.

Use the Data tab to select the data source and tables (databases in Essbase terminology) and add indexes to tables in your new report.

Data Sources

The available data sources are shown as buttons. To select a data source, click the corresponding button.

Tables

Once you have chosen the desired data source, the tables (databases in Essbase terminology) will be listed here.

Remove

Click this button to delete a table (database in Essbase terminology) selected in the Tables list.

Add Index

Click this button to add an index to a PC-type database (datafile). Indexes are used for linking.


Links tab

The Links tab appears in the Report Expert when you have two or more tables (databases in Essbase terminology) selected for use in creating a new report.

Use the Links tab to link tables (databases in Essbase terminology) in your new report.

The Links tab has the same functionality as the Visual Linking Expert.


Fields tab

Use the Fields tab to select the fields you want included in a report.

Available Fields

This list displays all of the fields available for use in your report.

Fields to Display

This list displays all of the report fields presently active in the report.

Add ->

Click this button to add a selected field from the Available Fields list to the Fields to Display list.

Add All ->

Click this button to add all of the fields listed in the Available Fields list to the Fields to Display list.

<- Remove

Click this button to remove a selected field from the Fields to Display list.

<- Remove All

Click this button to remove all the fields from the Fields to Display list.

Browse Data

Click this button to browse the data of the field that is selected in the Fields to Display list.

Formula

Click this button to create a new formula for the report.

Column Heading

Type in the desired column heading into this edit box.

Find Field

Use this button to search for a specific field in the Database Fields scroll box. You will find the Search field button useful to find a specific field from a list of database fields.

Order

Use the Order buttons to move a selected field up or down in the Report fields list. Fields that appear higher in the Report fields list are placed closer to the left margin on the report. In other words, they are given a higher priority.


Group tab

Use the Group tab to specify how fields will be grouped on the report. Records will be sorted by their values on the group by fields.

Available Fields

This list displays all of the fields available for use in your report.

Browse Data

Click this button to browse the data of the field that is selected in the Available Fields list.

Group By

This list displays all of the fields that will be used for grouping data.

Add ->

Click this button to add a selected field from the Available Fields list to the Group By list.

<- Remove

Click this button to remove a selected field from the Group By list.

Order

Use the Order buttons to move a selected field up or down in the Group By list. Fields that appear higher in the list are given a higher priority.

Sort Order

Click in ascending order to sort the values for the field selected in the Group By box in ascending (A to Z, 1 to 9) order.

Click in ascending order to sort the values for the field selected in the Group By box in descending (Z to A, 9 to 1) order.

Click in original order to leave the values for the field selected in the Group By box in their original order.

Click in specified order to specify exactly how the fields will be ordered.

These options are only available when fields are listed in the Group By list.

New Named Group

Click this button to create a new group in the Define Named Group dialog box.

This button is only available when in specified order is selected in the Sort Order list.

Field values

Lists the field values for the field selected in the Group By list. Click a value to create a new group based on the value.

This list is only available when in specified order is selected in the Sort Order list.

Edit Named Group

Click this button to change the settings for a group in the Define Named Group dialog box.

This button is only available when in specified order is selected in the Sort Order list.

Add

Type a group name in the list, then click this button to create it.

This button is only available when in specified order is selected in the Sort Order list.

Del

Click this button to delete the selected group.

This button is only available when in specified order is selected in the Sort Order list.

Others

Click this button to organize the values that do not belong to any group in the Others dialog box.

This button is only available when in specified order is selected in the Sort Order list and at least one group exists.


Total tab

Use the Total tab to choose fields to be subtotals, counted, and so on.

Available Fields

This list displays the report fields available for totaling in the report.

Summarized

This list displays the total fields currently in use in the report.

Add ->

Click this button to add the selected field from the Report Fields list to the Total Fields list.

<- Remove

Click this button to remove the selected field from the Total Fields list.

Browse Data

Click this button to browse the data in the field selected in the Report Fields list.

Summary Type

Click a summary function for the field selected in the Summarized list.

Percentage of

Select this check box, then click a summary field in the list to show the summary value for the current grouping as a percentage of the summary value for another grouping.

Add Grand Totals

Select this check box to include Grand Totals in a report.

Related topics

Summary functions

Sorting, Grouping, and Totaling


Top N tab

Use the Top N tab to choose fields to sort and group information in your report by.

For this group

Select a sorting option:

  • Sort All groups
  • Sort the Top N groups
  • Sort the Bottom N groups
based on

Displays a list of summary fields in your report. Select the field you want to sort on from this list. When Sort All groups is selected, use the scroll box below the based on list to see the fields chosen for sorting.

where N is

Type the number of Top N or Bottom N groups to sort.

include other groups with the label

Select this option if you want to include all fields that do not fit into your Top N or Bottom N selection under a specified group name. Type the group name you want all fields that do not fit into your Top N or Bottom N selection to appear under.

Delete

Click this button to delete the selected summary field. This is only available when Sort All groups is selected.

Ascending/Descending

Select the Ascending option to sort the fields in ascending (A to Z, 1 to 9) order.

Select the Descending option to sort the fields in descending (Z to A, 9 to 1) order.

Related topics

Sorting, Grouping, and Totaling


Drill tab

Use the Drill tab to summarize data even further by choosing which section you want hidden in a report.

Section

This list displays all of the sections currently in use in a report. Before the section name are the words show or hide indicating the status of the section.

  • To show a hidden section, click the section. Its Hide status will change to Show.
  • To hide a section that is showing, click the section. Its Show status will change to Hide.
Related topics

Using the drill-down option on summarized data


Chart tab

Use the Chart tab to insert a graph or chart into a report.

This tab has the same functionality as the Chart Expert.

Related topics

Charting


Select tab

Use the Select tab to choose fields to select (or filter) records in a report. By selecting records in this manner, you can improve the speed of a report.

Available Fields

This list displays the report fields currently available for selection in your report.

Select Fields

This list displays the fields currently selected in your report.

Add ->

Click this button to add the field selected in the Report Fields list to the Select Fields list.

<- Remove

Click this button to remove the selected field from the Select Fields list.

Browse Data

This button appears when you add a field to the Select Fields list. Click this button to browse the data in the field selected in the Select Fields list.

Scroll Box

This scroll box is a dynamic box. Different data types and selection criteria change Expert options.

Using the scroll box, select the condition that best finishes this sentence:

"I want to select all records where the value in the field I have selected is"

You can select primary conditions, date conditions or boolean conditions, depending on the type of field you have selected.

Delete

Click this button to remove the selected item from the list. This button is only available when is one of is selected.

Related topics

Select Expert


Subreport tab

Use the Subreport tab to insert a subreport into a report.

This tab has the same functionality as the Insert Subreport dialog box.

Related topics

Subreports


Style tab

Use the Style tab to insert a report title and choose a style for the report.

Title

Type a title for the report.

Style

This box displays the formatting styles available for use in your report. Select the desired style from the list.

Sample Preview

This box displays a sample of the style selected in the Style list.

Add a picture

Click this button to specify a picture file for the report.

Related topics

Formatting

Report Style Expert


Form Letter tab

Use the Form Letter tab to add and delete fields and set the formatting properties of a form letter report.

Section

This list displays all of the report sections currently available for use in a form letter report.

Available Fields

This list displays a list of all the database fields available for use in a form letter report.

Browse Data

Click this button to browse the data in the field selected in the Database Fields list.

Add to Text

Click this button to add the selected field in the Database Fields list to the Form Letter Fields list.

Form Letter Edit box

This list displays all the fields currently in use in a form letter.

Import Text

Click this button to import already prepared text for use in your Form Letter report. When you click this button, an Open dialog box appears where you can choose the desired text file.

Format Text

Click this button to set the formatting properties for a Form Letter report. When you click this button, the Rounding tab (Format Editor) appears where you can set paragraph, font and tab options.

Delete

Click this button to remove the selected field from the Form Letter Fields list.

Related topics

Creating a form letter using a text object


Cross-Tab tab

Use the Cross-Tab tab to create and format a cross-tab object for your report.

This tab has the same functionality as the Cross-Tab Group Options dialog box.

Columns

This list displays the fields that you have selected as column headings for your cross-tab. If you have multiple column headings, they will appear on your report in the order in which they appear on this list.

To add a column heading to this list, select a field from the Available Fields list and then drag it onto the list, or click the Add Column button.

Rows

This list displays the fields that you have selected as row headings for your cross-tab. If you have multiple row headings, they will appear on your report in the order they appear on this list.

To add a row heading to this list, select a field from the Available Fields list and then drag it onto the list, or click the Add Row button.

Summarized Fields

This list displays the fields that you have selected as summarized field headings for your cross-tab. If you have multiple summarized field headings, they will appear on your report in the order they appear on this list.

To add a summarized field heading to this list, select a field from the Available Fields list, then drag it onto the list, or click the Add Summarized Field button.

Available Fields

This list displays all the tables and fields that you have activated for use in the report.

Select the field you want to use and drag it into the appropriate list, or click the appropriate Add button. Repeat this process to add additional fields.

Add Row

Click this button to add row headings to your cross-tab. Fields selected in the Available Fields list are moved to the Rows list.

Add Column

Click this button to add column headings to your cross-tab. Fields selected in the Available Fields list are moved to the Columns list.

Add Summarized Field

Click this button to add summarized fields to your cross-tab. Fields selected in the Available Fields list are moved to the Summarized Field list.

Remove

Click this button to remove the selected heading or summarized field from your cross-tab.

Group Options

When you click this button, the Cross-Tab Group Options dialog box appears. Use this dialog box to enter a group for your cross-tab. Group Options is available only for rows and columns.

Change Summary

When you click this button, the Change Summary Operation dialog box appears. Use this dialog box to change the summary type of the cross-tab's summarized fields. Change Summary is available only for summarized fields.

New Formula

When you click this button, the Formula Name dialog box appears. Enter a name for your new formula and then click OK. The Formula Editor appears so you can create the new formula.

Edit Formula

When you click this button, the Formula Editor appears. Use the Editor to edit the selected formula. Edit Formula is available only when a formula field is selected in one of the lists.

Browse

Use Browse to view the values for a field you have selected in the Available Fields or Summarized Field lists.

Related topics

Cross-Tab Objects


Form tab

Use the Form tab to format your form and add bitmaps.

Section

This list displays a list of all the report sections currently available for use in your report.

Add Picture

Click this button to add a bitmap to the section chosen in the Sections list. The bitmap will be previewed in the preview window.

Delete Picture

Click this button to delete the bitmap previewed in the preview window.

Preview Window

This window shows a preview of the contents of the currently selected section in the Sections list.


Label tab

Use the Label tab to set up mailing label options. The Mail Label tab is a powerful panel of control, enabling you to print data on virtually any labels that are commercially available for line printers (dot matrix) or page printers (laser, ink jet). Use the settings and formatting commands to fine-tune your printing so the labels come out just the way you want them.

The Mail Label tab offers two ways to set up labels:

  • automatically, by Avery label number, and
  • manually.
Automatically, by Avery label number

To make your work easier, the program comes with preset templates for the most popular Avery labels. Those labels are listed, by number, in the Mailing Label Type list.

  1. Click the scroll arrow and scroll down to see if the Avery Label you are using is listed.
  2. If it is, select the number and the program will automatically set up the specifications for that label.
  3. Click OK when finished.
Manually

If your label is not displayed in the Mailing Label Type list, you need to use the various settings on the Mailing Labels tab to set up the label manually. Select the User-Defined Label option from the list and change the remaining dialog box settings to conform to the label you are going to use.

Mailing Label Type

This list displays a list of the preset templates for most Avery labels as well as a User-Defined Label option to create custom label sizes.

Mailing Label Size

These edit boxes enable you to specify the dimensions (height and width) of one label. This information can usually be found on the box or folder the labels come in. Simply enter the height and width values in the respective edit boxes.

Note: The unit of measurement used in the dialog box (inches or centimeters) is based on the Measurement setting in the International section of the Windows Control Panel (English = inches, Metric = Centimeters).

Gap Between Labels

These edit boxes enable you to specify the empty area (gap, gutter, and so on) between labels. Simply measure the gaps and then enter the horizontal and vertical values in the respective edit boxes.

  • Horizontal
    The gaps between labels going across the page. One-up (one across) labels don't have any horizontal gaps.
  • Vertical
    The gaps between labels going down the page.

Note: The unit of measurement used in the dialog box (inches or centimeters) is based on the Measurement setting in the International section of the Windows Control Panel (English = inches, Metric = Centimeters).

Page Margins

These edit boxes enable you to set the top, bottom, left, and right margins of your page. Simply measure the margins and enter the values in the respective edit boxes.

Note:

  • All margins are figured from the edge of the paper. For example, a setting of .5 inches sets a half-inch margin.
  • You cannot use page margin settings to set the paper size; you must set the paper size via the Paper Size list in the Print Setup dialog box.
  • The unit of measurement used in the dialog box (inches or centimeters) is based on the Measurement setting in the International section of the Windows Control Panel (English = inches, Metric = Centimeters).
Printing Direction

The Printing Direction section enables you to specify the path that the program follows when printing the data on your labels.

  • Across then Down
    Prints data left to right across the first row of labels, then across the second row, and so on.
  • Down then Across
    Prints data down the first column of labels, then down the second column, and so on.
Number of Labels

This information box displays the maximum number of labels that can print across the page and the maximum number that can print down the page based on your settings in the Page Margins, Mailing Label Size, and Gap Between Labels edit boxes and paper size (which is setup in Windows' Control Panel).

Note:

  • The program displays only the number of complete labels it can print. For example, if it determines that there is space available to print 2.75 labels across the page, it displays 2 as the Across Page setting and prints only two labels across the page.
  • If you want to print fewer labels across than the number calculated (fewer columns), increase the size of the right margin, left margin, or horizontal gap until the calculation changes to the number across that you want.


Data tab (OLAP)

Note: The same Data tab also appears in the Format OLAP Grid dialog box and Insert OLAP Grid Object dialog box.

Use the Data tab on the OLAP Report Expert to give specific information about your OLAP data source:

  • the specific cube you intend to report on,
  • the connection to the cube,
  • the name of the database, and
  • the type of OLAP data source.

Note: You will not be able to proceed beyond the OLAP Data tab until you have properly selected an OLAP cube. Furthermore, working with OLAP data requires a previous understanding of the OLAP concept. Make sure you are familiar with OLAP concepts and your OLAP software before attempting to design OLAP-based reports. If you have questions, please contact your System Administrator.

Server Type

When you click this button, the Choose OLAP Type dialog box appears, prompting you to choose the OLAP type you are searching for.

Note: This option is only available via the OLAP Report Expert.

Cube

This list specifies which cube you are currently working on.

Type

This information box specifies what kind of data you are using.

Database

This information box tells you the directory where the cube data is located.


Rows/Columns tab (OLAP)

The Rows/Columns tab allows you to choose dimensions and fields for display in the grid.

Dimensions

Use this list to select dimensions for the object.

Columns

This list displays the column dimensions.

Rows

This list displays the row dimensions.

Add Column

Use this button to add a selected dimension to a column.

Add Row

Use this button to add a selected dimension to a row.

Remove

Use this button to remove a selected dimension from either the row or column dimension.

Use Long Field Names

Use this check box to include long field names in your OLAP Grid object. If you clear this check box, the program will use short field names, such as PR01 and PR02 instead of Racing Bicycles and Mountain Bikes.


Filter/Page tab (OLAP)

The Filter/Page tab allows you to choose what to do with other dimensions that are not rows/columns in the grid. The Filter list displays all of the dimensions you did not use in the Rows/Columns tab. The Filter/Page tab lets you specify how dimensions that do not appear in the grid will affect the data for the dimensions that do appear in the grid.

Filter

Choose one field from each of the dimensions. The dimensions will be set to these fields in the grid.

Move (< >)

Click these buttons to move selected dimensions between the Filter and Page lists.

Order

Click the up and down arrow buttons to change the order of the Filter and Page dimensions.

Page

Choose multiple fields from each of the dimensions. A separate grid will be created for each field.

Select

Use this button select the fields you want displayed for a filter or page dimension.

When you click this button, the Select a Field for Dimension dialog box appears.

The field you select for a filter dimension appears to the right of that dimension.


Style tab (OLAP and Cross-Tab)

Use the Style tab to choose a style for your report.

This tab appears on the Cross-Tab Report Expert and on the OLAP Report Expert. It also appears on the Format OLAP Grid Object dialog box and the Format Cross-Tab dialog box.

Style

This box displays the formatting styles available for use in your report. Select the desired style from the list.

Sample Preview

This box displays a sample of the style selected in the Style list.


Customize Style tab (OLAP and Cross-Tab)

Use the Customize Style tab to format a grid with background color, gridlines and cell margins.

Note: The Customize Style tab only formats the primary grid dimensions you have selected in the Rows/Columns tab.

Columns

This list displays the dimension and levels used as the column aspect in the grid.

Rows

This list displays the dimension and levels used as the row aspect in the grid.

Background Color

Use this list to select a color for the selected row or column level.

Alias for formulas

Type the alias for the selected dimension. Shortened dimension names can be useful when building conditional formatting formulas.

Show Cell Margins

Select this check box to expand column widths to show all the grid. If you clear the checkbox, column widths will be uniform and some data will be hidden behind the grid.

Indent Row Labels

Select this check box then type the indentation measurement for row labels in the box. This can be as long as two pages.

When you specify an indentation, all row labels, except the label for the input member of the first level will be indented by the same amount.

Repeat Row Labels

Select this check box to repeat row labels on every page for grids that print across more than one page.

Keep Columns Together

Select this check box to keep columns together on every page for grids that print across more than one page.

Row totals on Top

Select this check box to display totals on the top (relative to the corresponding row input member).

Column totals on Left

Select this check box to display place column totals on the left (relative to the corresponding column input member).

Suppress Empty Rows

Select this check box to suppress empty rows for the OLAP Grid object. If you clear the checkbox, empty rows will be shown in the OLAP Grid object.

Suppress Empty Columns

Select this check box to suppress empty columns for the OLAP Grid object. If you clear the checkbox, empty columns will be shown in the OLAP Grid object.

Format grid lines

Click this button to specify settings for the grid lines in the Format grid lines dialog box.

Type the amount of space between the left edge of the report page and the label in the Horizontal gap box.


Labels tab (OLAP)

Use the Labels tab to define which dimensions are labeled and how they are displayed in the grid.

Unlabeled Dimensions

Displays the dimension that will not be labeled on the grid.

Labeled Dimensions

Displays the dimensions that will be labeled on the grid.

Move (< >)

Click these buttons to move selected dimensions between the Unlabeled and Labeled lists.

Move all (<< >>)

Click these buttons to move all the dimensions between the Unlabeled and Labeled lists.

Order

Click the up and down arrow buttons to change the order of the Labeled dimensions.

Label Position

Click Top to display labels at the top of the grid object.

Click Left to display labels to the left of the grid object.

Click Don't display labels to hide labels.

Label Spacing

Type the amount of space between the top edge of the grid object and the label in the Vertical gap box.


Standard Report Expert

The Standard Report Expert is the most generic of the experts. It provides eight tabs, many of which are common to the other Report Experts. The Standard Report Expert guides you through choosing a data source and linking database tables. It also helps you add fields and specify the grouping, summarization (totals), and sorting criterion you want to use. Finally, the Standard Report Expert leads you through chart creation and record selection.

The Style tab contains pre-defined layouts for you to apply to your report to give it more impact.

The Standard Report Expert has the following tabs:

  • Data tab
  • Fields tab
  • Group tab
  • Total tab
  • Top N tab
  • Chart tab
  • Select tab
  • Style tab


Form Letter Report Expert

The Form Letter Report Expert offers an easy solution for creating form letters that use your database as a source of client information. The expert contains much of the functionality of the Standard Report Expert, but has a Form Letter tab that lets you define the text and database fields that will appear in each section of your letter. You can also use the Form Letter tab to import text you have created in another application.

The Form Letter Report Expert has the following tabs:

  • Data tab
  • Fields tab
  • Group tab
  • Total tab
  • Select tab
  • Form Letter tab


Form Report Expert

The Form Report Expert lets you create reports that can be printed on pre-defined forms (company invoices, statements, and so on). This expert is much like the Standard Report Expert, but features a Form tab where you choose images of your company logo or forms. Logos and forms can be applied to header or details sections so your report data prints in the appropriate location on your report.

The Form Report Expert has the following tabs:

  • Data tab
  • Fields tab
  • Group tab
  • Total tab
  • Select tab
  • Form tab


Mail Label Report Expert

The Mailing Labels Report Expert lets you create a report that is formatted to print on any size mailing label. You can use the Label tab to select a commercial label type, or you can define your own layout of rows and columns for any multi-column style report.

The Mail Label Report Expert has the following tabs:

  • Data tab
  • Fields tab
  • Label tab
  • Select tab


Cross-Tab Report Expert

The Cross-Tab Report Expert guides you through the creation of a report in which your data is displayed as a cross-tab object. Three special tabs (Cross-Tab, Style, and Customize Style) help you create and format the cross-tab itself.

The Cross-Tab Report Expert has the following tabs:

  • Data tab
  • Cross-Tab tab
  • Style tab
  • Customize Style tab (OLAP and Cross-Tab)
  • Chart tab
  • Select tab


Subreport Expert

The Subreport Expert lets you create a main report and a subreport at the same time. The expert offers all the Standard Report Expert's flexibility for creating the main report. On the additional Subreport tab, you can choose an existing report to use as the subreport, or you can create a new report. New subreports are created by repeating the steps used in the Standard Report Expert.

The Subreport Expert has the following tabs:

  • Data tab
  • Fields tab
  • Group tab
  • Total tab
  • Top N tab
  • Chart tab
  • Select tab
  • Subreport tab
  • Style tab


Drill Down Report Expert

The Drill Down Report Expert guides you through the creation of a report that hides sections and makes them available for viewing only though drill down. The expert offers all the functionality of the Standard Report Expert. The Drill tab displays a list of sections that can be hidden. Hidden sections don't appear on your report until you click the appropriate field. Hidden data can be used for summaries and totals.

The Drill Down Report Expert has the following tabs:

  • Data tab
  • Fields tab
  • Group tab
  • Total tab
  • Top N tab
  • Drill tab
  • Chart tab
  • Select tab
  • Style tab


OLAP Report Expert

The OLAP Report Expert lets you create a report in which your OLAP data is displayed as a grid object. Although similar to the Cross-Tab Report Expert in several ways, the OLAP Report Expert appears to be different due to the requirements of working with OLAP data sources. You first specify the location of you OLAP data, and then you choose the dimensions you want to include in the grid. Next you filter the report data and choose and customize the style of the grid object. Finally, you can define labels for your grid and insert a chart, if you wish.

The Format OLAP Grid Object dialog box has the same functionality as the OLAP Report Expert and appears when you right-click a grid object then click Format OLAP Grid on the shortcut menu.

The Insert OLAP Grid Object Expert has the same functionality as the OLAP Report Expert and appears when you click the OLAP Grid command on the Insert menu.

The OLAP Report Expert has the following tabs:

  • Data tab (OLAP)
  • Rows/Columns tab (OLAP)
  • Filter/Page tab (OLAP)
  • Style tab (OLAP and Cross-Tab)
  • Customize Style tab (OLAP and Cross-Tab)
  • Labels tab (OLAP)
  • Chart tab


Chart Expert

The Chart Expert appears:

  • when you click the Insert Chart button on the Standard toolbar, or
  • when you choose the Chart command from the Insert menu.

Use the Chart Expert to prepare graphs for use in a report. When the Chart Expert appears, the Type tab is active.

Related topics

Editing charts using the Chart Expert


Type tab

The Type tab offers a choice of eleven different chart types to insert in a report. Click the button of the type of chart you want, and the program begins the construction of a chart of that type which you can further customize.

Chart Type

Use the Chart Type list to select the chart type you want to use. Once a chart type is selected, you can use the buttons to the right of the list to select the chart type format to use for the chart. For example, if you select the Pie Chart as the chart type, you can then select from among the following formats: Regular pie, Regular pie with 3D visual effect, Multiple pies, and Multiple proportional pies.

Vertical/Horizontal

Use the Vertical and Horizontal option buttons to specify whether the chart is to represent increasing values in a vertical or a horizontal direction. For example, if you create a Vertical bar chart, the bars will rise upward from the bottom of the chart. If you create a Horizontal bar chart, the bars will rise from left to right, from the side of the chart (by default).

These options are only available for the Bar, Line, and Area chart types.


Data tab

The Data tab contains three sections:

  • Placement
  • Layout
  • Data

In the Placement section, you determine where you would like your chart to be placed on the report, as well as how often the chart will appear on the report.

Place chart

Use this list to choose the report section where your chart will appear. Your chart can appear either once per report or once per group (the group section containing the summary field that the chart is based upon).

Note: Your choice of where to put the chart will affect how the data in the chart can be subdivided.

Header/Footer

Use the Header/Footer option buttons to display a chart in either the Group Header or Group Footer section of a report. If the chart appears once per report, the Header/Footer choice will place it in either the Report Header section or the Report Footer section of the report.

In the Layout section, you determine the actual layout of the chart, depending on the data you wish to chart. There are four options:

  • Advanced option view
  • Group option view
  • Cross-Tab option view
  • OLAP option view


Advanced option view

Available Fields

This list displays all of the fields available for use in your chart.

Change of

Use the On change of buttons to add or remove the selected field(s) from the On change of list. Click the Add (>) button to add the selected field(s) from the Available Fields list to the On change of list. Click the Remove (<) button to remove the selected field(s) from the On change of list.

Evaluate

Use this list to determine when the chart should show a value. If you select "For each record", the chart will show a value for every record. If you select "For all records", the chart will show a total for all the records. If you select "On change of" and then specify an "on change of" field by using the Change of buttons and the Available Fields list, the chart will display a value for each change of that field.

TopN

Click the TopN button to sort the selected field by Top N, Bottom N, or Sort All. When you click this button, the Top N/Sort Group Expert appears.

This button is only active when a single field in the On change of list is selected.

Order

Click the Order button to change the sort order for the selected field. When you click this button, the Insert Group dialog box appears.

This button is only active when a single field in the On change of list is selected.

Show value

Use the Show values buttons to add or remove the selected field(s) from the Show values list. Click the Add (>) button to add the selected field(s) from the Available Fields list to the Show values list. Click the Remove (<) button to remove the selected field(s) from the Show values list.

Show value(s)

This list displays the field chosen as a value for your graph or chart. Points will be plotted for these values on the chart whenever the condition selected in the On Change of edit box changes. For example, if you create a graph of last year's sales for all your customers, you will select the Customer Name field as the condition and the Last Year's Sales field as the value. Whenever the Customer Name changes a point will be plotted according to the value of their last year's sales.

Remove (<<)

Click this button to remove all the fields from the Show values list.

Don't summarize values

Use the Don't summarize values check box to determine if the program should automatically summarize the values that will appear on the chart.

  • If you select this check box, the program will not summarize the values.
  • If you clear this check box, the program will summarize the map values, and the Set Summary Operation button will activate. The program adds a summary field to the Map Values list.
Set Summary Operation

Use this button to set or change the summary operation for the selected field. When you click this button, the Change Summary Operation dialog box appears. This button is only active when you have cleared the Don't summarize values check box, and when you have selected a field in the Map Values list.

Browse

Click this button to browse the values for the field that is selected in the Available Fields list.

Related topics

Editing charts using the Chart Expert


Group option view

On change of

Select the field you want to use as a condition for plotting values in a graph or chart. Points will be plotted whenever the value in the condition field changes. For example, if you create a graph of last year's sales for all your customers, you will select the Customer Name field as the condition and the Last Year's Sales field as the value. Whenever the Customer Name changes a point will be plotted according to the value of their last year's sales.

Show

Use this list to select the summary field whose values you want to display in your graph.


Cross-Tab option view

On change of list

Select the field you want to use as a condition for plotting values in a graph or chart. Points will be plotted whenever the value in the condition field changes. For example, if you create a graph of last year's sales for all your customers, you will select the Customer Name field as the condition and the Last Year's Sales field as the value. Whenever the Customer Name changes a point will be plotted according to the value of their last year's sales.

Subdivided by

Use this list to choose the secondary row or column to base your chart on. Clicking this box displays a list of the row/columns fields in your report that you can choose from.

Show

Use this list to select the summary field whose values you want to display in your graph.


OLAP option view

On change of

Select the field you want to use as a condition for plotting values in a graph or chart. Points will be plotted whenever the value in the condition field changes. For example, if you create a graph of last year's sales for all your customers, you will select the Customer Name field as the condition and the Last Year's Sales field as the value. Whenever the Customer Name changes a point will be plotted according to the value of their last year's sales.

Subdivided by

Use this list to choose the secondary row or column to base your chart on. Clicking this box displays a list of the row/columns fields in your report that you can choose from.

Other Dimensions

Click the Other Dimensions button to call the Format Other Dimensions dialog box.

Click a dimension (shown with its field setting) in the list then click Select a field value to specify a new field for the dimension to be fixed to.


Axes tab

The Axes tab lets you set the properties for each of the chart axes. The Axes tab changes depending upon the type of chart you are creating.

Major

Use the Major check boxes to determine whether major guidelines will be shown for the chart axes. There is a Major check box for Group axis, a Major check box for Series axis, a Major check box for Data axis, and a Major check box for the Data2 axis. Major check boxes are only active if the chart is a cross-tab or OLAP chart.

  • Select a Major check box to show the guideline for the corresponding axis.
  • Clear a Major check box to hide the guideline for the corresponding axis.
Minor

Use the Minor check boxes to determine whether major guidelines will be shown for the chart axes. There is a Minor check box for Group axis, a Minor check box for Series axis, a Minor check box for Data axis, and a Minor check box for the Data2 axis. Minor check boxes are only active if the chart is a cross-tab or OLAP chart.

  • Select a Minor check box to show the guideline for the corresponding axis.
  • Clear a Minor check box to hide the guideline for the corresponding axis.
Auto Scale

When you select one of the Auto Scale check boxes, the number of data axis labels is adjusted to ensure a clear display.

Auto Range

When you select one of the Auto Range check boxes, the data values for the corresponding axis are assigned a default range.

Min

Use the Min text boxes to enter the range minimum for the data values on the corresponding axes. There is a Min text box for the Data axis, and there is a Min text box for the Data2 axis. The second Min text box is only active if the chart is a cross-tab or OLAP chart.

If the corresponding Auto Range check box is selected, the Min text box is inactive.

Max

Use the Max text boxes to enter the range maximum for the data values on the corresponding axes. There is a Max text box for the Data axis, and there is a Max text box for the Data2 axis. The second Max text box is only active if the chart is a cross-tab or OLAP chart.

If the corresponding Auto Range check box is selected, the Max text box is inactive.

Number Format

Use the Number Format lists to select a number format for the data values on the corresponding axis. There is a Number Format list for the Data axis (y), and there is another for the Data2 axis. The second Number Format list is only active if the chart is a cross-tab or OLAP chart.

If the corresponding Auto Range check box is selected, the Number Format list is inactive.

Automatic

If you click one of the Automatic option buttons, the program automatically sets the number of divisions for the corresponding chart axis. There is an Automatic option for the Data axis, and there is an Automatic option for the Data2 axis. The second Automatic option button is only active if the chart is a cross-tab or OLAP chart.

Manual

Use the Manual option buttons to manually set the number of divisions for the corresponding axes. There is a Manual option for the Data axis, and there is a Manual option for the Data2 axis. The second Manual option button is only active if the chart is a cross-tab or OLAP chart.

When you click one of the Manual option buttons, the adjacent text box becomes active. Use the text box to enter the number of divisions.


Options tab

The Options tab offers choices for displaying a chart.

Chart Color

Use the Chart Color option buttons to specify whether the chart will be Color or Black and White.

Data Points

Use the Data Points option buttons to specify the type of label that will appear for each data item (that is, for each chart value). You can click None, Show Label, or Show Value. If you click Show Value, the Number Format list becomes active. Use the Number Format list to select a format for your chart values. For example, you might select a format of 1 (numeral) or you might select a format of $1.00 (currency).

Transparent background

When this check box is selected, the chart background will become transparent so objects positioned behind it are visible.

Marker size

Use this list to specify the marker size for the chart value markers on a Line Chart.

Marker shape

Use this list to specify the marker shape for the chart value markers on a Line Chart.

Viewing angle

Use this list to specify the angle from which the chart is viewed (Standard Angle, From The Top, and so on).

Pie size

Use this list to select the pie size for a Pie Chart (Minimum, Small, Average, Large, or Maximum).

Bar size

Use this list to select a bar size for a Bar Chart (Minimum, Small, Average, Large, or Maximum).

Detach pie slice

When this check box is selected, a pie slice is detached from the pie chart. You can click Smallest slice or Largest slice to specify which pie slice to pull out.

Show Legend

When this check box is selected, the Legend is displayed for your chart/graph. When the check mark is not visible, the option is not selected, and no legend will be displayed for your chart. By default, the option is selected.

Placement

Use the Placement list to specify where you want the chart legend to appear (upper right corner of the chart, to the left, to the right, and so on).

This list is only active when the Show Legend check box is selected.

Layout

Use this list to display percentage values, actual values, actual and percentage values or no values.

Related topics

Editing charts using the Chart Expert


Text tab

The Text tab lets you specify titles, footnotes and axis titles for a chart.

Auto-Text

When these check boxes are selected, chart titles are generated automatically. If they are cleared you can specify titles for the chart manually.

Title

Use this text box to enter a title for the chart. The title will appear just above the chart.

Subtitle

Use this text box to enter a subtitle for the chart. The subtitle will appear just below the title, above the chart.

Footnote

Use this text box to enter text for a footnote. The footnote will appear just below the chart on your report.

Group Title (x-axis)

Use this text box to enter a title for the chart's x axis.

Data Title (y-axis)

Use this text box to enter a title for the chart's y axis.

Data2 Title (y2-axis)

Use this text box to enter a title for the chart's second y axis (if you are creating a cross-tab or OLAP chart).

Series Title

Use this text box to enter a title for the chart series.

Staggered text

Use this check box to stagger the text in your labels.

This check box is only active when you have Group labels, Data labels or Series labels selected in the Format list.

Font

Click the Font button to set the font options for the set of text selected in the Format list. When you click this button, the Font dialog box appears.

Format

Use this list to select the text for which you are setting the font options. For example, you could select the chart title, the chart subtitle, the chart legend, and so on.

Related topics

Editing charts using the Chart Expert


Highlighting Expert

The Highlighting Expert allows you to efficiently apply conditional formatting to currency and number fields. The Highlighting Expert is most commonly used for highlighting field values that are in some way distinguished from the other values in the report. For example, if you wanted to highlight the {customer.LAST YEAR'S SALES} field in red whenever the sales are greater than $25,000, you could specify in the Highlighting Expert that, if the value is greater than $25,000, a red background color is applied to the field. You can also use the dialog box to set conditional font color and border style.

Note: Think of the Highlighting Expert as an alternative to the Formula Editor. The Highlighting Expert essentially runs the following equation: If Condition is True, Then Apply These Formatting Specifications.

For this purpose, the Highlighting Expert is divided into two sections, the Item list section (which displays the formula), and the Item editor (which allows you to set the formula). The Item editor includes a Sample view to demonstrate the formatting specifications applied.

Here are some additional benefits to note:

  • The Highlighting Expert can also be used for numeric/currency fields in Cross-tabs, as well.
  • You can undo highlighting.
  • You can also set highlighting priorities.
Item list

The Item list displays the highlighting formulas created for the currently selected field.

Priority

Use the Priority buttons in the Item List list of the Highlighting Expert to set the priorities for your formulas.

Remove

Use the Remove button to discard unwanted highlighting formulas for the currently selected field.

Remove All

Use the Remove All button to discard all highlighting formulas for the currently selected field.

Value is

Use this list to select a qualifier for your number of currency value. For example, you may choose to apply a red background color when the value contained in a field is equal to $25,000. In the Value is list, you determine the 'equal to' qualifier.

Field values

Use this text box to enter the currency value or numeric value to which you want to apply highlighting conditions. For example, you may choose to Highlighting Expert apply a red background color when the value contained in a field is equal to $25,000. In the Field values text box, you would type 25,000.

Font color

Use this list to select a font color for the number or currency value to which you want to apply a highlighting condition.

Background

Use this list to select a background color for the number or currency value to which you want to apply a highlighting condition.

Border

Use this list to select a border style for the number or currency value to which you want to apply a highlighting condition.

Sample

Shows a sample using the settings selected in the expert.

Related topics

Undo/Redo activities

Conditionally formatting fields using the Highlighting Expert


Report Style Expert

This expert appears:

  • when you choose the Report Style Expert command from the Format menu, or
  • when you click the Style Expert button on the Formatting toolbar.

Use the Report Style Expert to choose from several predefined formatting options for use in your report.

Style

This box displays the formatting styles available for use in your report. Select the desired style from the list and click the OK button to apply it to your report. A sample of the style is displayed in the Sample Preview box.

Sample Preview

This box displays a sample of the style selected in the Style list.

Related topics

Formatting


Search Expert

This Expert appears:

  • when you choose the Find command from the Edit menu, then click Advanced Find.
  • when you click the Find button on the Standard toolbar, then click Advanced Find.

Use the Search Expert to search for specific values in a report.

Note: The Search facility is only available in the Preview tab.

Search settings

Use the lists to select the condition that best finishes this sentence:

"I want to select all records where the value in the field I have selected is"

You can select primary conditions, date conditions or boolean conditions, depending on the type of field you have selected.

Search Direction

Choose the Forward option to search the records from your current position in the report forward to the end of the report.

Choose the Backward option to search the records from your current position in the report backward to the beginning of the report.

Note: If you do not have a field selected, the Search will begin at the top of the current page.

Search

Click this button to begin a search.

New

Click the New tab or button to create a new search formula. When you click this tab/button, the Choose Field dialog box appears where you select a field to create the search for.

Delete

Click this button to delete the active search and its associated tab.

Browse

The Browse button has been included as an aid in selecting the values that define your search. When you click this button, the program displays a list of field values for the records in the database. If the value you want is on the list, select the value and click the Paste Data button. The program enters the value selected in the active text box (the text box displaying the insertion point).

Note: If you need to select multiple values (for example, if you want to include records in which the field value is one of three values), the insertion point automatically moves to the next text box as soon as it finishes pasting data in the previous box.

Formula Editor

When you click this button, the Formula Editor appears with the selection formula shown in the Formula text box.

Show/Hide Formula

Search criteria that you enter via the Expert automatically generates a record selection formula. You can review and modify this formula by clicking the Show button. When you click the button the Expert expands to show the formula. When you are finished editing/reviewing, click the Hide button to hide the formula from view. The Select Expert is automatically updated with any modifications you make to the formula.

Add

Type a new search value in the box, then click this button to add it to the list.

Delete

Click this button to delete the currently selected field value from the list.


Select Expert

This Expert appears:

  • when you choose the Select Expert command from the Report menu, or
  • when you click the Select Expert button on the Standard toolbar.

Use the Select Expert to select the records or groups you want to include in your report (if you do not want them all included). For example, you may have a customer database that contains records for customers from every state and Canadian province but you want to do a report only on Texas customers. Select Records enables you to restrict your report so that only Texas customers are included. When using the Select Expert, the program automatically generates a record or group selection formula based on settings you specify in the dialog box.

Note: This Expert allows you to set up reasonably complex selection criteria, but to have more control over the formula that is generated, use the Formula Editor.

Search settings

Use the lists to select the condition that best finishes this sentence:

"I want to select all records where the value in the field I have selected is"

You can select primary conditions, date conditions or boolean conditions, depending on the type of field you have selected.

Speed Tip

Click this button to get further information to speed up the reporting process.

Browse

The Browse button has been included as an aid in selecting the values that define your selection formula. When you click this button, the program displays a list of field values in the database. If the value you want is on the list, select the value and click the Paste Data button. The program enters the value selected in the active text box (the text box displaying the insertion point).

Note: If you need to select multiple values (for example, if you want to include records in which the field value is one of three values), the insertion point automatically moves to the next text box as soon as it finishes pasting data in the previous box.

Show/Hide Formula

Record selection criteria that you enter via the Expert automatically generates a record selection formula. You can review and modify this formula by clicking the Show button. When you click the button the Expert expands to show the formula. When you are finished editing/reviewing, click the Hide button to hide the formula from view. The Select Expert is automatically updated with any modifications you make to the formula.

Record Selection/ Group Selection

Select the Record Selection option to create a record selection formula.

Select the Group Selection option to create a group selection formula.

New

Click the New tab or button to create a new selection formula. When you click this tab, the Choose Field dialog box appears where you select a field to create the selection formula on.

Del

Click this button to delete the active selection formula and its associated tab.

Formula Editor

When you click this button, the Formula Editor appears with the selection formula shown in the Formula text box.

Related topics

Record Selection


Top N/Sort Group Expert

This Expert appears when you choose the Top N/Sort Group Expert command from the Report menu.

Use the Top N/Sort Group Expert to identify "top" groups (the best sales representatives in a sales report, the biggest customers in an order report, the states with the most customers in a customer report, and so on).

Use the Top N/Sort Group Expert to sort all of the records in a report or just the top or bottom groups of records. Depending on which option you choose the Expert appears with different options.

Group/Sort

Use this list to choose one of the following sorting options for your Top group:

  • Sort All groups
  • Sort the Top N group
  • Sort the Bottom N group
based on

This list displays a list of summary fields in your report. Select the field you want to select Top N or Bottom N values for from this list. When Sort All groups is selected, use the scroll box below the based on list to see the fields chosen for sorting.

where N is

Enter the number of Top N or Bottom N values (where N is the number of values) you want to select into this edit box.

include Others, with the name

Select this option if you want to include all fields that do not fit into your Top N or Bottom N selection under a specified group name. Enter the group name you want all fields that do not fit into your Top N or Bottom N selection to appear under.

Delete

Click this button to delete the selected summary field. This is only available when Sort All Groups is selected.

Ascending/Descending

Select the Ascending option to sort the fields in ascending (A to Z, 1 to 9) order.

Select the Descending option to sort the fields in descending (Z to A, 9 to 1) order.

Related topics

Sorting, Grouping, and Totaling


Map Expert

This Expert appears:

  • when you click the Insert Map button from the Standard toolbar,
  • when you choose the Map command from the Insert menu, or
  • when you right-click a Map and choose Map Expert.

The Map Expert consists of several tabs that lead you through step-by-step instructions for creating a map in your report.

  • Data tab
  • Type tab
  • Text tab
Related topics

Analyzer menu

Creating maps

Mapping overview


Data tab

The Data tab contains three sections:

  • Placement
  • Layout
  • Data

In the Placement section, you determine where you would like your map to be placed on the report, as well as how often the map will appear on the report.

In the Layout section, you determine the actual layout of the map, depending on the data you wish to map. There are four options:

  • Advanced option view
  • Group option view
  • Cross-Tab option view
  • OLAP option view

In the Data section, you determine the data that will be mapped.

Place map

The Place Map list gives you the option to place a map only Once per report or For every instance of a group.

Header and Footer

Use the Header and Footer option buttons to determine where in the report your map will be placed.


Advanced option view

Use the Advanced option view when you have multiple map values, rather than only one, or when you do not have any groups or summaries in the report. With the Advanced Layout you determine which fields are used for the Geographic breakdown, the On change of value, and the Map value. You can also set summary options.

Note: You must map on a geographic field, such as Country, Region, or City. The program cannot generate a map based on a non-geographic field.

Available Fields

The Available Fields list allows you to select which fields to use as the data for your map.

Browse

Click the Browse button to view the data contained in the selected field in the Available fields list.

Add

Click the Add button (>) to copy fields from the Available fields list to the Geographic Field text box, the On change of text box, or the Map values list.

Remove

Click the Remove button (<) to remove a selected field from the Map values list.

Remove All

Click the Remove All button (<<) to remove all fields from the Map values list.

Geographic field

Use the Geographic field text box to determine the geographic breakdown of the map. For example, if you insert the field Customer.Country into the Geographic field text box, your map will display values for each country. If you insert the field Customer.Region, your map will display values for each region.

On change of

Use the on change of list to specify a field to use as a condition for displaying a summary field. Summary values will be displayed whenever the value in the condition field changes.

Map values

Use the Map values list to create a list of all the fields you want shown as values on the map.

Don't summarize values

Use the Don't summarize values check box to determine whether the program should automatically summarize the values that will appear on the map.

  • If you select this check box, the program will not summarize the values.
  • If you clear this check box, the program will summarize the map values, and the Set Summary Operation button will activate. The program adds a summary field to the Map Values list.
Set Summary Operation

Use this button to set or change the summary operation for the selected field. When you click this button, the Change Summary Operation dialog box appears. This button is only active when you have cleared the Don't summarize values check box, and when you have selected a field in the Map Values list.


Group option view

The Group option view allows you to show a summary field (such as Last Year's Sales) on change of a geographic field (such as Region). In order to create a map using the Group layout, you must have at least one group and at least one summary field in your report.

On change of

Use the on change of list to specify a field to use as a condition for displaying a summary field. Summary values will be displayed whenever the value in the condition field changes.

Show

The Show list displays the value options for your map. In other words, the data contained in the field in the Show list will be used by the program as your map values. If the Show list contains the Sum of Customer.Last Year's Sales field, your map values will be last year's sales for each customer.


Cross-Tab option view

Use the Cross-Tab layout button when mapping on a cross-tab object. The cross-tab information can be used as the basis of the map. A Cross-Tab map does not require groups or summary fields. With the Cross-tab layout, you determine the Map on value, the Geographic field breakdown, and whether or not the data will be subdivided.

Geographic Field

Use the Show Geographic Field list to determine the geographic breakdown of your map. For example, if you select the Customer.Country field, your map will display values for each country. If you select the Customer.Region field, your map will display values for each region.

Subdivided by

Use the Subdivided by list to select an additional field to map on, if desired. The program uses this field to subdivide the pie or bar charts appearing on your map.

Map on

The Map on list displays the value options for your map. In other words, the data contained in the field in the Show list will be used by the program as your map values. If the Show list contains the Sum of Customer.Last Year's Sales field, your map values will be last year's sales for each customer.

Related topics

Cross-Tab Objects


OLAP option view

The OLAP option view allows you to map to an OLAP object. The OLAP information can be used as the basis of the map.

On change of

Use the on change of list to specify a field to use as a condition for displaying a summary field. Summary values will be displayed whenever the value in the condition field changes.

Subdivided by

Use the Subdivided by list to select an additional field to map on, if desired. The program uses this field to subdivide the pie or bar charts appearing on your map.

Other Dimensions

Click the Other Dimensions button to call the Format Other Dimensions dialog box.

Click a dimension (shown with its field setting) in the list then click Select a field value to specify a new field for the dimension to be fixed to.


Type tab

The Map Expert provides five basic map types, each suitable for a different strategy of data analysis. When deciding which map type best fits your report, you should consider the type of data you want to analyze. For example, if you want the map to display one data item for each geographic division (city, state, country, and so on), then you might use a Ranged, Dot Density, or Graduated map. On the other hand, if you want the map to display more than one value for each new geographic division, then you could use a Pie Chart map or a Bar Chart map.

The map types are:

  • Ranged
  • Dot Density
  • Graduated
  • Pie Chart
  • Bar Chart

There is also a separate Options section that allows you to decide the appearance of the map values when they are displayed on the map. For example, you can choose a color for the lowest interval on your map.

Related topics

The Type tab options vary, depending on the type of map you are creating. Click a link below to find out about relevant options.

Ranged option view

Dot Density option view

Graduated option view

Pie Chart option view

Bar Chart option view


Ranged option view

A Ranged map breaks data into ranges, assigns a specific color to each range, and then codes geographic areas on the map by color in order to display the range. You can use a ranged map to display sales figures in a range of equal intervals. You can then use shades of color to code sales regions according to those figures. This type of map is useful for determining the regions of highest sales simply by looking at the colors it displays.

Number of intervals

Use this box to enter the number of intervals you want to use as a range. Your map and its legend change accordingly. You can enter a number between 1 and 16. The default is 5.

Distribution method

Use this list to assign range intervals in such a way that the values fit one of the available criteria:

  • Equal count

    Assigns intervals so that the same number of regions (or as close to the same number of regions as possible) appear in each interval.

  • Equal ranges

    Assigns intervals so that the summary values in each interval are numerically equal.

  • Natural break

    Assigns intervals using an algorithm that attempts to minimize the difference between the summary values and the average of the summary values for each interval.

  • Standard deviation

    Assigns intervals so that the middle interval breaks at the mean (or average) of the data values, and the intervals above and below the middle range are one standard deviation above or below the mean. Standard deviation is the square root of the variance. This option projects how various values in a set of values deviate from the mean for that set.

Color of highest interval

Use this list to select the color you'd like to use for the highest (largest) interval in your range. This color becomes the top end of your color range.

Color of lowest interval

Use this list to select the color you'd like to use for the lowest (smallest) interval in your range. This color becomes the bottom end of your color range.

Allow empty intervals

Select this check box if you want to see empty intervals on your ranged map. This option is selected by default.


Dot Density option view

A Dot Density map displays a dot for each occurrence of a specified item. For example, you might create a United States map that shows one dot for each national park. The purpose of a Dot Density map, then, is to provide an overall impression of the distribution of the specified item. Such a map is not a very accurate means of showing detailed information, but is a good way to give an impression of distribution.

Size of dots

Click Small or Large to define the size of the dots you want on your Dot Density map.


Graduated option view

A Graduated map is much like a Ranged map in that it shows one symbol per instance of a specified item. Use a Graduated map for displaying data that is linked to points rather than precise geographical areas (as is the case with Ranged map types). For example, a map of an individual region could use graduated circles to represent the sales for each office. The size of each circle would be proportional to the sales (or to the sales range) of the office it represents. A Graduated map provides a more efficient representation of point data than a Ranged map does, and it uses sized symbols rather than colors to distinguish variations in the values of the items it represents.

You can choose the symbol you want to use on your Graduated map. Each symbol is proportional in size to the value of the item it represents (within a range of three sizes).

Symbol style

Click Customize to open the Symbol Style dialog box. You can use this dialog box to choose and format a symbol.


Pie Chart option view

A Pie Chart map displays a pie chart over each geographic area. Each slice of the pie represents an individual data item and shows that item's percentage in the whole. You can use this map type to compare the distribution of several items within a particular region. You can also specify that the pie charts be sized proportionately, so that, as with the symbols in a Graduated map, the pie charts will appear in various sizes, depending on the underlying data values. This allows you to compare the totals between regions.

Size of pies

Use the slider to choose Large, Medium, or Small as the size of the pies to display on your map.

Proportional sizing

Select this check box to specify that the pie charts on your map will be sized proportionately depending on the underlying data values.


Bar Chart option view

A Bar Chart map works like a Pie Chart map, but may be more useful for certain sets of data. Typically, you would use a Bar Chart map for items that do not total 100% (that is, for data items that do not make a whole, or for data items that are unrelated).

Size of bars

Use the slider to choose Large, Medium, or Small as the size of the bars to display on your map.


Text tab

The Text tab allows you to determine the title of your map, legend information, and the legend title.

Map title

Use this text box to create a title for your map. Creating a map title is optional.

Full Legend

Select the Full Legend option button for a detailed breakdown of how the data has been represented in the map.

Compact Legend

Select the Compact Legend option button for a minimal breakdown of how the data has been represented in the map.

No Legend

Select this option button if you prefer not to have a legend with your map.

Made by map

Select the Made by map option button to create a legend title for you.

Specify

Select the Specify option button to create your own legend title.

Title

Use this text box to create a legend title for your map.

Subtitle

Use this text box to create a legend subtitle for your map


Section Expert

This expert appears when you choose the Section command from the Format menu.

Use the Section Expert to make formatting changes that affect entire sections of your report.

Sections

This box lists all of the sections in the active report. When you highlight a section in this list, the program sets the dialog box buttons to indicate the actions you can take and the properties you can set for the selected section.

Insert

Use this button to insert a new report section immediately below and of the same type as the section you have selected in the Sections list. For example, if you have a Details section selected and click the Insert button, the program will insert a new Details section immediately below the selected section.

Delete

Use this button to delete the section you have selected in the Sections list. You can only delete sections that have been added to the originating sections; you cannot delete any of the originating sections.

Merge

Use this button to merge the current section with the companion section that appears immediately below it. For example, if you have three sections, Details A, Details B, and Details C, and you highlight Details B and click the Merge button, the program merges Details B and Details C into a single section.

Note: You cannot merge sections of different types; for example, you cannot merge a Details section with a Group Header section.

Arrow buttons

Use these buttons to move a section up or down with respect to other related sections. For example, if you have three sections, Details A, Details B, and Details C, if you highlight Details B and click the up arrow, the program moves the selected section to the top of the three Details sections. Conversely, if you highlight Details B and click the down arrow, the program moves the selected section to the bottom of the three.

Note: You cannot move a section past a section of a different type. For example, you cannot move a Details section past a Group Header section.

Conditional Formula

Click this button if you want to set up a conditional formatting formula for the corresponding property. See Working with conditional formatting for more information.

Related topics

Section command

Using the Section command


Color tab

Use the Color tab to set the background color for the desired section.

Background Color

To add a background color to the selected section, select this check box, then choose a color from the list.

Conditional Formula

Click this button if you want to set up a conditional formatting formula for the corresponding property. See Working with conditional formatting for more information.


Common tab

Use the Common tab to set properties such as: visible, new page before, keep together, etc. for a desired section.

Free-Form Placement

When you select this check box, the program enables you to place objects in a free-form environment similar to that of a drawing program. When this option is not selected, objects are placed at fixed points using an underlying grid that can be modified according to your specifications (see Layout tab).

Hide (Drill-Down OK)

Select this check box if you do not want the section to print, but you want the section contents to be available for drill-down.

Suppress (No Drill-Down)

Select this check box if you do not want the section to print, and you do not want the section contents to be available for drill-down.

Print at Bottom of Page

This check box causes each group value to print only at the bottom of a page. (Details continue to print in their normal positions.) The command is useful for printing invoices and other reports where you want a single group (i.e., line items grouped by order number) to appear on a page and the value for that group (subtotal, summary field, etc.) to print only at the bottom of the page.

New Page Before

New Page Before is an available format property for Group (header and footer) and Details sections. When you select this option, the program inserts a page break before it prints the section. The page break thus comes before:

  • the group (if using the option with a Group footer section), or
  • each report record (if using the option with a Details section).

The Page Header and Page Footer appear on each page. If you have a subtotal or summary field in a Group Footer section, you can use the New Page Before option to put these values on pages following the value being totaled.

New Page After

When this check box is selected, the program inserts a page break after it prints the section.

  • The Page Header and Page Footer appear on each page.
  • Use New Page After in the Group footer section to print each group on a separate page.
Reset Page Number After

Resets the page number to one (1) for the following page, after it prints a group total. When this option is used in conjunction with Print at Bottom of Page, the program prints a single group on a page, prints the group value at the bottom of the page, and resets the page number to 1 for the next page. This option is useful whenever you are printing multiple reports from a single file (i.e., invoices), and you want each report to be numbered beginning with Page 1.

Keep Together

When this check box is selected, the program keeps all the lines of the section together, either on the current page (if there is room) or on the next (if not).

In a customer list, for example, data on a single customer (from a single record or linked records) may extend over several lines. If the standard page break falls within the data for a customer, the data will be split, part on one page, part on the next. But with Keep Together, the program inserts the page break before the record begins so that all the data will be printed together, on the following page.

Note: This option does not work with multi-line string or memo fields. A page break may occur in the middle of a multi-line field.

Suppress Blank Section

When you select this check box, the program hides the report section if it is blank, and prints it if it is not.

Underlay Following Sections

Select this check box if you want the selected object to underlay the following section(s) when it prints.

Format with Multiple Columns

When you select this, the Layout tab will appear.


Layout tab

The Layout tab appears when you have the details section selected and the Format with Multiple Columns box is checked on the Common tab.

Use the Layout tab to set up your report in a multi-column format. That is, instead of having the data print straight down the page, you can set up multiple columns and have the data flow from column to column. You can also have your data print across then down the page, printing one record in each column, then printing a second record in each column, then a third, etc. The dialog box is divided into four smaller boxes.

Detail size

This box enables you to specify the dimensions (height and width) of one detail. Determine how wide you want each detail to be (based on number of characters, font size, etc.) and enter that value in the Width edit box.

Determine how high you want each detail to be (based on number of lines in the detail, font size, etc.) and enter that value in the Height edit box.

Gap between details

This box enables you to specify the empty area (gap, gutter, etc.) you want to allow between details. Horizontal = the gaps between details going across the page, Vertical = the gaps between details going down the page.

Determine the gaps you want to allow. Enter the horizontal gap in the Horizontal edit box and enter the vertical gap in the Vertical edit box.

Printing direction

The Printing direction box enables you to specify the path the program follows when printing the details on a report page. Your options are:

  • Across then Down

    Prints details across the columns, one detail in the first column, one in the next, one in the next, etc. Then, when all the columns have a detail, the program moves down the page and prints a second detail in the first column, then in the second, etc.

  • Down then Across

    Prints details down the first column, then down the second column, etc.

Format groups with multiple column

Select this check box if you want the program to format groups with multiple columns using the Width, Gap between Details, and Printing Directions specified for the selected section.


Visual Linking Expert

You link databases so records from one database will match related records from another. For example, if you activate a Movie database and a Studio database, you link the databases so that each movie (from the Movies database) can be matched up with the studio that made the movie (from the Studio database).

When you link, a field is used that is common to both databases. The program uses the link to match up records from one database with those from the other. In this example, the link assures that the data in each row of the report refers to the same movie.

Use Visual Linking to link two or more databases together. When you choose the Add Database to Report command from the Database menu, and select an additional database, The Visual Linking Expert appears and displays the additional database.

Visual Linking

This scroll box displays all the tables currently in your report along with any links and indexes.

Tables

When you click this button, the Choose Tables To Use In Visual Linking dialog box appears where you can choose the desired tables you want to link in your report and whether smart linking is used.

Arrange Tables

When you click this button, the program will arrange the tables to fit in the most efficient manner inside the Visual Linking scroll box.

Link

Click By Name to link tables by their names or By Key to use foreign key information. Click Link to link tables automatically.

Clear Links

Click this button to clear all the current table links.

Link Options

To activate this button, you must have a link line selected. Once you have a link selected, click this button to open the Link Options dialog box where you can choose what type of index to use, allow partial text matches, etc., for the selected link.

Delete Link

Click a link then click this button to remove it.


Glossary

Seagate Software, Inc.
http://www.seagatesoftware.com
Please send comments to:
techpubs@seagatesoftware.com


A

absolute formatting

Formatting that is always applied to an object. See also conditional formatting.

access

To access data means to retrieve data.

Acrobat Reader

An application used to review and print online manuals.

active database

An active database is a database that has been selected for use in a report. You activate databases with the New command on the File Menu and the Add Database to Report command on the Database Menu.

Active Server Page

Active Server Pages are web pages that run under Microsoft's Internet Information Server (IIS) version 3.0 and later. Active Server Pages combine HTML, VBScript or JScript, and ActiveX controls to create dynamic web pages that can be viewed from any of the most popular web browsers. The Quik Reports for Windows Engine Automation Server, the Crystal Design-Time ActiveX Control, and the Crystal Active Data Driver can be combined to create active web sites in Microsoft Visual InterDev that display reports from an Internet or intranet site.

ActiveX Control

A Custom Control for Visual Basic 4.0 and above that incorporates the Object Linking and Embedding (OLE) technology. Formerly known as an OLE Control (OCX).

aggregate functions

An operation that summarizes data (sums, calculates an average, identifies a maximum value, etc.). The term "aggregate functions" is often associated with SQL data sources.

alias

An alias is an alternative name assigned to a database. If a database is called CUSTOMER.DB, for example, you can assign the alias customer, cust, company, DB1, or any other name that suits your needs. Aliases make it easier for you to use a report created with a database whose name and/or location has changed since the report was created.

area

An area is a group of related sections (i.e., Details A and Details B) that all share the same characteristics but can be formatted differently.

argument

An argument is an item, or one of a group of items, that receives the action of a function. It provides information that the function needs in order to operate. The Truncate function, for example, can not operate by itself. It needs an argument that identifies the item to be truncated. Thus, in the formula in Crystal syntax:

Truncate ({orders.ORDER AMOUNT})

«where Truncate is the function and {orders.ORDER AMOUNT} is the argument, the value of the {orders.ORDER AMOUNT} field is the item that needs to be truncated.»

array

An array is a group of values, separated by commas. Arrays are used with a variety of Seagate Crystal Reports functions: Average ([array]), Maximum ([array]), etc. In these functions, the array is the argument for the function. The function works on the items in the array. Items in an array can be constants, data fields, or formula results.

arrowhead

A symbol to show that a field is an indexed fields.

attribute

An attribute is a quality applied to an object (i.e., font size, color, etc.).

auto arrange

When you place a field on your report, the program allocates a space equal to the field width as specified in your database. Often that field width is far larger than the values that actually appear in each of the fields. To create neat-looking reports, it is often necessary to resize the fields so that the space allotted more closely matches the size of the field values. Once you have resized the fields you often need to reposition them for proper balance. Auto Arrange will do this for you. Simply choose the Auto-Arrange Report command from the Analyzer menu.


B

bitmap

A graphic file that can be added to a report.

BLOB field

A BLOB field is a field containing BLOB data. A BLOB (Binary Large Object) is simply a bitmapped graphic that has been entered into a database. Placing a BLOB field on your report allows you to access these graphics as you would other data types.

Boolean expression

A Boolean expression is an expression that defines a logical relationship between two or more items. A Boolean expression is either TRUE or FALSE. A>5 And B<10 is a Boolean expression that uses the Boolean operator And. For the expression to be TRUE, both conditions (joined with the And operator) must be true. The value of A must be greater than 5 and the value of B must be less than 10. If the values do not fall into those ranges, then the expression is FALSE. Boolean expressions are useful in If-Then-Else formulas. For example:

If A>5 And B<10 Then

    "In Range"

Else

    ""

This Crystal syntax formula says: if the Boolean expression A>5 and B<10 is TRUE, print "In Range" otherwise (if the Boolean expression is FALSE), print nothing (as designated by the empty string"").

Boolean

Boolean formulas are formulas that return a Yes/No (TRUE/FALSE) value. For example, the Boolean formula {orders detail.QUANTITY} > 6 compares the value in the {orders detail.QUANTITY} field to 6. If the value is greater than 6 it returns a Yes; if it is 6 or less, it returns a No. Contrast this with a non-Boolean formula like {orders detail.QUANTITY} * 6. In this case the program returns a number, the value of {orders detail.QUANTITY} multiplied by 6. All selection formula and group selection formulas must be Boolean.

browser

A browser is an application that enables viewing of documents in HTML format.


C

calculated data field

A calculated data field is a field that holds a value that comes from a calculation rather than coming directly from a database. For example, if the database you are using includes a {file.SALES} field and a {file.COST} field but no Gross Profit field, you can still show gross profit on your report by using a calculated data field. To create a calculated data field, you create a formula that subtracts {file.COST} from {file.SALES}. The formula calculates a Gross Profit value for each row and prints that value wherever you place the formula field.

case-sensitive

Case-sensitive means that a program differentiates between uppercase and lowercase letters when evaluating a text string. Thus, a case-sensitive search for the word "house" will return only the value "house," but a non-case-sensitive search will return "house," "House," "HOUSE," and similar mixed-case strings. Seagate Crystal Reports operators (Equal, In string, etc.) are case-sensitive.

column

A column is the display of data from a single field or formula. Columns run up and down the page. Compare with row.

comments

Comments are blocks of descriptive text that accompany formulas. Seagate Crystal Reports ignores comments when it runs the formula.

concatenate

To concatenate is to join two or more text strings together to form a single contiguous string.

condition

In an If-Then-Else formula, the condition is the If part of the formula, the set of circumstances that must take place (be true) to trigger the Then (or consequence) part of the formula. In the formula If x<5 Then x Else 5, the expression x<5 is the condition.

conditional formatting

Conditional formatting is formatting that applies only if certain situations occur. For example, you can conditionally format numeric database fields to display in red when negative.

conditional formatting formula

A conditional formatting formula is an expression that applies specific attributes to objects or sections only if certain criteria are met.

conditional properties

Conditional properties are properties that are performed on an object only if a comparison statement returns a value of True.

confidence threshold

A percentage (C) used when the Seagate Document Import Tool converts a report. If fewer than C percent of the fields are located correctly, the conversion will fail.

consequence

In an If-Then-Else formula, the consequence is the Then part of the formula; the action that takes place if the If condition is met. In the formula If x<5 Then x Else 5, the expression Then x is the consequence.

constant

A constant is a value that is fixed and unchanging as opposed to a variable value, which can take on various values depending on the circumstances.

The value 5 is a constant; the value of the Quantity field (which may be 5 sometimes, but may be a different number at other times) is a variable value. For example, in the formula for converting pounds to ounces (Ounces = Pounds * 16), 16 is a constant while Ounces and Pounds are variables. In the formula (Today - January 1, 1900), January 1, 1900, is a constant, while Today is a variable that changes whenever the current date changes. In Seagate Crystal Reports, constants can be numbers, text strings, dates, dollar amounts, time, date/time, or the result of a formula that itself contains no variables (i.e., 14-9).

container document

A file that contains an embedded or linked OLE object.

conversion interface file

A conversion interface file (.cif extension) is the file in which the program saves the formatting and highlighting from the Document Import Tool. When you highlight something in the Document Import Tool and set properties for database fields, these settings are saved in the .cif file. This file can be used to quickly format the same report later, without highlighting.

cross-tab

A cross-tab is a report that summarizes and presents data in a compact row and column format that makes it easy to compare data and identify trends.


D

database

A database is a bank of related data. Each unit (record) of the database is typically organized in a fixed format to make it easier to retrieve selected portions of the data on demand. Each record is made up of one or more data fields, and each data field can hold one piece of data (known as a value).

data field

A data field (or field) is the basic building block of a record. Each record is made up of one or more data fields, and each data field can hold one piece of data (known as a value). A customer record in a typical customer mailing list database might contain data fields similar to these: Name, Address, City, State, Zip, Phone, Fax. A data field can be empty or contain a value. Data field data is generally displayed or printed in columns in the Details section of a report.

data source

A data source is a database, table, query, dictionary, Info View or stored procedure result set that provides the data for a report.

data type

A data type is a classification of the data that appears in a field or formula. Each piece of data used in a report or formula has one of the following data types: string, currency, number, date, date/time, time, or Boolean (TRUE/FALSE). It is important to understand data types because each function and operator works with only a limited number of data types (often as few as one). For some operators (+ and - for example), the program uses a different set of calculation rules for one type of data than it uses for another.

debug

Eliminating errors that occur when you run a formula.

default

A default is a pre-loaded response to a software request for data. It is the response the computer accepts automatically if you do not enter different data.

Details area

A collection of one or more Details sections (i.e., Details A, Details B, etc.).

Details section

The Details section of a report is the core section of the report. You structure the report in this section by inserting data fields, formulas, and other report elements.

dictionary

A one-stop, ready-to-use source of data that is usually created for end users by computer professionals within the organization. The dictionary takes away the need for the end user to search multiple databases, struggle with links, build formulas, and decode cryptic field names. The user just selects the data he or she needs from the dictionary and builds the report.

divide by zero protection

PCs will not allow you to divide a number by zero. If you attempt such a division, you will get a system error message. To prevent a system error, the program refuses to print a report which contains a formula that divides a value by zero.

drag

Drag can mean different things, depending on the context in which the word is used:

  • When referring to moving a field, drag means to click the field frame and, while keeping the mouse button pressed, move the frame to a new position. You release the mouse button when the field is in the desired position.
  • When referring to resizing a field, drag means to click one of the field frame handles and, while keeping the mouse button pressed, make the field bigger or smaller. You release the button when the field is the desired size.
  • When referring to formatting text, drag means to highlight text by moving the I-beam cursor across it while the mouse button is pressed. You release the button when you have finished highlighting.

Dynamic Link Library (DLL)

A Dynamic Link Library (DLL) is a special kind of file that contains Windows functions. DLLs are used by developers to extend the capabilities of Windows applications. The library is activated whenever an application or another DLL calls a function in the library. DLLs link on the fly, at runtime, whenever an included function is called. DLL functions are available on an as-needed basis to any program that can call DLLs; they do not need to be linked to the program via the compiler. The Crystal Report Engine can be called as a DLL by developers for use with applications they are developing.


E

element

The word element is used in the documentation to describe individual report components such as database fields, formulas, and group fields. The Design Tab uses rectangular frames to represent fields.

embed, embedded object

An embedded object contains a presentation of the object, all of the data pertaining to the object, and information about the application used to create it. When you modify the original object in the server document, nothing happens to the embedded object unless you specifically update that object.

empty date

An empty date [designated as Date (0, 0, 0)] is a date that contains neither month, day, or year, and thus does not print. Use an empty date in If-Then-Else formulas that either return a date or not. For example, the formula:

If PageNumber = 1 Then

    PrintDate

Else

    Date(0,0,0)

«Prints the print date on the first page and prints nothing on every other page.»

Since the Then part of the formula is a date (PrintDate), the Else part of the formula must be a date as well, but a non-printing date. To create a non-printing (empty) date use the Date function and the arguments (0, 0, 0).

empty number

An empty number [designated as zero (0)] is a field value that is typically printed when a value does not meet a specific condition in a numeric If-Then-Else formula. Use an empty number to specify that 0 be printed. For example, in the formula:

If {file.FIELD} = 3.5 Then
{file.FIELD}
Else
0

you are specifying that the numeric Gradepoint be printed (Then) if the grade point is 3.5 or higher. You are using the empty number 0 to indicate that 0 is to be printed (Else) if the grade point is below 3.5. Often a user will format the field that contains this formula to be suppressed if 0. In this event, nothing gets printed in the case of a zero value.

empty string

An empty string (designated as "") is a string that contains no characters. Use an empty string to specify that nothing be printed. For example, in the formula:

If {file.FIELD} = 3.5, Then

    "Cum Laude"

Else

    ""

you are specifying that the words Cum Laude be printed (Then) if the grade point is 3.5 or higher. You are using the empty string "" to indicate that nothing is to be printed (Else) if the grade point is below 3.5.

evaluation time

Evaluation time refers to the stage in the reporting process when a formula gets evaluated. The three evaluation time functions are:

  • BeforeReadingRecords
  • WhileReadingRecords
  • WhilePrintingRecords

Expert

Seagate Crystal Reports offers you several Experts. Experts are tools designed to take you step-by-step through various aspects of report creation. In most cases Experts have a series of numbered tabs. Simply begin at step one and proceed through the steps. When you have completed the final step, the Expert will do the rest of the work.

Note: The term "Expert" in Seagate Crystal Reports is equivalent to the term "wizard" in Microsoft Access.

export

To export is to distribute your report to a disk file or through email. Seagate Crystal Reports allows you to export your reports in many popular spreadsheet, database, word processor, HTML, and data interchange formats.


F

field

A field is the basic building block of a record. Each record is made up of one or more fields, and each field can hold one piece of data (known as a value). A customer record in a typical customer mailing list database might contain fields similar to these: Name, Address, City, State, Zip, Phone, Fax. A field can be empty, or it can contain a value. Field data is typically displayed/printed in columns in the Details section of a report.

field value

See value.

field width

Field width is the size of the field in the originating database. A field width is generally fixed, and values in the field may take up all or only a part of the allotted width. The program includes Trim functions for removing excess white space from field values that do not fill their respective fields.

file

A file is a collection of related data stored under one name. In Seagate Crystal Reports, each report is stored as a single file.

fixed properties

Properties that will always be performed on the object.

flag

A flag is a character or group of characters used to highlight or identify items of interest to call them to the user's attention. For example, in an accounts receivable report, the words "past due" might be printed as a flag beside every past due account.

footer

The footer is the text that appears at the bottom of a report page. Footer text frequently includes page numbers, and may include other information that describes or identifies the report. Seagate Crystal Reports gives you the option of printing the footer on all pages or on only selected pages of your report.

formatting toolbar

This toolbar displays buttons that you can click to perform many common formatting tasks.

form letter

In Seagate Crystal Reports, a form letter is a letter that can be reproduced, personalized, and customized using the program's powerful text object capabilities. Form letters generally include both text and field values. You create the letter, and the program runs it each time inserting values from a different record in the database.

formula

A formula is a symbolic statement of the modifications you want performed on certain data before it is printed on your report.

For example, if your report is to contain a {file.SALES} field and a {file.COST} field, you may want to create a GrossProfit field and designate its text strings as {file.SALES} - {file.COST}. This is a simple formula that tells the program to subtract the value of the {file.COST} field from the value of the {file.SALES} field and then to print the result.

You can use formulas to calculate numeric values, compare one value to another and select alternative actions based on the comparison, join multiple value into a single string, and to perform a multitude of other operations. Creating a formula in Seagate Crystal Reports is much like creating a formula in your favorite spreadsheet.

Note: The term "formula" in Seagate Crystal Reports is equivalent to the term "expression" in Microsoft Access.

Formula Editor

The Formula Editor is used to create and edit formulas. It contains tools for inserting fields, functions and operators into the formula, for checking formula syntax and for typing in formula components and arguments. Modified versions of the Formula Editor are used for creating Record and Group Selection formulas.

formula syntax

Formula syntax is the set of grammar rules you are required to follow when creating formulas using the formula language.

free form

Free form implies that placement of objects is not limited to grids (vertical or horizontal).

function

A function is a built-in procedure or subroutine used to evaluate, make calculations on, or transform data. When you specify a function, Seagate Crystal Reports performs the set of operators built into the function without needing each operator specified separately. In this way, a function is a kind of shorthand that makes it easier and less time consuming for you to create reports.

Seagate Crystal Reports comes with a wide range of functions, and it also includes tools that allow you to build and save additional functions for yourself.


G

grand total

A grand total is the summary of all values in a column, for the entire report.

grid

In Seagate Crystal Reports, the grid is an underlying network of "lines" that are similar to the lines on graph paper. You can use these lines to help align fields and graphics. If you have the Snap to Grid option toggled on in the Options dialog box, Seagate Crystal Reports will automatically align any fields you insert or resize to the nearest grid coordinate.

group

A group is a set of records that are related to each other in some way. In a customer list, for example, a group might consist of all those customers living in the same Zip Code, or in the same Region. In a sales report, a group might consist of all the orders placed by the same customer, or all of the orders generated by a particular sales representative. Seagate Crystal Reports offers you a great deal of flexibility in the way you group the data on a report.

Group Footer

A Group Footer is a section created by the program whenever you insert a group, a summary, or a subtotal. The Group Footer section is typically used to display the summary or subtotal.

Group Header

A Group Header is a section created by the program whenever you insert a group, a summary, or a subtotal. The Group Header section is typically used to display the name of the group or some other identifying information.

guidelines

Guidelines are non-printing lines that you can use to align, move, and resize objects with precision. Guidelines allow you to work in a free form environment (without a grid), while retaining absolute control over the placing of objects in your report.


H

header

A header is text that appears at the top of a report page, above the body of the report. While a header can contain virtually any information, it often contains such items as the report title, company name, date, range of dates covered by the report, etc. Seagate Crystal Reports gives you the option of printing the header on all pages or on only selected pages of a report.

Highlighting Expert

The Highlighting Expert is most commonly used for highlighting number or currency field values that are in some way distinguished from the other values in the report. The Highlighting Expert offers a wide range of conditional formatting, including font color, background color, and border style.

You can think of the Highlighting Expert as an advanced formula editor that runs the following equation: If Condition is True, Then Apply These Formatting Specifications.

HTML

The language used by the World Wide Web to publish linked web pages on the Internet.


I

index

An index is a small file that identifies the location of each record in a database. Since a tiny index file can be searched or sorted much quicker than a large database, Seagate Crystal Reports uses index files to speed up the report generation process. In a search, for example, Seagate Crystal Reports searches the index for the correct field location. Once found, the program goes directly to the database field. Such a search does away with the need for searching every field of every record in a database. A database may have several indexes, each based on a specific field (or fields).

indexed fields

Fields in the database that are in a specific order to speed up the retrieval of particular records. Instead of searching through all the data in all the records, the program goes first to the index, and finds a pointer that direct it to the specific record it is looking for. Indexed fields are tagged with arrowheads in the Section Expert.

in-place editing

The ability to change an OLE object's properties while in Seagate Crystal Reports. The menu items change to provide the editing tools from the server application so that you can make changes easily.

in-place ruler

The ruler that appears when you are editing a text object. This ruler enables you to set tabs, and position objects with precision.

insertion point

The insertion point is a vertical line that indicates the point at which Seagate Crystal Reports will insert any text that you type in. You set the insertion point by moving the I-beam cursor to the position you want to insert text and click. When typing text for the first time in a Design Tab section, the program sets the insertion point flush left in the section, regardless of where you click the I-beam cursor.

integer

An integer is a positive or negative whole number or zero. Integers have no decimal places.


L

link

A link is a field that is common to two or more databases and that serves as a connecting point between those databases. Seagate Crystal Reports uses the link to match up records from one database with those from the other(s). For example, if the databases each contain a customer number field (even though the fields might have different names), Seagate Crystal Reports can use those fields to electronically connect all records in one database with corresponding records in the other(s). When you create a single report based on multiple databases, the link assures that all the data in each row on that report refers to the same customer (transaction, invoice, etc.).

Note: The term "link" in Seagate Crystal Reports is equivalent to the term "relationship" in Microsoft Access.

linked object

A linked object contains a presentation of the object, and a pointer to a defined part of the server document. When you modify the original object in the server document, the links assure that the object in your report is modified automatically as well. Conversely, if you modify the object in the container document, the original object file is modified as well.

live header

A live header is a header that changes dynamically with the content of a field. If you group your data by region, for example, a typical live group header would print the name of the region at the beginning of each group.


M

Map Expert

The Map Expert is a powerful tool for better organizing your data by placing geographic maps on a report. You can drill-down on these maps to see the underlying data.

Microsoft Foundation Class

The Microsoft Foundation Class (MFC) is an object-oriented programming interface that encapsulates many related function calls into one object.


N

nesting

In Seagate Crystal Reports, nesting means to use one If-Then-Else expression inside another. For example, If employee's degree is not Ph.D. Then (if employee's sex is male, use the salutation Dear Mr. Else use the salutation Dear Ms.) Else use the salutation Dear Dr. In this example, the nested If-Then-Else statement is surrounded by parentheses. The example says, check the degree field on the employee record to verify that the employee is not a Ph.D. If that condition is true (the employee is not a Ph.D.), then use a letter salutation based on the sex indicated on the employee record. (If the sex is male, Then use a male salutation. Else [if the sex is female] use a female salutation.) Else (that is, if the employee is a Ph.D.), use a Dr. salutation. By using this type of formula construction, you can create a wider set of conditions and a wider set of consequences easier than you could without nesting.

null

Null means there is no value within a database field for a given record. It does not mean zero because zero is a value.

null string

A null string is an empty string. It contains no characters. If you were to use the Count function to count the string, it would return a length of zero. "" is used to designate a null string.

numeric

Numeric data is data on which you can perform arithmetic. The designation numeric refers to the way the data is treated by Seagate Crystal Reports and database programs, not to the way the data looks to you.

For example, a serial number 12345 looks numeric, that is, every character is a number. But a serial number is not the kind of data on which you would want to perform arithmetic, so you would probably store a serial number as text instead of as numeric data.

Numeric is one of several data types. Database programs require you to designate a data type when you create a field for use in a database. The data type you select determines the rules the program follows when dealing with the values stored in that field.


O

object

An object is one of several kinds of report elements that generally contain data and have specific properties that define their behavior or appearance. The program uses the following kinds of objects:

  • field
  • text
  • cross-tab
  • graph
  • subreport
  • picture
  • OLE.

Each of these objects can be individually formatted, moved, resized, duplicated, and so on.

object frame

An object frame is a rectangular cursor that appears as an aid to placing database fields and formulas on your report. Once you have selected a field or created a formula, the object frame appears. When you move the frame to the place in the report you want the field or formula to appear and click the button, the program inserts the item at the point specified.

ODBC

ODBC stands for Open Database Connectivity. It is an interface that gives applications the ability to retrieve data in data management systems using SQL for accessing the data. Such an interface allows a developer to develop, compile, and ship applications without targeting specific database management systems. Also called interoperability.

OLE

OLE is an acronym for Object Linking and Embedding. It refers to the ability to create compound reports, that is, reports that contain elements from other applications and that can be edited using the original application.

OLE container application

An OLE container application is an application that can contain and process OLE objects created elsewhere (like Paint or Paintbrush). Seagate Crystal Reports is a container application.

OLE server application

An OLE server application is an application that can create OLE objects that can then be placed in documents created by container applications. Seagate Crystal Reports is a container application, whereas Microsoft Word and Excel are examples of server applications.

on-demand subreport

On-demand subreports appear only as hyperlinks in the main report.

The actual data is not read from the database until the user drills down on the hyperlink. Only data for the on-demand subreport that is actually viewed will be retrieved from the database. On-demand subreports may also be called "real time" subreports in some cases.

one-to-many

One-to-many refers to a situation occurring in linked databases in which one record in one database can be matched with many records in another database. An example of a one-to-many link would occur when linking a customer table to an orders table. In such a case, for every one customer in the primary database, there would typically be many orders in the second (lookup) database.

operator

An operator is a special symbol that describes an operation or an action to take place between two or more values.

The symbol / for example, is an operator that means divide. A/B means Divide A by B. Seagate Crystal Reports reads the operators in a formula and performs the actions specified. Seagate Crystal Reports contains arithmetic, string, comparison, Boolean, conversion, date, and range operators, among others.

order of precedence

The order of precedence is a set of rules that determines the order in which arithmetic operations take place in a formula that involves multiple arithmetic operations. Multiplication (*) and division (/) are performed first (first tier operations), followed by addition (+) and subtraction (-) (second tier operations). When there are multiple operations involving the same tier, the order of precedence dictates that the operations are performed from left to right. You can use parentheses, if you wish, to alter the normal order.


P

Page Footer

A section that prints at the bottom of each page. Page footers are typically used for page numbers, chapter names, and other identifying information.

Page Header

A section that prints at the top of each page. Page headers are typically used for titles and other identifying information.

parameter field

A special kind of field that prompts the user for a value. You can use parameter fields for report titles, record selection, sorting, and a variety of other uses. Using parameter fields enables you to create a single report that you can modify quickly to fit a variety of needs.

Note: The term "parameter field" in Seagate Crystal Reports is equivalent to the term "parameter queries" in Microsoft Access.

paste

Paste means to retrieve and place data from the Clipboard into a report or formula. The data may have been cut from the same report or formula or from a different one.

population

A population is the entire set of values that might be tested statistically, as opposed to a sample which is a subset of the population. A population does not necessarily refer to a group of people; it can refer to the number of automobiles produced on an assembly line or the number of construction companies bidding on a project.

For example, a real estate agent might sell 20 houses in one year. The population of houses sold by that agent in that year is 20.

population standard deviation

Population standard deviation is a statistical test of how the values in an entire population (all values) deviate from the mean or average value for that population. Population standard deviation is most often used when all values are being evaluated as opposed to just a sample of those values (StdDev).

Note: This comparison simply suggests typical usage. In practice, some users prefer a calculation based on N values (PopulationStdDev) while others prefer a calculation based on N-1 values (StdDev). Both forms of standard deviation are provided by the program.

population variance

Population variance is the square of the standard deviation. It is a measure of the amount by which the values in an entire population vary from the mean (average) value for that population.

Population variance is typically used when all values are being evaluated as opposed to just a sample of those values (Variance).

Note: This comparison simply suggests typical usage. In practice, some users prefer a calculation based on N values (Population-Variance) while others prefer a calculation based on N-1 values (Variance). Both forms of variance are provided by the program.

properties

Properties are qualities that define the appearance or action of an object or a section. There are two kinds of properties:

  • On/Off
    A property that can only be toggled on or off.
  • Attribute
    A property for which you have to supply a value.


R

range

A range is a set of values that fall between and include a defined upper and lower limit. For example, the range 10 to 20 includes 10, 20, and all the numbers that fall between. Also, the range January 1, 1991 to January 30, 1991, includes January 1, January 30, and all the dates that fall between. In Seagate Crystal Reports, a range can consist of numbers, dollar amounts, or dates.

record

In a database, a record is a complete unit of related information, an electronic file folder that holds all of the data on a given entity. Each record contains one or more fields that contain the specific pieces of data of interest. In a customer database, for example, a record would store all of the data on a single customer. In an inventory database, a record would store all of the data on a single inventory item. Data from an individual record is displayed or printed as a row of data on a columnar report.

report

A report is simply an organized presentation of data. As a management tool, a report is used to provide management with the insight it needs to run an organization effectively. Seagate Crystal Reports allows you to create comprehensive, customized, attractive management reports quickly and easily. But report in Seagate Crystal Reports also refers to invoices, form letters, mailing labels, and other related items that require the organization and output of data.

Report Footer

The Report Footer section is the last section of a report in the Design Tab. You can place a summary in this section that you want to appear only on the last page of a report.

Report Gallery

The Report Gallery is a special dialog box that appears when you click the New button on the standard toolbar or choose the New command from the File menu. The Report Gallery serves as a gateway to all the report creation experts and to the graphical interface for selecting the report and data type for creating custom reports.

Report Header

The Report Header section is the first section of your report in the Design Tab. You can place a title in this section, or any data you want to appear only on the first page of your report.

request

A request is a set of criteria that specifies the subset of data that you want to use for your report. For example, if you want your report to contain only California data, you can create a record selection request that retrieves only California records for your report. You create record and group selection requests using the Section Expert.

returns

The word "returns" refers to the result of a function, an operator, or a formula. For example:

  • When using a function, it performs a calculation or manipulation that results in a data change of some kind. The data that results is what the function returns. For example, Average(1, 2, 3, 4, 5) returns the average of the array 1, 2, 3, 4, 5. Truncate(1.2345) returns the integer (whole number) portion of the number 1.2345.
  • When using an operator, the result of the operation using that operator is what the operation returns. For example, 5*6 equals 30. You can say that the operation 5*6 returns 30. Also, the operation 100<200 compares the two values and returns True; 200<100 compares the two values and returns False.
  • When using a formula that contains functions or operators, each function or operation within the formula returns a result, but the formula taken as a whole returns a result too. When talking about a formula, it is the result of the formula that is of interest, not the result of individual functions or operations. For example, in the following formula:
    If {file.QTY} < {file.REORDERAMOUNT} Then

        "Reorder "

    Else

        ""

an internal operation compares the value of the {file.QTY} field with the value of the {file.REORDERAMOUNT} field. If {file.QTY} is less than {file.REORDERAMOUNT}, that individual operation returns the value True, but that is not what the formula taken as a whole returns. The formula, taken as a whole, returns the flag "Reorder" when the operation internally returns the value True.

row

A row is the display of data from a single record. Rows run horizontally across the page. The words row and record are sometimes used interchangeably in this manual. Contrast with column.

ruler

The ruler provides a visual reference for positioning and resizing fields, graphs, lines, boxes, and bitmaps. The increments on the ruler are based on your measurement settings in the International section of the Windows control panel. The ruler also enables you to change page margins while immediately seeing the results of your changes on the report itself.

The Ruler is visible in both the Design Tab and Preview Tab when their respective check boxes are toggled on in the Options dialog box.

running total

A running total is a total that is displayed generally on a record by record basis. They total all records (in the report, in the group, and so forth) up to and including the current record. For example, if your first three records have values of 2, 4, and 6, the running total for each of the three records would be 2, 6, and 12, respectively.


S

sample

A sample, as used in statistics, is a subset of a population used to represent the entire population. Researchers frequently do not have the option of testing an entire population before forming conclusions based on their tests. In such cases, they use a sample to represent the whole.

For example, political polling before elections is often based on questioning only four or five hundred people. From the answers given by this sample, predictions can be made on how an entire nation will vote.

scroll bars, scrolling

Sometimes a window can display only a portion of a document. In such a case, the window includes scroll bars that you can use to move other parts of the document into the window for your review.

Scroll bars also appear with lists that are longer than the available window. The scroll bars allow you to move back and forth through the list. The process of moving through a list or document using scroll bars is called scrolling. In Seagate Crystal Reports, the screen automatically scrolls whenever you move the cursor outside the window and press and hold down the button.

section

A section is a part of the report design environment. The program divides the design environment into several sections, each of which has different printing characteristics. You place objects in the various sections to build a report.

select

  • With regard to a report element (data field, formula, etc.), select means to point to the element and then click to choose the element as the object of the next menu selection.
  • With regard to text, select means to highlight the text by dragging the I-beam cursor over it.
  • With regard to records, select means to identify and choose those records of interest while disregarding all others.
  • With regard to groups, select means to identify and choose those groups of interest while disregarding all others.

selection formula

A selection formula is a formula that specifies the records, or groups of records, you want included in your report.

server document

A server document is a file that stores the original OLE object.

server-side processing

Server-side processing is a feature that allows you to set up reports that perform the majority of their processing on the server. These reports push only relevant details to your computer, thus saving you time and memory.

shortcut menu

A dynamic menu available in the Design and Preview Tabs. Access the shortcut menu by highlighting an object and right-clicking.

Smart Processing Cache

The Crystal Web Report Server stores requested reports in the Smart Processing Cache directory. When a user requests a report through a web browser, the report is generated and stored in the cache. If another user requests the same report, the Crystal Web Report Server retrieves the report from the cache rather than generating it all over again.

Cached reports that remain unused for a long period of time are invalidated by the Crystal Web Report Server. Periodic clean up processes delete invalid reports from the cache to make room for more recent or more popular reports. This process of caching frequently used reports and deleting unused reports provides an efficient use of web server and network resources, reducing repetitive report generation and network traffic.

snap property

Snap is a "magnetic" property that attracts nearby objects. Seagate Crystal Reports uses two facilities that have the snap property: Guidelines and the Grid. Whenever an object is moved close to a guideline or a grid coordinate, the program snaps it into position for accurate placement and alignment.

sort-and-group-by field

A sort-and-group-by field is a field that triggers the printing of a subtotal (or a group field value) whenever its own value changes.

For example, you may have a customer report that contains the {customer.CUSTOMER ID} and {orders.ORDER AMOUNT} fields. If you want to subtotal by customer (total the orders for each customer), click the {orders.ORDER AMOUNT} field as the field to subtotal and the {customer.CUSTOMER ID} field as the sort-and-group-by field. Seagate Crystal Reports sorts the data by customer, so that all orders from the same customer are grouped together. Then, whenever the value in the {customer.CUSTOMER ID} field changes (when it changes from one customer to a different customer), Seagate Crystal Reports prints a subtotal of the values in the {orders.ORDER AMOUNT} field (a total of orders for the individual customer). You can also use sort-and-group-by fields to trigger summaries.

sort direction

Sort direction describes the way records or groups are printed in your report. They are printed either in ascending (A to Z, 0 to 9), or descending (Z to A, 9 to 0) order.

sort field

A sort field is a data field on which the sort procedure is based. A mailing list, for example, could be sorted, in ascending order, on the {customer.POSTAL CODE} field; that is, the customers would be sorted so that those with the lowest postal codes would appear first and those with the highest postal codes would appear last. The report could also be sorted in ascending alphabetic order, on the {customer.CONTACT LAST NAME} field; that is, customers with last names beginning with A would appear first and those with last names beginning with Z would appear last.

sort order

Sort order is an indicator of the direction in which you want your data to be presented once it is sorted. Data is typically printed in one of two sort orders: ascending (lowest to highest, earliest to latest, first to last, A to Z, etc.) or descending (highest to lowest, latest to earliest, last to first, Z to A, etc.).

sorting

Sorting is a method of organizing the order in which data appears on your report. Seagate Crystal Reports provides you with powerful tools for sorting your report data.

SQL

SQL stands for Structured Query Language; a system for managing, organizing, and retrieving data stored on a computer database. Structured Query Language is a computer language that enables you to interact with a specific type of database called a relational database.

SQL pass-through

The ability to get the SQL Server to process the data retrieval criteria in order to pass the smallest possible result set back to Seagate Crystal Reports for final processing. When processing can be passed-through to the server, it makes the reporting process more efficient and it minimizes network traffic.

standard deviation

Standard deviation is the square root of the variance. It is a statistical test of how various values in a set of values deviate from the mean or average value for that set. You can use standard deviation, for example, for assessing the relative difficulty of tests given to students, for evaluating and projecting customer purchase patterns, or for comparing the results delivered by two or more products under evaluation (laboratory blood tests, smoke detectors, radar detectors, etc.). The uses are endless.

Standard deviation (as opposed to population standard deviation) is typically used to project the standard deviation for an entire population (all values) based on testing only a small sample of that population. For example, a company producing batteries with a new manufacturing process might want to test the batteries to determine how long they will last before they go dead. If the company tested all of its batteries, it would have no product left to sell. As an alternative, the company might test thirty batteries selected at random and project the mean burn out time and standard deviation for all batteries based on the results from that thirty battery sample.

Note: This comparison simply suggests typical usage. In practice, some users prefer a calculation based on N values (PopulationStdDev) while others prefer a calculation based on N-1 values (StdDev). Both forms of standard deviation are provided by the program.

static OLE object

A static OLE object is a picture of an object that is stored in a document when it is saved. The picture can be displayed or printed by a user who does not have the application in which the original object was created. The object can not be edited in place, however, without first converting it to an editable type of object. Static OLE objects offer better online and print performance than do standard bitmaps.

string

A string is a series of connected characters (letters, numbers, symbols, spaces) stored and used as text. The word "hello" is a text string as is the phrase "Order # 2453" and the customer number "B30-124-777". Strings are sometimes referred to as text strings or character strings.

subreport

A subreport is a report within a report. It has all of the characteristics of a report with one exception: it can not itself include a subreport. Subreports can be free-standing or they can be linked to the data in the primary report. Seagate Crystal Reports enables you to insert as many subreports as you wish.

substring

A substring is simply a part of a larger string. "Columbia" is a substring of the string "British Columbia", "1040" is a substring of the customer number "B-1040-0032456", and "B" is a substring of the string "President Bill Clinton".

subtotal

A subtotal is a partial total, a total of a specific, limited group of data in a field. For example, given the following data:

1, 2, 3, 4, 5, 6, 7

a subtotal after the 3 produces the value 6 (1 + 2 + 3). A second subtotal after the 6 produces the value 15 (4 + 5 + 6).

A subtotal is the sum of all values from a single field, from all the records in a group. In a sales report, for example, if you subtotal the amount ordered by sales representative, Seagate Crystal Reports gathers all the records that belong to the sales representative and totals the amounts ordered from all the records.

summary

A summary is the value generated as the result of an evaluation, a tally, or a calculation performed on data from a single group.

In a group average, Seagate Crystal Reports averages the values in a group of records; in a group count, it counts the values in a group of records, and so forth. Summary values are important tools for creating powerful reports.

summary field

A summary field is a field that determines the sum of the values, the average value, the maximum value, the minimum value, or count of values in a group of values in a given field. Much like a subtotal, a summary field groups data to your specifications and then performs the requested calculation/determination.

suppress

If you suppress something it does not appear. In Seagate Crystal Reports you can suppress report sections (headers, details, and footers), rows and columns that don't contain a value, as well as specific values.

syntax

Syntax is a set of rules used to make a correct formula. When creating formulas, you have the option of using Crystal or Basic syntax.


T

tabs

Tabs are used in many dialog boxes and Experts in Seagate Crystal Reports. Tabs resemble the tabs on common file folders. Tabs always have text on them to indicate what you will find on the tab.

template

A template is a copy of a report used as the starting point for creating a new report. When a template is used, your original report remains unchanged.

text object

A text object is a specialized object that can contain text, database fields, and formula fields. It contains its own mini word processor that can be used for anything from adding a label to creating an entire document.

toolbar

A bar at the top of Seagate Crystal Reports application window which contains a number of buttons that you can click to activate the most frequently used commands.

total

A total is a sum of values. See also grand total, running total, and subtotal.

truncate

Truncate means to cut off or eliminate all data that comes after the decimal point. Thus, if you truncate 1.2345, you get the value 1. If you truncate the value 1.9999 you also get the value 1. Truncate does not round data, it simply cuts off unwanted data.

two pass formula/function

A two pass formula is a formula that requires two passes through the data for completion. The first pass performs some calculation or selection and the second pass performs a calculation or selection that uses the result generated by the first pass.

An example of a two pass formula is one that calculates the sales for each sales representative as a percent of total company sales. The first pass sums the sales for each representative to arrive at total company sales. The second pass divides the sales per representative by total company sales to calculate the percent of total sales.


U

underlay

The ability of an object (a bitmap, a graph, etc.) to print beneath multiple sections which follow the section in which it was placed. For example, you can place a bitmap in one section, format the section to underlay the following sections and then expand the bitmap so it appears as a background for the entire page of your report.


V

value

A value is the data found in a field. In a field called {customer.CONTACT FIRST NAME}, for example, John or Mary might be the value. In a field called {orders.ORDER AMOUNT}, 1234.55 or $200 might be the value.

variance

Variance is the square of the standard deviation. It is a measure of the amount by which all values in a group vary from the mean (average) value in the group. It is a statistical test that can be used to evaluate the variability in a group of values (for example, the amount bid by each of the bidders on a construction project).

Variance (as opposed to PopulationVariance) is most often used to project the variance for an entire population (all values) based on testing only a small sample of that population. For example, with a limited number of bids in on a construction project, you might want to project the variance for all bids based on the sample already in. Or, based on sales figures for the first three months of the year, you might want to project the variance for orders for the entire year (including the nine months yet to come).

Note: These comparisons simply suggest typical usage. In practice, some users prefer a calculation based on N values (PopulationVariance) while others prefer a calculation based on N-1 values (Variance). Both forms of variance are provided by the program. For a more thorough discussion on the use of variance, consult any reliable statistics text.

verify

In Seagate Crystal Reports terms, verify does not mean to repair and compact the database (MDB file) in Access. It means to let the report understand the changes made to the database structure (fields and tables, NOT records).


W

wildcard

A wildcard is a character that represents any character (?) or any group of characters (*) in a search string. For example, if you are searching for Dan*, the search string will return strings like Danny and Daniel.

word wrap

Word wrap is a word processor-type property of a text object that automatically moves a word to the following line when the word is too long to fit the remaining space on the current line.