Introduction To Crystal Reports - Support4Omega · Web viewIntroduction To Crystal Reports 7...

82
INTRODUCTION TO CRYSTAL REPORTS Version 5 & 6

Transcript of Introduction To Crystal Reports - Support4Omega · Web viewIntroduction To Crystal Reports 7...

INTRODUCTION

TO

CRYSTAL REPORTS

Version 5 & 6

Table of Contents

TABLE OF CONTENTS....................................................2

INTRODUCTION TO CRYSTAL REPORTS.....................7

CREATING A SIMPLE REPORT......................................8THE TOOLBAR...................................................................................8THE REPORT GALLERY...................................................................8CUSTOM REPORT TYPES................................................................9DATA SOURCE TYPES.....................................................................9

The Report Design Window.................................................10THE FORMAT BAR..........................................................................10THE DESIGN TAB............................................................................10DESIGN & PREVIEW TABS.............................................................11PAGE CONTROLS...........................................................................11AREA/SECTION BOUNDARIES.......................................................11AREA SIZING BARS.........................................................................11

Placing Objects onto the Report.........................................12BROWSE BUTTON..........................................................................12SNAP TO GRID................................................................................12GUIDELINES....................................................................................12

Previewing the Report..........................................................14ZOOMING IN AND OUT...................................................................14

Positioning and Sizing Objects...........................................15MOVING A SINGLE OBJECT...........................................................15MOVING MULTIPLE OBJECTS........................................................15MOVING MULTIPLE OBJECTS WITH A GUIDELINE......................15RE-SIZING OBJECTS......................................................................15

Formatting Objects...............................................................16THE FONT TAB................................................................................16THE BORDER TAB...........................................................................16THE NUMBER TAB..........................................................................17

Inserting Text Objects on a Report.....................................18

Practice Session 1................................................................18

RECORD SELECTION...................................................19

Using the Select Expert........................................................19

Selecting Two or More Fields..............................................20ADDING ADDITIONAL FIELDS........................................................20MODIFY EXISTING SELECTION.....................................................20

Refreshing the Report Data.................................................21

Practice Session 2................................................................21

SORTING, GROUPING AND SUMMARIZING...............22

Sorting Records....................................................................22ADDING FIELDS TO THE SORT FIELDS LIST...............................22REMOVING FIELDS FROM THE SORT FIELD LIST.......................22CHANGING THE ORDER OF THE SORT LIST...............................22ASCENDING OR DESCENDING SORT ORDER.............................22

Grouping Records................................................................23CREATING A GROUP......................................................................23

Working with Groups...........................................................24CHANGING THE GROUP DEFINITION...........................................24

Summarising.........................................................................25INSERTING A SUMMARY OR SUBTOTAL ON A REPORT............25INSERTING A GRAND TOTAL.........................................................26

Practice Session 3................................................................26

LINKING..........................................................................27

Using the Visual Linking Expert..........................................27THE BUTTONS.................................................................................27

Adding a Database to a Report...........................................28

Removing a Database from a Report..................................28

Linking Methods...................................................................28SELECTING A LINK.........................................................................29CREATING A LINK...........................................................................29DELETING A LINK............................................................................29REVERSING A LINK.........................................................................29

Practice Session 4................................................................29

QUICK FORMAT OPTIONS...........................................30

Auto Arrange Report............................................................30

Report Style Expert..............................................................30

SPECIAL FIELDS...........................................................31

Formatting Special Fields....................................................31FORMATTING DATE FIELDS..........................................................31

Lines and Boxes...................................................................31DRAWING A LINE............................................................................31DRAWING A BOX.............................................................................32

Inserting a Picture................................................................32

Practice Session 5................................................................32

TEXT OBJECTS.............................................................33

Using Text Objects...............................................................33THE CAN GROW OPTION...............................................................33Combining Text Objects with Special Fields.....................................33

Formatting Text Objects as a Whole...................................33

Formatting Text or Fields within a Text Object..................34

Setting Tabs in a Text Object..............................................34

FORMULA BASICS........................................................35

The Formula Editor...............................................................35FIELDS BOX.....................................................................................36FUNCTIONS BOX.............................................................................36OPERATORS BOX...........................................................................36FORMULA TEXT BOX......................................................................36

Inserting a Basic Formula....................................................36

String Manipulations............................................................36

Basic Date Calculations.......................................................37

If-Then-Else Formulas..........................................................37

Boolean Formulas................................................................37

Practice Session 6................................................................37

CONDITIONAL FORMATTING.......................................38

Practice Session 7................................................................38

FORMATTING SECTIONS.............................................39

Changing the Size of a Section...........................................39

Formatting Using the Section Expert.................................39THE COMMON TAB.........................................................................40THE COLOR TAB.............................................................................40

THE OMEGA DATABASE STRUCTURES.....................41

The Market Database............................................................41

The Product Database..........................................................43

Part Specification.................................................................46

Quotations.............................................................................48

Sales Orders.........................................................................49

Works Orders........................................................................50

WIP Control...........................................................................51

Despatches...........................................................................52

Invoices.................................................................................53

REPORT DESIGN CHECKLIST.....................................54

USEFUL FORMULAE.....................................................55

Conversion of Date to Week Number.................................55WeekNumber Formula......................................................................55WeekOffset Formula.........................................................................55

Convert a String of Characters to a Date...........................55

Calculate the Number of Days Between Two Dates..........56

Customer Panel Width Formula..........................................57

Customer Panel Length Formula........................................57

Printing “Hrs:Mins” on a Report from a Time Field..........57

TRAINING COURSE NOTES.........................................58

Introduction to Crystal Reports Versions 5 & 6

Introduction To Crystal Reports

Welcome to the world of Crystal Report writing!Crystal Reports is now recognised as a leader in database interrogation and report preparation systems. There are two versions in current use today (v5 and v6). The primary difference between them is that v6 has greatly improved functionality with Internet and Intranet capabilities. However, getting started in crystal Report writing is the same in both versions which is why this manual covers both.This Introductory Course is designed to provide the basic skills which are required to produce and design presentation quality reports.Crystal Reports uses the standard conventions that are common to Windows v3.x, 95, 98 and NT. All the screen shots in this manual are taken from Windows 95 but apart from the Windows conventions and some tool-bar positioning they are identical in all environments.Any training manual struggles to encapsulate all aspects at its aimed skill level which is why users of any software should become familiar with the software's own HELP system as soon as possible. What this manual will provide is an introduction to key issues and with Crystal terms explained in English.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 7 of 65

Introduction to Crystal Reports Versions 5 & 6

Creating a Simple Report

THE TOOLBAR

When crystal is loaded the tool bar only has the First two buttons active (New and Open) when a report is open, the other buttons are available. Each has a graphic that visually describes the command it represents. To select the command simply click on the button. Holding the mouse pointer over the button will display a brief description of that button’s action.To create a new report, either click on the New button or select File, New from the menu. The Report Gallery dialog box is displayed.

THE REPORT GALLERYThere are three basic methods in creating a new report.

1. Using one of Crystal’s eight Experts.2. Creating a report from one previously created (Another Report)3. Building from scratch (Custom Report)Selecting Another Report will display the File Open dialog box. Select the report upon which the new one will be based. Crystal will copy and display it on the screen, giving a default name such as Report 1.Selecting Custom>>> will extend the Report Gallery dialog box. See graphic below.

CUSTOM REPORT TYPESCustom Report create any style of report from scratch.© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 8 of 65

Introduction to Crystal Reports Versions 5 & 6

Custom Cross Tab create a cross tab report.Custom Multi-Column create mailing labels without using the Expert.

DATA SOURCE TYPESData File create a report from a PC database, such as dBase or Access.SQL/ODBC create a report from a client/server database or any other database using

ODBC connection.Dictionaries create a report from a Crystal Dictionary or Crystal QueryThis course is based on using the Custom Report button Data File.By selecting the Custom Report and Data File buttons, the Choose Database File dialog box appears. Select the database required.

Clicking OK will display the Visual linking Expert screen. This is covered later in the course. Clicking OK on the visual linking expert returns to the design window.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 9 of 65

Introduction to Crystal Reports Versions 5 & 6

The Report Design Window

THE FORMAT BAR

This bar provides many of the popular formatting options.

THE DESIGN TABThis window is divided into five areas.

Report Header Objects placed here will print only on the first page of the report. Often the name of the report the print date, company name and logo.

Page Header Objects placed here will print on every page of the report. Column headings, print dates and page numbers are common examples.

Details Data fields are placed here. This is the information (database and text) that prints for each record selected.

Report Footer Objects placed here will only appear on the last page of the report. Grand totals and summary information are often placed here.

Page Footer Objects placed here will be printed on every page, i.e. page numbers.

DESIGN & PREVIEW TABSOnce one or more field objects have been placed in the report in the Design tab view, the report can be populated with data. Further work on the report can now be done in either the Design tab or the Preview tab. © Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 10 of 65

Introduction to Crystal Reports Versions 5 & 6

The latter provides the ability to manipulate the report whilst viewing actual data. However, note that designing in the Preview tab means any changes may require extra time to process as Crystal has to re-populate with actual data.To activate the Preview tab, click on the Preview button.

PAGE CONTROLSThese allow movement forwards or backwards a page at a time, to move to the First or last page. The button with the X will close a preview or design tab which is open. This is particularly useful when working with complex reports which incorporate one or more sub-reports. The button with the small square stops a report running through to the last page if the last page button has been pressed.

AREA/SECTION BOUNDARIESRight click in any of these areas to access the Format Section menu which allows modification of how each area is displayed.

AREA SIZING BARSThese separate the areas, and can be moved to change the amount of space reserved for each area.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 11 of 65

Introduction to Crystal Reports Versions 5 & 6

Placing Objects onto the ReportDatabase fields, formula fields, drawing lines and boxes are all examples of objects that can be placed on a report.Clicking on the Insert Fields button or selecting Insert, Database Field frorn the menu allows the insertion of not only a database field but also Formulas, Parameters and Name fields.

There are four ways to insert a data field into a report.1. For a single field, simply drag the field on to the report.2. Select the Field, click on Insert and click on the report where the field is required.3. Select multiple fields by using Ctrl-click and then drag them onto the report.4. Select multiple fields, click on Insert and click on the report to insert the fields.

BROWSE BUTTONThis allows the previewing of a sample of the data for the field highlighted. Note that right-clicking on a field in the Design or Preview tab allows the browsing of data using the the shortcut menu.

SNAP TO GRIDWhen placing objects on a report, Crystal uses a default setting known as “Snap to Grid”. A grid is a series of imaginary horizontal and vertical lines, which Crystal shows as a row of dots. When using this feature, objects placed will automatically “snap” to the nearest grid line. This makes it easy to line up objects both horizontally and vertically. However, to have the freedom to place objects anywhere on the design window, it is possible to turn off this option via the menu File, Options, Layout tab.

GUIDELINESWhilst the grid is very useful in lining up objects, should two or more objects on the same horizontal or vertical row need to be moved, the use of a guideline could prove invaluable.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 12 of 65

Introduction to Crystal Reports Versions 5 & 6

To create a guideline, click in either the horizontal or vertical ruler. A small arrowhead (triangle) will mark the point of the guideline with a dashed line extending from it to the opposite side. Objects dragged to the guideline will “attach" themselves to it. To move all the objects together, drag the guideline arrowhead to the new location. Crystal Reports will automatically place a vertical guideline for each data field placed on the report. Then, if data fields are to be moved, their column headings will also move with them.To detach objects from a guideline, either drag the object up for vertical guidelines and left for horizontal guidelines.To remove a guideline, click and drag the guideline's arrowhead off the ruler and release.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 13 of 65

Introduction to Crystal Reports Versions 5 & 6

Previewing the ReportCrystal Reports allows viewing of the results of the design in the Preview tab where full appreciation of the placement of data objects and colour can be seen. Full design capabilities are available in the Preview tab to allow further development and/or fine-tuning.

ZOOMING IN AND OUTSelecting the zoom button will toggle the view of the report between three settings, Choosing View, Zoom from the menu allows the option to have any percentage of zoom between 25% and 400%.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 14 of 65

Introduction to Crystal Reports Versions 5 & 6

Positioning and Sizing ObjectsOnce fields and objects are placed on a report, they may need to be re-positioned or re-sized. This can be done from within the Design or Preview tabs.

MOVING A SINGLE OBJECTClick on the object once to display the handles. Then click and hold on the object with the 4-way cursor and drag it to the new position.

MOVING MULTIPLE OBJECTSTo move multiple objects using the same 4-way cursor, click on the first object, then, holding the CTRL key down on the keyboard, click on the remaining objects.Alternatively, create a “marquee” to move them. Using the cursor, click down and draw an imaginary box around the objects to move, let go and all the objects surrounded by the “marquee” will be highlighted.Once the group has been selected, click and hold on one of the objects and the 4-wav cursor will appear as you drag all the selected objects to a new position.

MOVING MULTIPLE OBJECTS WITH A GUIDELINEWhen data fields are placed into the Details area, guidelines were created. Providing the data fields are attached to a guideline, they can be moved simply by grabbing the arrowhead and moving it the new position.

RE-SIZING OBJECTSTo re-size an object, click on it once to select it. Once the handles appear, drag on one of them to adjust the size of the object. Multiple objects can be resized using either the “marquee” method or by selecting each object with the CTRL key as described above.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 15 of 65

Introduction to Crystal Reports Versions 5 & 6

Formatting ObjectsObjects placed on the report can be formatted to maintain a common presentation appearance. For example, database fields can be formatted to print with colours, different fonts and even background shading.To format one or more objects, select the object(s) and choose Format Field from the shortcut menu.

THE FONT TAB

The font tab allows changes to the font, style, size, colour, underline and strikeout. The sample box will show the effect of any changes made.

THE BORDER TAB

The border tab assigns line styles to any or all of the sides of a text object. Drop shadow, and background colours can also be added to the text object.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 16 of 65

Introduction to Crystal Reports Versions 5 & 6

THE NUMBER TAB

Numeric Fields can be formatted as follows:Use Windows Default Format

Makes Crystal apply the settings in your windows control panel to numeric fields.

Suppress if Zero If the value printed is zero then the report will show nothing.Decimals/Rounding Displays the number of places and rounding required.Negatives Four different ways to show negative values.Decimal Separator Specify the character required to display as a decimal separator.Thousands Separator Specify the character required to display as a thousands separator. The separator

can be turned on or off.Leading Zero Toggle leading zero’s on or off.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 17 of 65

Introduction to Crystal Reports Versions 5 & 6

Inserting Text Objects on a ReportReports are made easier to follow by the use of titles, sub-titles and descriptive text. Text objects can hold more than just text, they are mini word processors with word wrap and independent formatting with fonts colours and tabs. Additionally, they can be formatted as left, centre, right or decimal alignments within the text object.To insert a text object select either the Insert, Text Object from the menu or click on the button, a new empty text object will now be attached to the cursor. Position the text object and then click on the left mouse button to release.The cursor will then be flashing within the text object, ready for the text to be entered. Notice that the ruler bar is provided for the setting of tabs and indents. When finished with the text object, click outside of it with the mouse to deselect.To edit the text object simply double click on it or right click and choose Edit Text Object from the shortcut menu.To move or re-size the text object, click once on the object to activate the handles as with fields.

Practice Session 1Create a report from Market Database DataReport should have a titleReport should have a page headingDetails section should show Customer Code, Customer Full Name, Rep Code and Area CodeFields should have headingsSave the report file

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 18 of 65

Introduction to Crystal Reports Versions 5 & 6

Record Selection

Using the Select ExpertVery few reports will show all the data from all the records in a database. Usually, only certain fields are selected as already discussed. Similarly, only certain records are required. This usually means data based on certain geographical areas or people or offices or dates, etc. Often, record selection is based on several criteria. For example, all sales of a particular set of products in Wales only during the last month.Crystal Reports allows this by using the select expert. To activate, either click on the Select Expert button, choose Reports, Select Expert from the menu or right click on the field and choose Select Expert from the shortcut menu.The first time the select expert is used in a report, it will prompt for a field to be selected. Once you have indicated the field you wish to set the selection on then the Select Expert opens.Subsequent selection will display the Select Expert dialog box immediately.

Record selection does not have to depend only on a field or fields already in the report. Other fields in the database can be used or a formula can be created to form the selection criteria.

The drop down boxes will assist in building the selection criteria.

Any value Will select all recordsEqual to Allows one specific value, so that only matching records are selectedOne of Allows selection from a series of specific valuesLess than Allows selection from records less than a specific value

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 19 of 65

Introduction to Crystal Reports Versions 5 & 6

Greater than Allows selection from records above a specific valueBetween Allows selection from records falling within a rangeStarting with Allows selection from records based on the first character(s) of the data fieldLike Allows selection from records using the MS-DOS wildcards “?” and “*”Formula Allows selection from records based on a formulaIn the period Allows selection from records based on a date rangeIn the third drop down box enter the specific values which the selection process is to use or select a value or values from the database by clicking on the drop down button.

Selecting Two or More Fields

ADDING ADDITIONAL FIELDSOften reporting requires the use of more than one selection.

Either click on the New tab or click on the New button. A dialog box will open, choose the desired field, click OK and complete the select expert box as previously explained. The report will only produce data that matches both criteria.Note: The Select Expert only provides a multiple selection criteria based on all the selected fields meeting the values assigned. For example customers in London with orders over £10,000 during January 1999. Crystal can select records meeting alternative criteria, for example customers in London OR Cardiff with orders over £10,000 during January 1999. This is a more complicated selection formula and would need to be composed using the Show Formula button and then edit the formula.

MODIFY EXISTING SELECTIONModifying the existing selection if easy. Click on the Select Expert button to display the Select Export and make the changes.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 20 of 65

Introduction to Crystal Reports Versions 5 & 6

Refreshing the Report DataCrystal Reports only reads the database when necessary. During the first preview of the report, Crystal retrieves the required data and retains within the report. This saves time whenever the report is opened and read.However, there are times when the data in the report needs to be updated for example:1. If fields are added to the report2. If a formula is added that refers to a field that was not originally in the report.3. If the record selection is modified to include more records.4. If the data in the database has changed.To force Crystal to refresh, click on the Refresh button or select Report, Refresh Report Data from the menu.

Practice Session 2Use report created in session 1A) Produce a listing for just one Rep CodeB) Produce a listing for just one category

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 21 of 65

Introduction to Crystal Reports Versions 5 & 6

Sorting, Grouping and Summarizing

Sorting RecordsHaving placed the appropriate data on to the report and selected the set of records to report on, organizing it all into some logical order will further enhance the report for the reader.Using the Record Sort Expert, records can be displayed in a desired order. Choose from the menu Report, Sort Records or click on the Sort Order button to activate the Record Sort Order dialog box.

ADDING FIELDS TO THE SORT FIELDS LISTAll fields currently on the report will be listed in the left hand window “Report Fields”. To select the first sort requirement, highlight the field and click on the Add button. The order in which the fields are selected in the “Sort Fields” window will determine the sort order.

REMOVING FIELDS FROM THE SORT FIELD LISTSelect the field to remove and then click on the remove button.

CHANGING THE ORDER OF THE SORT LISTTo change the order of the sort sequence, the fields need to be removed and then replaced in the new required order.

ASCENDING OR DESCENDING SORT ORDEREach field in the “Sort Fields” window can be assigned a sort direction. Crystal will automatically assign Ascending. To change the sort direction, simply select the field and click on Ascending or Descending in the Sort Direction radio set.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 22 of 65

Introduction to Crystal Reports Versions 5 & 6

Grouping RecordsEven though the records are now sorted it may be logical to have them displayed in groups. For example, if the last six months of production figures are required then group them in months. Once done, Crystal can summarise the information. Groups can be based on fields already on the report, database fields that are not on the report and even on formula fields. Once a group has been created it will have it’s own Group Header and Group Footer.

CREATING A GROUPFrom the menu select Insert, Group, then Insert Group dialog box will then appear.

In the first drop down box select the field to group on. In the second, select the sort order.In ascending order A to Z, 1 to 9, lowest to highest.In descending order Z to A, 9 to 1, highest to lowest.In original order Leaves the records in the same order as found in the database.In specified order Allows the creation of a group based on a specified value.Keep group together Select this option to prevent groups from being split across pages. If there is

insufficient room to print all records from a group on the current page then Crystal will print on the next page.

Repeat group header on each new page

Crystal Reports can print the name of the group in the group header. If the records from that group span a number of pages it is useful to repeat the group header and therefore name on each new page.

Group names are commonly found in the Group Header whilst summary information can be found in the Group Footer.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 23 of 65

Introduction to Crystal Reports Versions 5 & 6

Working with GroupsTo remove a group from the report click in the grey area on the left of the design window, then right click over the group header or group footer that you want to remove. Choose Delete Group from the shortcut menu.

Once chosen, a warning dialog box will appear to say that this command cannot be undone. Click Yes to continue.

CHANGING THE GROUP DEFINITIONGroups can be changed by selecting Change Group option from that same shortcut menu.

Note: It is important to note that there cannot be two groups of the same name. If several groups have been selected and then found to be in the wrong order, delete them and re-select. This is not the only way but it is the simplest assuming the report is not overly complex. For that reason, it is recommended that the grouping order be selected Before building the report.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 24 of 65

Introduction to Crystal Reports Versions 5 & 6

SummarisingA distinct benefit of grouping information is being able to summarise the data. Crystal offers a variety of summarising tools including subtotals, a count of entries and averages.

INSERTING A SUMMARY OR SUBTOTAL ON A REPORTSelect the field to summarise on and then either click on the Insert Summary button, or right click on the field and select Insert Summary/Insert Subtotal from the shortcut menu, or choose Insert, Summary/Insert, Subtotal from the menu bar.

In the first drop down list select the summary operation to be performed. Options available depend on the type of data, for example:Text or data fields Numeric fieldsMaximum SumMinimum AverageCount Maximum

MinimumFrom the second drop down list, select the group on which the summary is to be performed. Select OK when finished.The following illustration shows grouped and summarised records:

In this example there is a “Customer Count” which is not immediately recognisable. Adding a text field such as “Number of Customers” in front of the count would make it clearer to the reader.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 25 of 65

Introduction to Crystal Reports Versions 5 & 6

INSERTING A GRAND TOTALHaving produced summary information for each group, the report may benefit from a grand total which will be displayed at the end of the report in the Report Footer section. Grand totals can perform the same type of functions as summary fields, the options available depend on the type of data selected.Either choose Insert, Grand Total from the menu bar or right click on the field in the Details area and select Insert Grand Total from the shortcut menu.In the drop down box select the function the Grand Total is to perform and click OK. As with the group summary, the Grand Total may benefit from a descriptive text box.

Practice Session 3Load report created in session 1Add a group based on Rep CodeShow the number of customers per group in the group footerInsert grand total number of customers for the report

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 26 of 65

Introduction to Crystal Reports Versions 5 & 6

LINKING

The majority of reports will probably require data from two or more database tables. For the data to be properly selected, links have to be established between the tables. For example, to list orders from customers where the data is coming from a customer table and an orders table , it could be useful to make sure that only relevant orders for each customer are displayed.The process of linking these database tables is made easy in Crystal with the Visual Linking Expert. Whenever a database is added to the report, the Visual Linking Expert will open to assist in the linking process. It can also be opened by clicking on the Linking Expert button or via the menu by selecting Database, Visual Linking Expert.

Using the Visual Linking ExpertThe Visual Linking Expert dialog box looks like this.

Use the horizontal and vertical scroll bars to view all tables in the report if necessary.

THE BUTTONSOK Will accept the defined links and close the Visual Linking Expert.Cancel Will close the Visual Linking Expert without saving any changes.Options Will open the linking options box.Delete Will remove the selected link. If you inadvertently delete a link, click on Cancel to

close the dialog box without saving any changes.Tables Will open a dialog box allowing you to add or remove tables from the report.Arrange Will position the tables neatly on the screen so that they can be clearly seen with

their links.Smart Linking Will attempt to link the tables using “Best Guess”. Fields that share a common

name and data type will be linked.Indicates an indexed field (PC Type databases only)

Each link has an arrow showing the direction of the link.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 27 of 65

Introduction to Crystal Reports Versions 5 & 6

Adding a Database to a ReportThere are two methods available to add a database to a report.1. From the menu bar choose Database, Add Database. From the dialog box select the database to add and

click OK2. From the Visual Linking Expert click on the Tables button.

Any tables added to the report but left invisible will be shown in the “Invisible Tables” window. Sometimes this is useful to gain access to information via an intermediate table. To make tables visible and available for use within the report select the table and click on the <Add button. To make a table invisible and unavailable for use then highlight the name in the “Visible Tables” window and click on the Add> button.

Removing a Database from a ReportTo remove a table, select Database, Remove from Report from the menu bar. Note that a database table cannot be removed from the report whilst one of it’s fields is in use.

Select the database table you wish to remove, click on Remove and on Done when finished.

Linking MethodsCrystal Reports will automatically try to create links between database tables. However, very often the two fields that could be linked have different names so Crystal will ignore these for Smart Linking. In this instance these fields will have to be linked manually. When using PC data only fields which are indexed in the database can be linked. These are indicated with an arrow icon.If you wish to create links manually, then it is possible to turn the Smart Linking facility off. From the menu bar select File, Options, Database.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 28 of 65

Introduction to Crystal Reports Versions 5 & 6

Whether the links were created manually or using Smart Linking there are going to be times when you will need to modify a link.

SELECTING A LINKClick on the linking line and it will turn from black to white to indicate that it has been selected.

CREATING A LINKTo create a link, drag the mouse from the field to link from in one table to the field to link to in another table. If the link is valid aline will be drawn. If not, a warning message will be displayed.

DELETING A LINKSelect the linking line. Then either press the Delete key or select Delete, Remove from the shortcut menu.

REVERSING A LINKSelect the linking line. Then select Delete, Reverse Link from the shortcut menu.

Practice Session 4Produce a Contact List for customers (new report)Report should have a title pageReport should have a page headingGroup by rep codeGroup by Customer code within rep codeShow – Customer name, contact name(s), Tel No, Fax No, Job Title

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 29 of 65

Introduction to Crystal Reports Versions 5 & 6

Quick Format Options

Creating reports that are of presentation quality can take considerable time. Crystal offers useful tools to assist in this process.

Auto Arrange ReportFrom the menu bar select Format, Auto Arrange Report. Use the command to: Adjust the spacing between fields Reposition the fields Centre your report on the pages automatically

Report Style ExpertUse this command to apply one of ten predefined professionally designed styles to the report. From the menu bar select Fromat, Report Style Expert. The report style dilog box provides a preview of the way the report may look. To select the preferred design, simply highlight the style and click OK. The report style can be changed at any time by re-using the Report Style Expert.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 30 of 65

Introduction to Crystal Reports Versions 5 & 6

Special Fields

Special fields contain information that is not normally included in the database, but can be very useful on the report. From the menu bar choose Insert, Special Field.There are twelve to choose from.Page Number Field Prints the current page number.Total Page Count Field Prints the total number of pages in the report.Record Number Field Prints the current record number.Group Number Field Prints the current group number.Print Date Field Prints the current date field as per the computer.Print Time Field Prints the current time as per the computer.Data Date Field Prints the date the data in the report was last refreshed.Data Time Field Prints the time the data in the report was last refreshed.Last Modification Date Prints the date the report was last modified.Last Modification Time Prints the time the report was last modified.Report Title Prints the Title dialog contents (File, Summary Info).Report Comments Prints the Comments dialog (File, Summary Info).Once the field to insert has been selected, a field box will be attached to the cursor for placing in the report.

Formatting Special FieldsAs with database fields, the formatting options for each of the special fields will vary depending upon the data type.

FORMATTING DATE FIELDSRight click on the field and from the shortcut menu choose Format Field. Using the formatting dialog box format the field as required.Use Windows default format

Makes Crystal check the settings in your windows control panel and use those settings.

Order Specifies which will be printed first.Format Use the three drop down boxes to choose how the elements of the date will

appear. Leading Day Specifies if the day of the week that corresponds with the date is to be printed or

not. Can also specify the format for printing, ie. Full or abbreviated and the separators to use between the leading day and the rest of the date.

Lines and BoxesReports can be enhanced and made easier to read by the use lines and boxes. When working with lines or boxes it is best to do so within the design tab.Where the line or box is drawn will dictate how often it will appear. For example placing a line in the Report Header would print it only once, whereas a line in the Group Header section will print once for every group.Caution is required in using lines and boxes. Their over-use can make a report harder not easier to read.

DRAWING A LINEClicking on the Insert Line button or from the menu bar and choosing Insert, Line will provide the pencil cursor. Use the tip of the pencil to draw with. Position the pencil at the start point and by dragging your mouse, draw the line to where it should end. Once drawn, the line can be formatted via the shortcut menu and choosing Format © Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 31 of 65

Introduction to Crystal Reports Versions 5 & 6

Line. To move the line, select it as with a field, and use the 4-way cursor to move it to a new position. To re-size a line, click on it and use one of the sizing handles found at each end of the line.

DRAWING A BOXClicking on the Insert Box button or from the menu bar and choosing Insert, Box will provide the pencil cursor. Use the tip of the pencil to draw with. Position the pencil at the start point and by dragging your mouse, draw the box to where it should end. As with drawing a line, once the box is drawn, use the shortcut menu and Format Box to change its appearance. To move the box, select it as with a field, and use the 4-way cursor to move it to a new position. To re-size a box, click on it and use one the eight sizing handles.

Inserting a PictureIncluding a picture or graphic in reports adds interest for the reader or can provide corporate identity. The most obvious example being a company logo. It is recommended that placing pictures or graphics into a report should be done in the design tab.Click on the Insert Picture button or choose Insert, Picture from the menu bar. From the open dialog box select any .BMP, .PCX, .JPG, .TIF or .TGA graphic file.Select OK and a picture field object will be attached to the cursor. Place the upper left corner of the graphic where the picture is required and click the mouse button to release. The area or section selected will automatically expend to accept the image. Right click on the graphic to choose Format Graphic from the shortcut menu. This will provide, amongst other things, tools to crop, scale, size, add a border, change the colour of the border and add a drop shadow.

Sample of a graphic positioned in the Design tab.

Practice Session 5Create a new report based on the Order BookGroup on Sales Order NoIn Details section print Quantity & Date RequiredPlace a picture in the report headerSub total Quantity Required for each sales orderPlace Page Number, Print Date & Print Time in the page footerWhen report is complete, practice using the report style expert to arrange the report.Save the report when complete

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 32 of 65

Introduction to Crystal Reports Versions 5 & 6

Text Objects

Data makes up the majority of any report but it is made meaningful by combining data with labels or paragraphs to make them more readable.

Using Text ObjectsText objects can be used on their own alongside data or special fields. They can also be combined with data or special fields to make one field. A typical example is in merged letters where some data is incorporated into a paragraph of text so that any possible unwanted spaces are removed automatically, leaving the text to appear as if typed originally.To print a combination of text and field information the field has to be inserted into the text object. It cannot be dragged from the report into it. When inserting database fields into a text object, Crystal will automatically trim any trailing spaces from the ends of the data. Before attempting to insert a database field into a text object, the object must be in the edit mode. Simply double click on it, or right click and choose Edit Text Object.When ready to insert a database field, click on the Insert Fields button or choose Insert, Database Field from the menu bar.Use the scroll list in the dialog box to locate the required field and select it. Drag the field then into the text object, as the cursor approaches the object it will change from a warning circle to a + cursor. Do not let go of the mouse button until the vertical line within the text object is at the point where the database field is wanted.More than one database field can be added to one text object. Simply repeat the insert procedure for each one.

THE CAN GROW OPTIONOn occasions it is difficult to predict how long or tall to make text objects, particularly if the data field can vary in length. Remember to size objects with the printed result in mind. The design tab will not necessarily show the full field name. However, Crystal has a “Can Grow” option which will allow the text box to expand vertically if necessary. (Note that it will not expand horizontally.) To turn this option on, right click on the object and select Format Text from the shortcut menu. The format editor will open, simply click on the appropriate radio dial.

Combining Text Objects with Special FieldsText objects can be combined with special fields too. For example, it is not uncommon to place details of number of pages in the report and the current page number in the Page Footer; e.g. “Page 3 of 14 pages”.When inserting a special field follow the same steps as inserting a database field. Double click the text object to place it in text mode and position it where it is to print. Then from the menu bar choose Insert, Special Field. Select the required field to embed into the text, drag the field from the menu and drop it into the text object at the appropriate position and release the mouse button.

Formatting Text Objects as a WholeTo format a text object, right click on it and select Format Text from the shortcut menu. The Format Editor will then open.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 33 of 65

Introduction to Crystal Reports Versions 5 & 6

Formatting Text or Fields within a Text ObjectTo format an individual part of a text object, double click on the object to place in edit mode. Click and drag along the text or field within the object for formatting. Right click on the selected area and choose Change Font from the shortcut menu. The text format dialog box will sppear.

Setting Tabs in a Text ObjectEach text object can have their own tab settings. By default these are set to every half inch. To set new tabs, activate the text object into edit mode, once the rule appears.

Simply click on the ruler line where the tab is wanted. To move the tab, just drag it to it’s new position. To delete the tab, drag it off the ruler line and let go. To set other types of tabs click on the left hand box of the ruler line.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 34 of 65

Introduction to Crystal Reports Versions 5 & 6

Formula Basics

Text objects, data fields, summary and special fields will often cover a high proportion of a report’s information. However, there is often the requirement to manipulate data so it can be viewed in a more meaningful way. Examples include: Add, subtract, multiply or divide two or more pieces of data. Calculating the period between two dates. Displaying one piece of data as a percentage of another. Showing a text statement if data is critical; e.g. a customer in arrears.To do this, a formula field needs to be created and placed on the report. Crystal can perform an extensive range of data manipulation similar to many used in spreadsheets or databases.The Formula Editor provides the ability to combine fields and apply operators and functions to make a working formula.

The Formula EditorTo open the Formula Editor, click on the Insert Fields button or choose Insert, Formula from the menu bar. From the Insert Fields dialog box, click on the Formula tab. This provides the following tools.Edit Amend existing formulas.Rename Change the name of an existing formula.Delete Delete an existing formula. Note, however, if the formula is in use on the report

then Crystal will not allow it to be deleted.New Create a new formula by opening the Formula Name dialog box. Click OK and the

formula editor opens.

The formula editor has four sections.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 35 of 65

Introduction to Crystal Reports Versions 5 & 6

FIELDS BOXAll database fields and formulas are listed here. Those already included in the report are listed at the beginning under report fields. Note that by clicking on a field, the Browse Field Data becomes active. In this dialog box, sample data can be viewed.

FUNCTIONS BOXAll functions available are listed showing their arguments and are logically arranged. These are in built procedures supplied with Crystal.

OPERATORS BOXThese are special symbols describing actions which can take place between two or more values. Crystal reads the operators and performs the actions specified.

FORMULA TEXT BOXThis is where the formula is built or edited. Fields, functions and operators will appear at the position of the cursor as they are double-clicked in the above boxes. Experienced users tend to type in formula details and just double-clicking on required fields or existing formulas.The check button allows Crystal to check the formula for errors before selecting OK. If there is an error, the cursor will be placed in the area where the error has occurred.Listed below are some of the basic rules that apply to the formula language.// Denotes that everything following is a comment and will be ignored by the formula

compiler.() Denotes the arguments that follow a function. Many functions require more than

one argument, these will be separated by a comma within the brackets.{} Denotes fields. All fields, database, other formulas, specials etc. will be enclosed

in these.[] Denotes subscript or arrays. Square brackets before a function denotes an array.

Square brackets after a function denotes a subscript.“” Denotes literal. Any text between the quotes will be printed as they appear as part

of the result.Upper and lower case is ignored by Crystal, as are carriage returns. However, line breaks can be used so that long formulas can be split into manageable chunks.

Inserting a Basic FormulaClick on the Insert Fields button or select Insert, Formula Field from the menu bar. Select the formula tab and click on New and enter a formula name.Select the field and operators. In this example, the value of an order line is being calculated.{so_delsched_table.Quantity} * {so_delsched_table.Price Each}

Click on Check, and Accept if the formula is error free. Then drag the formula onto the report and place it where it is required, just as a database field is placed.

String ManipulationsString fields contain straight text, characters, numbers, or punctuation which cannot be added or subtracted from each other. String manipulations are ideal for combining two fields, for example a customer contacts first name and last name. It may be that someone’s first name initial is required. The following example here does just that.{md_contacts_First Name}[1]

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 36 of 65

Introduction to Crystal Reports Versions 5 & 6

Enter the formula as shown above, double click on the database field to pull it into the formula, insert 1 as a string value. In this case it finds the first character of the first name field. Click on Check, and Accept if the formula is error free. Then drag the formula into the text object.

Basic Date CalculationsDate formulas are used only on date fields. Formulae based on one or more date fields can perform and manipulate calculations. A common example of date formulas is the need to track how long it took to despatch an order since the actual order date.{ds_despitem_table.Ship By Date} – {ds_despitem_table.Despatch Date}

Click on Check, and Accept if the formula is error free. Then drag the formula into the text object.

If-Then-Else FormulasThe If-Then-Else is a conditional formula that provides immense power within Crystal. It is amazing how often it is used.Simply explained, it tests a condition to see if it is true. If it is, the formula carries out one operation. If it is false, then the formula carries out an alternative operation. The false aspect can be ignored in Crystal so that if the condition is not proven, nothing happens.If-Then-Else has three parts:If To set the condition for testing.Then The action to be taken if the condition is true.Else The action to be taken if the condition is false. (optional). Be Warned though, the data type must be the same for both the “Then” and the “Else” parts of the statement.Using the previous example which calculated the processing days, the following formula could print a warning message where the order processing time exceeds 5 days or just say “OK” otherwise.If {@processing_days} > 5 then

“Check for Processing Problem”Else

“OK”

To emphasise the message on the report, the formula could then be formatted to print the warning in Red and the OK in Green.

Boolean FormulasBooleans are fields that hold only two values. True or False, 1 or 0, Yes or No. A boolean formula would return one of these values. The following example checks if the order value (previously calculated by another formula) is greater than 1000.{@order_value} > 1000

The report would print either True or False where the formula is used. Formatting the formula allows it’s result to show as Yes or No; Y or N; T or F; True or False; 1 or 0.

Practice Session 6Use the report created in Session 5Add an Order Line Value to the report by creating a formula that multiplies Quantity * Price EachCreate a text formula that displays a special message if the order line value is > 10,000Save the report

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 37 of 65

Introduction to Crystal Reports Versions 5 & 6

Conditional Formatting

There are two types of formatting – Absolute and Conditional.Absolute formatting has been discussed already although not named as such. Examples are text fields which are emboldened, underlined or italicized. On number field, it could be displaying numbers as integers rather than with decimals or displaying a £ sign.However, on occasions, it is useful to allow the formatting to respond to differing conditions. An example was covered in the previous section when the order processing time was checked with one of two messages being displayed depending on the formula result. It was suggested there that the warning message could be displayed in red with the OK message in green.Some formatting tools use a checkbox. When the checkbox contains a check mark the format is always applied. When it is left blank then it is never applied. The Drop Shadow property on the Border tab is an example.Other formatting tools, such as the font colour, always have a property set by default. The font colour is usually black. To apply the conditional colour to the order processing message formula referred to above, the font tab in the Format Editor dialog box is first selected. Next, select the Font Colour formula button.

In the Format Formula Editor dialog box the formula entered would be:If {@processing_days} = “Check for Processing Problem” Then

RedElse

Green

Note how the formula has been laid out over four lines. This is not essential and could have been written as one line. However, by setting out formulae such as these over several lines, they are easier to read should they need to be edited.RememberConditional formatting will take precedence over fixed settings. Everywhere there is a formula button next to a property, that property can be conditionally formatted.

Practice Session 7Use the report created/amended in session 6Display the detail section in Blue if the order value is greater than 10000

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 38 of 65

Introduction to Crystal Reports Versions 5 & 6

Formatting Sections

With the report now completed with all data fields in place, formulas constructed and inserted, text fields appropriately displayed and formatting set, final adjustments can be made by formatting the various sections of the report.Using the Section expert formatting can be applied to entire sections. For example, the report may look better to the reader with a page break in between each section or some sections need to be hidden on the finished report.

Changing the Size of a SectionTo size each section simply move the re-sizing cursor over the boundary and then drag that boundary to make the section bigger or smaller.

Another way of making a section smaller is to use the Fit Section option from the shortcut menu having right clicked in the shaded area.

Formatting Using the Section ExpertThe Section Expert offers flexibility and power when formatting different sections of a report. There are seven formatting options along with the Hide and Suppress. All but Hide can be made conditional using formulas.To open the section expert choose Format, Format Section from the menu bar or click on the Section Expert button. There are two tabs on the Format expert, Common and Color. The options available will depend entirely on which section is highlighted in the sections window.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 39 of 65

Drag on these boundaries to re-size the sections

Introduction to Crystal Reports Versions 5 & 6

THE COMMON TABFree Form Placement Freeform simply means working without a grid, so objects can be placed

anywhere on the report.Hide (Drill-Down OK) This will prevent the area/section from printing, but will still allow the user to

double click on a summary field to open a new display tab to show the detail of the data for that summary value.

Suppress (No Drill-Down) Functions in the same way as the Hide command but does not permit users to double click on a summary field to view data.

Print at Bottom of Page Will force whatever is in that section to be printed as low as possible. In a report that generates an invoice, this would be useful for the Invoice Total which one would want printed at the bottom of the page.

New Page Before &New Page After

Usually used with Group headers or footers. These commands will force a page break just before entering the section.

Reset Page Number After This will cause the page number to be reset after the section is complete. If a group spans more than one page then they will be numbered 1, 2, 3 etc. when crystal goes onto the next group it will start from 1 again.

Keep Together This option will prevent page breaks from spreading data from a single record over two pages.

Suppress Blank Section This will prevent the printing of a section if all fields in that section are blank. A typical use of this would be in an address field where a line may be blank.

Underlay Following Sections

Underlay will allow any objects that are in the section to “Flow” into the next while allowing objects from the next section to print on top of the first. You may wish to place the company logo in the page header and then trun Underlay Following Sections for the page header to create a watermark effect.

THE COLOR TABUse this option to select background colours for the sections. By clicking on the Formula button the background colours can be set conditionally.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 40 of 65

Introduction to Crystal Reports Versions 5 & 6

The Omega Database Structures

The Market DatabaseThe following database links will provide information based on Customers, using these links you will be able to compile a report that details the Customer Data, Addresses, Contacts and any free format fields that have been added to the database.

Another method for linking the market database is shown below, this will allow you to list all contacts for a specific customer, then report on the address information where that contact belongs.

Linking of Market Database files is by no means limited to that shown above. For example if you have a report based on the quotations file and would like to print contact information along with customer name etc. then you could link the quotes file to the contact file (described later) and then link md_contacts_table to md_marketdb_table using the customer code.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 41 of 65

Introduction to Crystal Reports Versions 5 & 6

The sample links below show how to obtain contact information from the various places in the Omega database where contacts are held (eg. Engineering contact in Customer Part Record, Customer Contact in Quote & Order records).

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 42 of 65

Introduction to Crystal Reports Versions 5 & 6

The Product DatabaseThe product database can be linked in a number of different ways, below shows the basic method for linking from the Board record through to the Tool Version record (as per the Integrated Engineering screen). Remember that all of these links are on a one-to-many basis (i.e. multiple part records can exist per board record, multiple revision records can exist per part record).

If you are writing a report that requires the unique product database records for the particular record you are referencing then the following link (in this example from the Sales Orders file) should be used. Notice there are two different methods shown here, either one works just as well as the other.

The next example shows the slightly different method for finding the same records

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 43 of 65

Introduction to Crystal Reports Versions 5 & 6

The tables that we have dealt with until now are just the basic product database files, various other tables extend from these into other tables as shown in the examples below.Example 1: Panel Design, Tool Types & Manufacturing Build.

From the Versions table we can get to the Panel Design data (one-to-one link), the Manufacturing Build data (one-to-many link) and to the Tool Types table (one-to-many link).In the next example we will show how to extend further into the product database to view the routes, operations and bill of materials tables using the Panel Design table as the base table.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 44 of 65

Introduction to Crystal Reports Versions 5 & 6

The above example shows the full extent of the route network, route operations, operator instructions and bill of materials tables. Great care should be taken when using the full links as shown above because the link from the routenet table to Billmat & Routeopr are one-to-many and Crystal reports will therefore duplicate records in one of those files depending upon the order in which you are grouping them. If at all possible the above link should be avoided by using sub-reports to report on one of the tables (probably bill of materials).An example of this is the route card where you may want to print the bill of materials data for your stores issuing procedures, this data is better obtained through a subreport and will speed up the overall time it takes to print a sub-report.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 45 of 65

Introduction to Crystal Reports Versions 5 & 6

Part SpecificationWithin the product database is stored the Part Specification data. The Part Specification consists of quite a number of tables but most are linked in the same way from the Partrevs (Customer Revision Table) table. An example is shown below.

The above example shows us how to link to three different sets of information:Circuit Dimensions: Using a link from the partrevs table.Board Profile: Using a link firstly from partrevs to psbsmry which provides board profile summary data, then from the psbsmry table to the psbdtls table which provides board profile detailed data.Hole Date: Using a link firstly from partrevs to pshdata which provides the summary drilling data, then a link from the pshdata table to the pshdtls table which will provide the detailed drilling information for each drill stage entered into the part specification.

The link that you can see above from partrevs to pscirct is the same link used for all of the following tables:Ps_psmqty_table: Provides access to any data where the window configuration type is “Menu: Qty (MS)”Ps_pssqty_table: Provides access to any data where the window configuration type is “Menu: Qty (SS)”Ps_psmarea_table: Provides access to any data where the window configuration type is “Menu: Area/Side (MS)”Ps_pssarea_table: Provides access to any data where the window configuration type is “Menu: Area/Side (SS)”Ps_psmside_table: Provides access to any data where the window configuration type is “Menu: Sides (MS)”Ps_pssside_table: Provides access to any data where the window configuration type is “Menu: Sides (SS)”Ps_psspecl_table: Provides access to the special plating window data.Ps_psstext_table: Provides access to any data where the window configuration type is “Menu: Text Only (SS)”

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 46 of 65

Introduction to Crystal Reports Versions 5 & 6

Ps_psmtext_table: Provides access to any data where the window configuration type is “Menu: Text Only (MS)”Ps_psshole_table: Provides access to simple hole data.

The next example of links shows the special links that have to be in place to gain access to all of the Profile data, the profile information contains multiple tables that provide the tool sizes, cut out sizes etc.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 47 of 65

Introduction to Crystal Reports Versions 5 & 6

Quotations

The above example shows the basic link mechanisms between the three Quotations files in the Omega Quotes database. There are obviously a number of methods for linking the quotations files together and each one has it’s merits according to the type of data that you want to present on the report.The example below show a link from the Tool Version record directly into the Quoted Prices file and from that file out to the other two quote files.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 48 of 65

Introduction to Crystal Reports Versions 5 & 6

Sales Orders

The above diagram show the basic links that form the Omega Sales Orders database. Again there are a number of different methods for linking files in the orders database, an example shown below is one that is used in quite a number of reports where the base information is in the works orders file, and the same report requires sales orders data.

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 49 of 65

Introduction to Crystal Reports Versions 5 & 6

Works Orders

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 50 of 65

Introduction to Crystal Reports Versions 5 & 6

WIP Control

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 51 of 65

Introduction to Crystal Reports Versions 5 & 6

Despatches

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 52 of 65

Introduction to Crystal Reports Versions 5 & 6

Invoices

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 53 of 65

Introduction to Crystal Reports Versions 5 & 6

Report Design Checklist

1. What is the overall purpose of the report?2. Who is going to read the report?3. What is the Report Title?4. What information besides the title do you need to identify the report?

Where does that information come from?If the information exists in a database, what types of fields are they?

5. What identifying information do you want to appear at the top and bottom of each page?Where will the information come from?If the information exists in a database, what types of fields are they?

6. What specific data do you want to appear in the body of the report?Where will that data come from?Does that data exist in the database or calculated using database fields?Do you want your data sorted?

How?Do you want the data broken into groups?

What kind of groups?Do you want your data summarized?

Sub-totaled?Averaged?Counted?Other?

What do you want to total?7. What information, if any, do you want flagged on the report?

How do you want it flagged?By Colour?By Text Flag?Other?

8. What information do you want highlighted in some way so that it really stands out?How do you want it highlighted?

Coloured text?Special font or font size?Borders or background colour?

Do you want to label the highlighted information as well?9. Do you want the report to be based on all records in the database or only on specific records?

Which Records?

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 54 of 65

Introduction to Crystal Reports Versions 5 & 6

Useful Formulae

Conversion of Date to Week NumberThis formula converts a date into a Week Number using the @WeekOffset formula also (this is shown below). The Week Number starts at Week 1 on 1st Jan approx. (according to the weekoffset formula).It should be possible to amend this formula to allow it's use in companies where week 1 is not in January.

WeekNumber Formula// difference between start date and 31/12 of previous year divided by 7 allowing for offset // since week 1 is first full week of January// @date is any date formula required for conversion to a week numberTruncate ( ( {@date} - Date( Year ( currentdate ) - 1, 12, 31 ) + {@WeekOffset} ) / 7 )

WeekOffset Formula// This formula is the @WeekOffset formula used above.// production week starts on Monday; Week 1 is first full week of JanuaryDayOfWeek( Date( Year( currentdate ) - 1, 12, 31 ) ) - 2

Convert a String of Characters to a DateNote: This formula is used to convert a string field entered as a parameter in a dd/mm/yy format into a data type field that crystal can use for searching. It can convert a number of different formats from dd/mm/yy to dd/mm/yyyy and d/m/yy. The formula would need to be changed slightly to allow for converting american date formats.NumberVar mthpos:=Instr({?StartDate},'/');StringVar mthyrstr:=Mid ({?StartDate}, mthpos+1);NumberVar yrpos:=Instr(mthyrstr,'/')+mthpos;NumberVar yy:=Val (Mid({?StartDate}, yrpos+1));if mthpos <> 0 and yrpos <> 0 then NumberVar mm:=Val (Mid({?StartDate},mthpos+1,yrpos-mthpos-1))else numbervar mm:=0;if mthpos <> 0 then numbervar dd:=Val (Mid({?StartDate},1, mthpos-1))else numbervar dd:=0;if yy < 100 and yy >=90 then Date(yy+1900,mm,dd)else if yy < 100 and yy < 90 and yy > 0 then Date(yy+2000,mm,dd)else if dd > 0 and mm > 0 and yy > 0 then Date(yy,mm,dd)

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 55 of 65

Introduction to Crystal Reports Versions 5 & 6

Calculate the Number of Days Between Two DatesThis formula calculates the number of working days excluding Saturdays and Sundays between the Day1 and Day2 variables. For example: If you wanted to calculate the difference between delivery date required and actual delivery date you should replace the formula in Day1 to a formula representing delivery date required and replace the formula in Day2 with a formula representing the actual delivery date.DateVar Day1;DateVar Day2;NumberVar ProdDays :=0;NumberVar StartwkDays;NumberVar EndwkDays;DateVar FirstSat;DateVar LastSun;//( Day1 := {@FirstDate}; Day2 := {@SecondDate}; if Day2 - Day1 < 7 and DayOfWeek(Day2)>=DayOfWeek(Day1) then ( if DayOfWeek(Day1)<=DayOfWeek(Day2) and DayOfWeek(Day1)<7 and DayOfWeek(Day2)>1 then ( if DayOfWeek(Day1)=1 then Day1 := Day1+1; if DayOfWeek(Day2)=7 then Day2 := Day2+1; ProdDays := Day2-Day1+1 ) ) else ( StartwkDays :=7-DayOfWeek(Day1); EndwkDays := DayOfWeek(Day2)-1; FirstSat := Day1+StartwkDays; LastSun := Day2-EndwkDays; if LastSun-FirstSat=1 then ProdDays:=Startwkdays+EndwkDays else ProdDays:=(Truncate((LastSun-FirstSat;)/7)*5)+StartwkDays+EndwkDays; ));ProdDays

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 56 of 65

Introduction to Crystal Reports Versions 5 & 6

Customer Panel Width FormulaThe following formula calculates the width of the Customer Panel if it exists, taking into account the stepping orientation selected in the part specification.if {ps_pscirct_table.CPF Orientation}=1 then ((({ps_pscirct_table.CPF Step In Width} * {ps_pscirct_table.Circuit Width}) + {ps_pscirct_table.CPF Border L1} + {ps_pscirct_table.CPF Border L2})+(({ps_pscirct_table.CPF Step In Width}-1) * {ps_pscirct_table.CPF Gap Width}))/25400000else if {ps_pscirct_table.CPF Orientation}=2 then ((({ps_pscirct_table.CPF Step In Width} * {ps_pscirct_table.Circuit Length}) + {ps_pscirct_table.CPF Border L1} + {ps_pscirct_table.CPF Border L2})+(({ps_pscirct_table.CPF Step In Width}-1) * {ps_pscirct_table.CPF Gap Width}))/25400000else 0

Note that the final /25400000 on each line converts the dimension to inches, this should be replaced by other numbers according to the format that you wish to print.

Customer Panel Length FormulaThe following formula calculates the length of the Customer Panel if it exists, taking into account the stepping orientation selected in the part specification.if {ps_pscirct_table.CPF Orientation}=1 then ( ( ( {ps_pscirct_table.CPF Step In Length} * {ps_pscirct_table.Circuit Length} ) + {ps_pscirct_table.CPF Border W1} + {ps_pscirct_table.CPF Border W2} ) + ( ( {ps_pscirct_table.CPF Step In Length} - 1 ) * {ps_pscirct_table.CPF Gap Length} ) )/25400000else if {ps_pscirct_table.CPF Orientation}=2 then ( ( ( {ps_pscirct_table.CPF Step In Length} * {ps_pscirct_table.Circuit Width} ) + {ps_pscirct_table.CPF Border W1} + {ps_pscirct_table.CPF Border W2} ) + ( ( {ps_pscirct_table.CPF Step In Length} - 1 ) * {ps_pscirct_table.CPF Gap Length} ) )/25400000else 0

Note that the final /25400000 on each line converts the dimension to inches, this should be replaced by other numbers according to the format that you wish to print.

Printing “Hrs:Mins” on a Report from a Time FieldThis Formula Returns hours and minutes from any time field (e.g. wt_rejctanl_table.Time Entered)NumberVar TimeEnt:={wt_rejctanl_table.Time Entered}/360000;StringVar Hours:=ToText(Truncate(TimeEnt),0);NumberVar Mins:= TimeEnt-Truncate(TimeEnt);Mins:=Truncate(Mins*60);StringVar Minutes:="00"+ToText(Mins,0);Hours + ":" + Right(Minutes,2)

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 57 of 65

Introduction to Crystal Reports Versions 5 & 6

Training Course Notes

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 58 of 65

Introduction to Crystal Reports Versions 5 & 6

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 59 of 65

Introduction to Crystal Reports Versions 5 & 6

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 60 of 65

Introduction to Crystal Reports Versions 5 & 6

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 61 of 65

Introduction to Crystal Reports Versions 5 & 6

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 62 of 65

Introduction to Crystal Reports Versions 5 & 6

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 63 of 65

Introduction to Crystal Reports Versions 5 & 6

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 64 of 65

Introduction to Crystal Reports Versions 5 & 6

© Prestim Computer Systems LimitedBentley House, Church Street, Calne, Wiltshire, England, SN11 OHY

Page 65 of 65