You are on page 1of 102

Crystal Reports

SyteLine 7 First Edition

MAPICS, Inc. 1000 Windward Concourse Parkway Suite 100 Alpharetta, GA 30005-8001 www.mapics.com

TM-SL7-CRYSTAL

SyteLine Crystal Reports Training Guide


Copyright MAPICS, Inc. 2003 All Rights Reserved Printed in the USA December 2003

Restricted Rights Legend


Use, duplication, or disclosure by the Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013, and Rights in Data-General at FAR 52.227.14, as applicable. Name of Contractor: MAPICS, Inc., 1000 Windward Concourse Parkway, Suite 100, Alpharetta, GA 30005-8001.

SyteLine is a trademark of MAPICS, Inc. All other product names used in this manual are trademarks, registered trademarks, or trade names of their respective companies.

Classroom Training Materials - SyteLine


General SyteLine 101 SyteLine User Interface SyteLine 7.03 Differences Manufacturing & Operations Bill of Material/ECN Co-Products and By-Products Customer Order Entry Estimating Human Resources Inventory Job Shop Manufacturing Order Entry - Advanced Concepts Planning Planning and Scheduling Workshop Purchasing Repetitive Manufacturing Return Material Authorization Scheduling Accounting & Financial Accounts Payable Accounts Receivable Costing Financial Reports Workshop General Ledger Multi-Currency in SyteLine Multisite Workshop Payroll Projects Technical Crystal Reports Developers Workshop Forms Personalization System Administration Overview SyteLine Suite of Products Business Process Management Business Intelligence - Administration Business Intelligence - Impromptu Business Intelligence - PowerPlay User Business Intelligence - Transformer Configuration - Basics Configuration - Modeling Workflow

Contents_________________________________________
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Manual Guide .................................................................................................................................. 5 How to Use This Manual ................................................................................................................. 6 Principles of Successful Learning ............................................................................................. 6 Manual Section Structure.......................................................................................................... 8 Feedback .................................................................................................................................. 8 SyteLine Navigation Helps ............................................................................................................ 10 Hot Keys Chart........................................................................................................................ 10 SyteLine's Power Bar ............................................................................................................. 11 Course Objectives & Prerequisites ................................................................................................ 13 Objectives of this Course ........................................................................................................ 13 Prerequisite Courses............................................................................................................... 13 Note to the Instructor............................................................................................................... 13 Navigation for this Course ............................................................................................................. 14

Section 1: Report Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15


Creating a New Report .................................................................................................................. 16 The Design Window ............................................................................................................... 17 Browsing the Data.................................................................................................................. 18 Saving Your Report................................................................................................................ 18 Positioning and Sizing Objects............................................................................................... 18 Using Guidelines .................................................................................................................... 19 Moving Objects ...................................................................................................................... 19 Resizing Objects .................................................................................................................... 20 Aligning Objects ..................................................................................................................... 20 Formatting Objects ........................................................................................................................ 21 Formatting Appearance.......................................................................................................... 21 Formatting the Data Itself....................................................................................................... 22 Formatting Text Objects......................................................................................................... 23 Exercise......................................................................................................................................... 24

Section 2: Record Selection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25


Using the Select Expert ................................................................................................................. 26 Understanding Saved vs. Refreshed Data............................................................................. 27 Exercise ................................................................................................................................. 27 Adding Additional Selection Criteria ..............................................................................................28 Understanding 'and' & 'or' Conditions in Selection Criteria .................................................... 29 Applying Record Selection to Date Fields ..................................................................................... 30 Exercise......................................................................................................................................... 31

Section 3: Sorting, Grouping, and Summarizing . . . . . . . . . . . . . . . . . . . . . . 33


Sorting Records............................................................................................................................. 34 Grouping Records ......................................................................................................................... 35 Deleting Groups ..................................................................................................................... 36 Changing the Group Definition............................................................................................... 36 Exercise......................................................................................................................................... 37 Summarizing.................................................................................................................................. 38 Summary vs. Subtotal ............................................................................................................ 38 Showing Percentage Summaries........................................................................................... 39 Inserting Grand Totals............................................................................................................ 40 Exercise......................................................................................................................................... 41

Section 4: Making Reports Presentation-Quality. . . . . . . . . . . . . . . . . . . . . . 43

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

Contents

Applying Special Formatting .......................................................................................................... 44 Date, Time, and Date/Time Field Formatting ......................................................................... 44 Using Special Fields ...................................................................................................................... 46 Inserting Lines and Boxes ............................................................................................................. 47 Inserting a Line....................................................................................................................... 47 Inserting a Box ....................................................................................................................... 47 Inserting a Picture.......................................................................................................................... 49 Exercise......................................................................................................................................... 50

Section 5: Text Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51


Combining Text Objects with Database Fields .............................................................................. 52 Using the Can Grow Option ................................................................................................... 52 Exercise: Inserting a Database Field to a Text Object .................................................................. 53 Check Your Work ................................................................................................................... 53 Adding a Special Field to a Text Object ........................................................................................54 Exercise: Adding a Special Field Into a Text Object...................................................................... 55 Check Your Work ................................................................................................................... 55 Additional Text Object Formatting ................................................................................................. 57 Exercise......................................................................................................................................... 58 Check Your Work ................................................................................................................... 58

Section 6: Formula Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59


Using Formulas ............................................................................................................................. 60 Working with the Formula Editor ................................................................................................... 61 Defining the Parts of the Formula Editor ................................................................................ 61 Exercise: Create a Report for Use with Formulas.................................................................. 62 Basic Calculations ......................................................................................................................... 63 Exercise: Creating an Extended Cost .................................................................................... 63 Exercise: Creating a Conditional Sum ................................................................................... 64 String Manipulation........................................................................................................................ 65 Check Your Work ................................................................................................................... 65 Basic Date Calculations: Adding a Formula Inside a Formula ...................................................... 66 Check Your Work ................................................................................................................... 66 Exercise: Applying Boolean Formulas........................................................................................... 67 Check Your Work ................................................................................................................... 67 Applying If-Then-Else Formulas .................................................................................................... 69 Exercise: Using If-then-else Conditional Formatting .............................................................. 69 Working with Running Totals ......................................................................................................... 70 Running Total Expert (Wizard)............................................................................................... 70 Exercise: Running Totals in a List.......................................................................................... 71 Check Your Work ................................................................................................................... 73

Section 7: Conditional Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75


Using the Highlighting Expert ........................................................................................................ 76 Exercise: Using the Highlight Expert...................................................................................... 77 Conditional Formatting .................................................................................................................. 78 Applying On or Off Properties ................................................................................................ 78 Attribute Properties ................................................................................................................ 78 Exercise......................................................................................................................................... 79

Section 8: Section Formatting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81


Changing the Size of the Section .................................................................................................. 82 Exercise ................................................................................................................................. 82 Formatting Sections Using the Section Expert .............................................................................. 83 Section Expert........................................................................................................................ 83

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Contents

Section Expert - Common Tab............................................................................................... 83 Section Expert-Color Tab....................................................................................................... 84 Exercise ................................................................................................................................. 85 Creating a Summary Report .......................................................................................................... 86 Exercise ................................................................................................................................. 86

Section 9: Adding a Custom Report to SyteLine . . . . . . . . . . . . . . . . . . . . . . 87


Background Tasks, Stored Procedures and Crystal Reports ........................................................ 88 Comprehensive Exercise............................................................................................................... 89 Step 1: Create a new Stored Procedure ............................................................................... 89 Step 2: Creating the Crystal Report .RPT .............................................................................. 91 Step 3: Create a New Background Task................................................................................ 95 Step 4: Create a Basic Report-Criteria Form ....................................................................... 95

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

Contents

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Preface __________________________________________
Manual Guide
Section Topics
Training Model Principles for Successful Learning Manual Sections Feedback SyteLine Navigation Helps Course Objectives and Prerequisites

Section Objectives

After completing this section, you will be able to: Apply successful learning concepts to this course Recognize basic navigation used in SyteLine

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

Preface

How to Use This Manual


This manual was written with the intent to guide the student through the four parts of this standard training model: 1. Introduce the topic. 2. Walk the students through a simplified version of the process or concepts they need to learn to give them their bearings. 3. Provide the student with exercises that help them discover the topic in depth. 4. Wrap up the topic. Each part of the training model is important, but the heart of this method revolves around two learning principles that the student and teacher must keep in mind. These principles are: (1) We learn how to do a thing by doing it, and (2) we need to learn both the details and the big picture, both application and concept. This means the students need to perform detail and big picture activities to learn this material. Just listening and understanding is not enough. You can read more about what detailed and big picture activities are in the section on principles for successful learning. Now, no course can make anyone an expert. But the more the instructor helps the students through the activities that help them learn, the more the course will help the student down the road of expertise.

Principles of Successful Learning

The training model above applies learning principles. But is that everything the student and instructor do to make sure the maximum amount of learning takes place? That's a topic for a whole book, if not a series. But we can summarize much of that by realizing that learning is a biological process.

Our brain is more like a muscle than a computer. Learning is not something we store in a file; it's something we grow. Just because we see, hear, or even do something doesn't mean we'll remember it. We must exercise our learning consistently. If we only work out during class, we're going to develop our learning like weekend warriors develop their stamina. Here are a few powerful things you can do grow your learning before and after class. BEFORE Get into SyteLine and become familiar with the areas you will be working in during the course. Read SyteLine manual and passages from texts related to the business topics. Answer and preparation questions your instructor might have given you. Write up your own questions. Right after class-create quick review & recall notes Next day-perform detail and big picture activities Next week-perform detail and big picture activities Next month-perform detail and big picture activities

Your Brain Is Not a Computer

AFTER

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Preface

Detail & Big Picture Activities

In each of our classes you perform detail and big picture activities. These activities constitute a workout. Your learning will grow through these activities, but just as with muscles, working out once won't produce long-lasting effects. You need to work your neural paths again. When you perform detail and big picture activities you're working out again. Not only will these activities reinforce what you've learned, they will often help you understand more. Big picture activities help you summarize and see relationships between the details of a topic. They help you create a pattern to fit information into. Big picture activities include things like creating mind maps, process flows, relationship diagrams, and outlines. Detail activities help you understand navigation, specific fields, the effect of various parameters, and the steps of each business process--they require you to get into the system. Detail activities include things like setting up a BOM, taking a customer order and shipping it, running reports, and tracing accounting. Again, the first post-class workout you will want to perform is clarifying and consolidating your notes. You will forget. But you can drastically cut the amount you forget and your recall work by taking 10 minutes to create clear notes.

Learning is Growth

A number of studies have confirmed the idea that learning is a biological growth process that requires repetition. RECALL A number of studies have found that: Without review, people forget between 46% to 80% of what they've learned within 24 hours When tested six weeks after a class, students who took a 5-minute review test after their class recalled one and a half times more than the students who had no review test immediately after class. People learn and recall more when they: (1) structure what they've learned in their own words, (2) recite their learning, and (3) distribute practice over many periods versus doing it all at once.

BREAKS Studies have also shown that people recall more if they take breaks every 20-50 minutes. Psychologists believe that it takes neural traces from about five seconds to 15 minutes to jell or consolidate. This is how they explain topics becoming clear during a break or immediately upon returning and why we recall more immediately after a learning period than at the end of a learning period. We really do need to let information "sink in."

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

Preface

Manual Section Structure

This manual applies the learning principles and the training model explained above. Each major topic should have 3 parts to it--an (1) Introduction, (2) Discovery, and (3) Wrap Up.
Section Part Introduction Discovery Definition A presentation or activity to give students the big picture about topic or hour. Guided Practices A step-by-step guide through the topic. Usually the instructor guides the class through each step; however, students may perform each step on their own or in couples or small groups. Reference Explanation of the key concepts, forms, fields, and processes of the topic. Teachers will draw your attention to key concepts in their introduction and the guided practice, but they may not cover every item in these sections. Exercises Opportunity for the students to explore and practice. Wrap Up An exercise that helps the student structure their knowledge. The wrapups usually take the form of a list of key discussion questions or a mind map. In both cases, the teacher will lead the class through the wrap up. A mind map is a method for taking notes that allows you to show connections between various concepts.

It will be the teacher's responsibility to adapt this manual to each audience by adding or taking away from what is found.

Feedback

As teachers we create lesson plans and handouts and do all sorts of things. But we won't know how successful our efforts are unless we look for feedback. Feedback is simply a statement of the effect our actions have.

Body language and performance measures like the ability to complete an exercise, quizzes, and tests all provide feedback. However, there may not be a direct link between our teaching and a student's performance or body language. Maybe a student has lost interest because they stayed up until 5 a.m. playing computer games on their laptop. Maybe they finished the exercise because they came in early and taught themselves the material. Something that complicates all this is that often what helps one student doesn't help another. We'll never know the direct effect of our teaching if we look only to performance measures and body language for feedback. The most accurate feedback comes from the students themselves-they can tell us what helps and what hinders them. They can tell us what is clear and what is not. The students can tell us exactly when they were bored or confused or spinning their wheels. As a teacher it is my responsibility to welcome and solicit feedback. As a student it is your responsibility to give it. The best way to give feedback is to leave ego and value judgements out of it. Instead of slamming or praising the teacher (you're doing this when you use words like "great," "terrible," "on the ball," etc.), talk about cause and effect. Here are a few examples. "Your MRP handout [cause] really clarified the term 'explosion' for me [effect]."

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Preface "At the beginning of the session today you moved fairly quickly through the forms [cause]. I was just trying to keep up with the navigation and couldn't even think about the concepts [effect]." "I liked how Fred taught us [not too useful]. He did a wrap-up [cause] that really brought things together for me [effect]. And he made sure we took regular breaks [cause], and it seemed that I was able to concentrate better in the afternoons because of that [effect] Cause and effect. Helpful feedback focuses on how our teaching affects you. And knowing the effects our teaching produces allows us to modify our efforts to deliver the kind of service that helps you the most.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

Preface

SyteLine Navigation Helps


Hot Keys Chart
Hot Key Ctrl / 1 Ctrl / 2 F1 F2 F4 F5 Ctrl / F5 Ctrl / F4 Ctrl / N Ctrl / D Ctrl / S Ctrl / F8 F8 F7 Ctrl / X Ctrl / V Ctrl / C F6 Ctrl / Home F12 Ctrl / F12 Ctrl / TAB Action Toggles view from Grid/Form to Grid Only Toggles view from Grid/Form to Form Only Field level help Full Field display Filter in Place Begin/Retrieve Data Refresh Refresh Current Close Current Window New Record Delete Save Activate Next Collection Next Record Previous Record Cut Paste Copy Activate Second Pane Cursor Home View Diagnostic's Log Configure Diagnostics Switch to another open form

10

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Preface

SyteLine's Power Bar

Used to open a form Save modified data and close the form Close active form and do not save data New record Filter (similar to QBE, you will query on the form fields and not from a list of fields) Elevator buttons/toggle between records on active form Publish or render form Notes for current record - Empty Notes for current record - Has notes associated About the SyteLine form Display help for a field on a form Enter UDFA/Design Close form and re-open based on changes made in Design

The Help Tip displays in the lower left hand corner of the application (Status bar) even when your selection is not active.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

11

Preface

Required, System-generated and Read-only Fields


Any field that is required for a window will have a yellow background. A green background indicates a system-generated field, and a gray background is read-only.

Standard GUI fields


Check box indicating YES or NO Radio button to select one option from multiple choices

Drop-down box to select one option from multiple choices

12

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Preface

Course Objectives & Prerequisites


Objectives of this Course
This class is designed to cover most of the basic topics someone who modifies existing SyteLine 7 reports or who creates new reports from scratch needs to know. When they have finished this class, students should be able to: Identify the elements of the Crystal Reports interface Create a new report Format objects Insert and edit text boxes Open an use the Select Expert Define criteria for record selection Apply record selection to date fields Sort report records Group records in meaningful sequences Modify groups Summarize and subtotal information Create grand totals Apply special formatting to objects Use special Crystal Reports fields Add lines and boxes Insert pictures Import elements into a text box Format individual elements of a text object Use basic formulas in Crystal Reports Use running totals

Prerequisite Courses
None.

Note to the Instructor

You are responsible for selecting the topics and activities that meet the needs of your students. Depending on your class, you may not be able to cover all the material in this manual in one day. Make sure you talk to your students when planning the class and carefully select the topics you want to cover. Make sure you assess the speed of the class half way through and then make any necessary adjustments so you cover what you and your students have determined has the highest priority. The exercises for this class have been designed to generate discussion and student involvement. Many of the exercises do not have "check" figures. You are to provide that feedback by doing the exercises along with the students. Then they can check their answers against yours.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

13

Preface We caution you not to substitute lectures and presentations for the exercises. Students will learn the most while doing the exercises. A good time ratio for lecture to student work is 30%:70%. Consider using the review exercises found in the appendix as part of your end of class wrap up.

Navigation for this Course


SyteLine groups navigation for data, process, and report forms by business function. Therefore, you'll minimize the time it takes for you to get your bearings, if you (1) identify the major functions covered in this course, and (2) identify which data, process, and report forms are grouped into that function.

14

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 1: Report Design ______________________


Objectives
When you finish this section, you will be able to: Identify the elements of the Crystal Reports interface Create a new report Format objects Insert and edit text boxes

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

15

Section 1: Report Design

Creating a New Report


You can create a new report with Crystal Reports using two different methods. We will focus primarily on the second of the following: Using the Report Expert Using a blank report.

Another, more common sense approach, may be to copy an existing report that is similar to the end result you are looking to achieve and make modifications where they are needed. In this example we will be creating a blank report. 1. Open Crystal Reports and choose the 'Blank Report' option.

2. Choose where the data will come from. It is important at this point, in order to enable your Crystal Reports software to work with stored procedures, that you make sure your Crystal Reports instance has stored procedures as an option to include as a data source. Click the Options button and select the Stored Procedures checkbox. At first we will work with a direct ODBC connection to a data source and later will work with stored procedures on the SQL Server database. 3. Scroll through the list of ODBC data sources until you find the SyteLine App Database DSN. (if one is not set up on your machine, you will need to do so through Start + Settings + Control Panel + Data Sources (ODBC). Once this is set up, select the SyteLine App DSN from the tree view under the ODBC tree level. (In this instance it has been named SL7App. Yours will most likely be different). 4. Once you have selected the correct DSN, you will then be asked to select the tables you want to work with from that particular database. In this instance, working with the SyteLine 7.0 Application database, you need to select the 'co' table from the list and click the Add button. 5. Click the Close button.

16

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 1: Report Design 6. The 'Field Explorer' window will then appear.

We will use this window frequently over the course of the training, but for now, click the Database Fields tree level and notice how it shows you the 'co' table. If you expand the co table, you will see all fields in the table. At this point you can begin dragging fields onto the Detail tab of the report. Before we do that, let's look at the Detail tab.

The Design Window


Report Header Page Header Details Report Footer Page Footer

The Detail tab is, by default, broken into five sections:

The Detail tab will be covered in much more detail in later sections. Now, continuing our report creation process: 1. With the Field Explorer and the 'co' table fields visible, click the 'co_num' field and drag it into the Details section of the report. Notice how the column name is added automatically to the page header. (In order for the label to appear, make sure that under File + Options, you have Insert Detail Field Titles checked).

2. In order to preview the actual report data, and activate the 'Preview Tab' in Crystal Reports, select the button from the main toolbar. (This button must be selected to run the query against the database). 3. Once you run the query, the Preview tab will be enabled, and you will be able to view your report data on this tab.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

17

Section 1: Report Design

Browsing the Data


You can view actual data for a field at any time by clicking the Field Explorer window. (Browse) button in the

You can close the Field Explorer window at any time. It is a free-floating modal window. You can open the window at any time as well by clicking the button from the main toolbar. Once you click the Browse button, you will see the first 500 unique fields of data for that column in the table.

Saving Your Report


or by clicking the drive.

This is done by simply selecting the File + Save + Save As option from the main menu button. Save this report as 'CustomerOrders1.rpt' on you local hard

Positioning and Sizing Objects

Before we move into positioning and sizing objects, we will need to add more fields to our current report. 1. Drag the following additional fields onto the Details tab of the Crystal Reports workspace: co_num, order_date, ship_code, and price.

2. Next, click the Preview tab to view your report so far. Once you have placed the fields on your report, you may want to reposition or resize them. Because the column title is dropped into the header at the same time the data field is dropped onto the detail section of the report, they default to the same size. Many times, the size may be too small or much too large for the space needed on the overall report. Repositioning and resizing is easier on the Design tab because you are moving only the placeholder rather than the representative data.

18

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 1: Report Design

Using Guidelines

If you want to line objects up with one another, you can insert guidelines and attach objects to them. Then, in one step you can move the guideline to reposition all the objects attached to the guideline. 1. Click the Detail tab. Notice how each field that was dropped on the report has been automatically been given a guideline (in order to view gridlines, make sure that you have checked Show Grid in Design under File + Options).

2. You can remove the guidelines by selecting the gray arrows at the top of the Detail tab by clicking them and dragging them into the report area. In order to add a new guideline, just click anywhere in slide-rule area with the gray boxes. 3. If your fields are not attached to the guidelines, you simply need to click the field and 'wiggle' the field just over the plain of the guideline until it's attached corners of the field turn red. Using the keyboard right and left arrow keys is easier than using the mouse for this action.

Moving Objects

Select an object before you move or resize it. Select an item by clicking the field itself until it is highlighted. Most of the time, you will want to move both the field and its associated label. This can be done in two ways: Select one object and hold down the shift key while selecting the other. They will both be highlighted at this point and can be moved you your mouse or the arrow keys on the keyboard.

Another very easy way to select and move multiple items is the 'Lasso' method. Click and draw an imaginary box around multiple objects that you want to select. Once they are selected, you can move them as a group to the position that you wish.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

19

Section 1: Report Design

Resizing Objects

In order to resize an object, the object must be selected first. This can be done using one of the two methods mentioned above. 1. When an object is selected, it is highlighted by a box of small diagonal bars. Notice also the small boxes surrounding the field. These are resizing handles.

2. You can resize one or many fields at one time. Once they are selected, just move your mouse over one of the boxes, click and drag to the new size.

Aligning Objects

The main object is the object that you wish to align other objects with. To make an object the main object, click it last when doing a shift-click or control-click action. This is the opposite order than it is done on SyteLine 7.0 form customization.

Once the objects are selected in the correct order, select Format + Align from the main menu. Select the desired alignment from the following list:

To facilitate faster report design, you can copy and paste objects from one section to another area. When you copy an object, you are copying the actual data value of that object as well.

20

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 1: Report Design

Formatting Objects
Once you place fields on your report, you may want to change their appearance. There are many options available to you. To see the options, right-click a label field and select Format Text.

Formatting Appearance

You can change the color, size, or style, as well as add tool-tips, suppress (covered in detail later), and add lines. Take time now to explore the different options available to you on the tabs of the Format Dialog window. 1. In our example, highlight all the column headings and make them Bold Faced.

2. Remove the underline from each of them.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

21

Section 1: Report Design

Formatting the Data Itself

You may want to format the data itself so that it appears differently in the Preview window. This most often used on a numeric field. In order to format a numeric data field, right-click the field on the Detail or the Preview tab and click Format Field.

On the Number tab you are presented with a number of numeric formatting styles.

22

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 1: Report Design In order to view a number of other options with regard to rounding, negative numbers, currency, suppression, decimal separators and more, click the Customize button.

Take time to explore all of the options available to you, as you will be using them frequently in report building.

Formatting Text Objects

You can format the text inside of a label and also add more text objects to your report. In order to modify existing text in a text object, right-click the text object and select Edit Text Object. You can then change the text and individual word and letter formatting within the text object window.

Adding a Text Object

In order to add a new text object, click Insert + Text Object from the main menu, or click the button from the main toolbar. You will then have a text object attached to your cursor. Place your cursor where you wish to have the text object on the report and click once.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

23

Section 1: Report Design

Exercise
This exercise will combine what you have learned about aligning, resizing, and formatting objects in Crystal Reports. 1. Resize the fields and columns headings to accommodate the data. 2. Format the Price field to print with no decimals and with a floating dollar sign ($). 3. Format the 'co_num' field to be center justified. 4. Change the column headings to be bold and blue. 5. Rearrange the columns to be in co_num, price, ship_code, order_date. 6. Create a report header text box called 'CO Report'. 7. Change the color of the text inside. 8. Make the report header text box a larger font size and different style. 9. Make sure the title will print in the center of the page. 10. Add a border and drop-shadow to the text box. 11. Save the report.

24

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 2: Record Selection ___________________


Objectives
When you finish this section, you will be able to: Open and use the Select Expert Define criteria for record selection Apply record selection to date fields

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

25

Section 2: Record Selection

Using the Select Expert


The report we have been using so far will print all records in the 'co' table. More often than not, you will want to limit the number of records returned. To open the Select Expert either choose Reports + Select Expert or click the from the main toolbar. button

Your record selection criterion does not have to be based on fields that are in your report. You can choose any fields from the database. In this example we will select the co.co_num field on our Details tab then click the Select Expert button to open the Select Expert.

Since we are looking at the co.co_num field, we can then choose from the drop-down list of options provided by the Select Expert to limit our query results. Take time to explore all of the options available to you in the Select Expert dropdown expression box. You will use these options frequently and should be familiar with them. In this example we will select 'is between.'

The two drop-down boxes are associated with using the 'is between' operator and will list the first 500 unique data items in the table for co_num. You can pick from the list or type in other numbers.

26

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 2: Record Selection

Understanding Saved vs. Refreshed Data

By design, Crystal Reports only reads your database when necessary. When you first preview, print, or export a report to a file, the program runs your report and retrieves the required data. Once you are working with the data that has been returned, Crystal Reports retrieves data again only under these conditions: If fields are added to the report If you add a formula that references a field that was not in the report when you ran it the first time. If you modify your record selection criteria in the Select Expert to include more records than when you first ran the report. You will be prompted for "Use Saved Data" or to "Refresh Data."

If you choose "Use Saved Data," Crystal Reports does not make a trip back to the database. To force Crystal Reports to make another trip back to SQL Server, select the "Refresh Data" option. You can always refresh your data by selecting the button.

Exercise

1. Click the Select Expert. 2. Choose to limit your report by ship_codes that are either FED or UPS. 3. Run the report.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

27

Section 2: Record Selection

Adding Additional Selection Criteria


You will often require more than one selection criteria for your report. In this example, we will look at adding a criterion that restricts a price greater than $2,000.00. In order to add additional criteria in the Select Expert, complete these steps: 1. Open the Select Expert. 2. Click either the New tab or the New button. You will then be presented with an additional dialog window that allows you to pick the field for which you will be adding additional criteria.

3. In this example, we will select the co.price field and click OK. 4. Select the selection operator and the amount.

5. The new selection criterion is then saved and the report is rerun with that new selection criterion.

28

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 2: Record Selection

Understanding 'and' & 'or' Conditions in Selection Criteria

By default, Crystal Reports links multiple selection criteria with an 'and' statement. In our last example, Crystal Reports selected records where the ship_code was either 'UPS' or 'FED' and price_code greater than $2000. If you wish to change the 'and' to an 'or,' view the selection formula. To do this, follow these steps: 1. Open the Select Expert. 2. Click the Show Formula button. The formula used then appears.

3. You can change the 'and' operator to an 'or' in this window.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

29

Section 2: Record Selection

Applying Record Selection to Date Fields


Often, you will want to select records based on a date field. You may want to see all orders within the last year and other queries like that. To do this, create a record selection using the appropriate date and, if needed, formula fields. Anytime you select a date field in the Select Expert a new "In the period" option is available for use in your record selection.

The year-to-date option is used here as an example.

30

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 2: Record Selection

Exercise
In the following exercise you will create a new report using the customer and the cust_addr table. There will be some explanation along with exercise steps. You link tables as well as apply what you have learned in this last section on the Select Expert and selection criteria. 1. Click the New Report button .

2. Select the 'As a Blank Report' option. 3. From the list of data sources, select the SyteLine Application database and add the customer table first, then the custaddr table to your report. 4. Close the Table Selection window. 5. You will be presented with the Database Expert window. This window is used when more than one table is added to the report. Crystal Reports uses the Database Expert to figure out how the two tables are related. 6. You will need to draw the correct links between the two tables. In this case the foreign keys are cust_num and cust_seq. Starting with the customer table, select the cust_num field, hold the mouse button down and drag a line to the cust_addr table's cust_num field. You will see a link drawn for you.

7. Do the same for the cust_seq field.

8. Once the relationship is set up correctly, click OK.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

31

Section 2: Record Selection 9. Add the following fields to your report and resize them accordingly: customer.cust_num cust_addr.name cust_addr.city cust_addr.state customer.sales_ytd

10. Apply a selection criteria that will retrieve only those records with a customer number between 1 and 25. 11. Apply another record selection criteria that will also grab records with a sales_ytd greater than zero. 12. Once you have run the report a few times, change the 'and' operator to an 'or' and notice the difference in the records being returned. 13. Save your report as 'CustomerSales.rpt'.

32

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 3: Sorting, Grouping, and Summarizing


Objectives
When you finish this section, you will be able to: Sort report records Group records in meaningful sequences Modify groups Summarize and subtotal information Create grand totals

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

33

Section 3: Sorting, Grouping, and Summarizing

Sorting Records
By default Crystal Reports displays the records in their natural order, as they are stored in the database. To select fields to sort on for your report: 1. Click the button or select Reports + Sort Records from the main menu. You are presented with the following dialog:

2. From this window you can select the fields you wish to sort your result set by. 3. Select one or more fields from the left side. 4. To add that field to the sorted fields, click the Add button .

5. To remove a field from the sort fields click the Remove button. By default, the field you select will be sorted Ascending. You can choose to override that by selecting from the Sort direction radio group and clicking Descending.

34

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 3: Sorting, Grouping, and Summarizing

Grouping Records
You will more than likely want to break your reports into meaningful groups. Grouping your report plays a big role in making your report easy to read, understand, and utilize. Most of the time grouping goes along with summarizing and totals. So when thinking about groups, you are usually thinking about seeing summary-type information on the report by group. When you group records, you add new areas to your report. These new areas are visible on the left margin of the Details tab. Once you have created a group, a Group Header and Group Footer surround the Details area. Each group you create has its own header and footer. Also, when you insert a group, the Group #n Name field is automatically created in the Group Header. To add a group to a report, do the following: 1. To start adding a group, select Insert + Group from the main menu or, on the Insert Tools toolbar click the button. You will be presented with the following dialog:

You can select the field you wish to group by from the first drop-down box. Notice that you can also choose the order in which you wish to sort the particular group. This will pertain only to the sorting within the group. 2. The Keep Group Together check box on the Options tab specifies how the group will be broken across multiple pages when printed. If this is selected, and a particular group takes up more than one page, Crystal Reports will start the next group on a new page.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

35

Section 3: Sorting, Grouping, and Summarizing 3. Once the selections are made, you can see the Group Header and Group Footers are added to the report.

If you group on a particular field, it makes sense to remove it from the detail of your report. Otherwise, you will have redundant data fields under each group.

Redundant data

Redundant data removed

Deleting Groups

In order to delete a group, do the following: 1. Right-click in the left margin on the Detail tab next to the Group Header 2. Select Delete Group from the menu. 3. You will be prompted to verify your actions. Once you choose 'Yes,' the group will be deleted from your report.

Changing the Group Definition

If your needs change or if you decide that you have chosen the incorrect field to group your report by, you do not have to delete the group. You can easily change the group. In order to do this, do the following: 1. Right-click in the left margin on the Detail tab next to the Group Header. 2. Select Change Group from the menu.

3. You will be presented with the original Group selection dialog window where you can select a different field to group by.

36

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 3: Sorting, Grouping, and Summarizing

Exercise
In the following exercise you will sort and group the CustomerSales.rpt report. 1. With your CustomerSales report open, sort the report by cust_num ascending. 2. Sort next by co.cust_num descending. 3. Next, group your report by custaddr.state and view your results. 4. Next, change your grouping to group by co.cust_num. 5. Now, group first by state, then by cust_num. Would your report look better if you deleted the cust_num detail? 6. How would you reorder your groups? For example, what if you wanted to sort first by co.cust_num then by state? (Hint: click and drag one above the other on the Detail tab.) 7. Save your report.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

37

Section 3: Sorting, Grouping, and Summarizing

Summarizing
Your report is now sorted and grouped in a logical manner. In most cases this is done in order to be able to come up with some aggregate number or total by group.

Summary vs. Subtotal

Subtotals, a type of summary, are calculations based on the sum of a group of numerical values. Therefore, subtotals are only available on number or currency fields. A summary, however, is not always a subtotal, nor is it always based on numeric values. A summary can be a total count for entries in a group, or an average of numeric values. It is the value generated as the result of an evaluation, a tally, or a calculation performed on data from a single group. Subtotal or summary information is added to the Group Footer. To insert a summary or subtotal field, do the following: 1. Select Insert + Summary from the main menu or click the button. You can also right-click a field and select Insert Summary or Insert Subtotal, depending on the data type of the field. If you have a field selected when you choose to insert a summary or subtotal, your options will depend on the data type of the field. If you have no data field selected when you choose to insert a summary or subtotal, you will be given the option to choose a field. 2. If no data field is selected, you will then be presented with the following dialog:

3. Choose a field with which to create a summary or subtotal, if one is not already selected. Take time to explore all of the calculation types. You will be creating summaries often in report development. 4. Select the type of calculation you wish to perform for this summary.

38

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 3: Sorting, Grouping, and Summarizing 5. Click OK. A subtotal field is then added to the report:

You can see the summary information on the Preview tab:

You will most likely want to add a text object to describe the summary information.

Showing Percentage Summaries

You can show numbers as a percentage of a group that is a part of a broader-based group. Percentage summary fields support the sum, average, maximum, minimum, count, and distinct count operations. In order to add a percentage summary, do the following: 1. Select Insert + Summary from the main menu or click the button. You can also right-click a field and select Insert Summary or Insert Subtotal, depending on the data type of the field. 2. Once you have made a selection of a field and calculation operator, select the Show as a percentage of checkbox and choose an appropriate higher-level group to use as the denominator.

3. A percentage summary field will be inserted on the correct group footer.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

39

Section 3: Sorting, Grouping, and Summarizing

Inserting Grand Totals

Inserting grand totals is a very common thing to do on a report. They often go on a Report Footer. In order to add a grand total do the following: 1. Select Insert + Summary from the main menu. 2. The Insert Summary dialog box opens:

3. Select the field from which you will be creating a grand total. 4. Select the mathematical operator to apply as the grand total. 5. Click OK. A Grand Total field will automatically be placed on the Report Footer. The report will contain a grand total number on the last page of the report, in the Preview tab.

40

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 3: Sorting, Grouping, and Summarizing

Exercise
In the following exercise you will continue to use the CustomerSales.rpt. You will be adding summary fields, percentage fields and a grand total to the report. 1. With the CustomerSales report open, make sure that you have grouped your report by state then by customer number. 2. Add a field that calculates the total ytd_sales for each state. 3. Add a label to that field. 4. Add a field that shows each state's ytd_sales as a percentage of the grand total. 5. Add a label to this field. 6. Add a grand total to your report and add a label to that field. 7. Save your report.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

41

Section 3: Sorting, Grouping, and Summarizing

42

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 4: Making Reports Presentation-Quality


Objectives
When you finish this section, you will be able to: Apply special formatting to objects Use special Crystal Reports fields Add lines and boxes Insert pictures

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

43

Section 4: Making Reports Presentation-Quality

Applying Special Formatting


Many options exist so you can customize your report to be presentation quality, for example: Fonts and colors of fields Accounting conventions Number, currency, date, time, and date/time formatting Vertical text Paragraph formatting (line indentation) Character spacing

We will now focus on those options that have not yet been covered. You have already learned how to change the font size, style, and color of the fields and data on your report. You have also learned how to change a numerical or currency field properties such as negative values, decimal operator, currency symbols and others. Now let's look at date and date/time field formatting.

Date, Time, and Date/Time Field Formatting

To modify the formatting for a date field, right-click the field and select Format Field. You will be presented with the following dialog:

From this dialog, you can select a date format from the list box. Once you have selected a format, click OK.

44

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 4: Making Reports Presentation-Quality You will then see the dates formatted for you:

You can also customize the date and time fields by clicking the Customize button. Take time to explore all of the variations for customizing dates and times. These are frequently used in reports.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

45

Section 4: Making Reports Presentation-Quality

Using Special Fields


Special fields contain information that is not included in the database but is useful to the overall presentation quality of the report. Crystal Reports provides a number of special fields for you to choose to add to your report. You can access them through the Field Explorer.

Take time to look over all of the different special fields available to you. Think of different instances where each would be used. To add a special field to a report, do the following: 1. Open the Field Explorer. 2. From the open Field Explorer window, click and drag one of the fields onto the Details or Preview tab of the report. 3. The field is attached to your cursor; just click in the report where you want the special field to appear.

46

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 4: Making Reports Presentation-Quality

Inserting Lines and Boxes


If you want to make certain data or summaries to stand out from the rest of the report or just want to improve the overall appearance of the report, you can use lines and boxes. When working with lines and boxes, you may prefer to work in the Design window. This makes it easier to see the area in which you are working and easier to ensure that the line or box is positioned correctly.

Inserting a Line

To draw a line, do the following: 1. Select Insert + Line from the main menu or click the toolbar. Result: A pencil cursor appears on the screen. 2. Position the pencil tip where you wish for the line to start. Click, hold and drag the line to the point where you wish the end of the line to be. Release the mouse button. To format the line: 1. Click the line to activate the handles on each end. 2. Use the four-way cursor to move your line to a new position. You can also resize the line with the resizing handles on either end of the line. button on the Supplementary

Inserting a Box

To insert a box in your report, do the following: 1. Select Insert + Box from the main menu, or click the toolbar. Result: A pencil cursor appears on the screen. 2. Use the tip of the pencil to draw with. Position the pencil where you want one corner of the box and drag your mouse to the opposite corner of the box. Release the mouse button. button on the supplementary

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

47

Section 4: Making Reports Presentation-Quality To format a box: 1. Right-click the box and choose Format Box. You will be presented with the following dialog:

From here you can change the style, width, color, add drop shadow, and even fill the box with color. Take time to look over all options for coloring, drop shadows, and the check boxes at the bottom of the window. 2. To change the rounding of the corners of your box, click the Rounding tab.

3. Once you have made the desired selections, click OK.

48

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 4: Making Reports Presentation-Quality

Inserting a Picture
Often when developing your reports, you will want to include a picture or graphic - for example, a company logo. You will find it easier to work on the Design tab when inserting pictures and graphics to ensure that it appears in the section that you want. To place a picture on a report, do the following: 1. Select Insert + Picture from the main menu, or click the Supplementary toolbar. button on the

2. Locate the BMP, PCX, TIF, JPG, or TGA graphic file you want to use on the report and click OK. 3. A picture field will be attached to the cursor. Place the upper left corner of the graphic on your report where you wish for it to be placed and click the mouse button to release. 4. You may need to adjust the height of the section you are inserting into. You can do this by dragging the gray section divider lines on the Detail tab, up or down. Hover your mouse over the line until your cursor becomes a horizontal line with two small black arrows, one pointing up, the other pointing down. Click, hold, and drag the gray line up or down to make room. 5. If you want your section to fit perfectly against the bottom-most object, right-click on the left hand margin of that section and select Fit Selection.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

49

Section 4: Making Reports Presentation-Quality

Exercise
In the following exercise you will continue working with the CustomerSales report. You will add presentation-quality formatting to the report including lines, boxes, color, special fields, and images. 1. With your CustomerSales report open, add a thin blue line beneath the column headers. 2. Draw a box around the state-level group. Rounding the corners is optional. 3. Fill the box with a color of your choice. 4. Draw a drop-shadow box around the Subtotal fields for each state. 5. Change the font for all fields on the report to Arial (Arabic). 6. Change the color of the States to green. 7. Add the file path to your report to the bottom left-hand corner of each page. 8. Add the print date and print time with labels to the top left corner of your report. 9. Add Page N of M to the bottom right corner of each page of the report 10. Add an image to the report header.

50

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 5: Text Objects ________________________


Objectives
When you finish this section, you will be able to: Import elements into a text box Combine text boxes with database fields Combine text boxes with special fields Format individual elements of a text object

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

51

Section 5: Text Objects

Combining Text Objects with Database Fields


Combining text information with data field information (or multiple fields) is a powerful way to add value to a report. Below are few examples where this might be appropriate.
Text Mr. Printed: Unit Cost: $[field1] Ext. Cost: $[field2] Database field(s) Contact Name CurrDate Unit cost & Ext. cost Output Mr. Bud Bundy Printed: February 2, 2002 Unit Cost: $2.00 Ext. Cost: $50.00

To combine a text box with database field: 1. Create a text object. 2. Open the Field Explorer. 3. Choose the database field you want to add. 4. Drag the field into the text object. You can insert multiple fields by choosing them all at once and dragging them into the text object simultaneously. TIP: Don't let go of the mouse until you see a vertical line in the text object equal to where you want to insert the database fields. EXAMPLE:

Using the Can Grow Option

Often,adding a database field that has varying field lengths will extend the data in the text object beyond the length that it was drawn on the report. Selecting Can Grow allows Crystal to expand the size of the text object similarly to a word processing "word wrap." The box will grow horizontally to fit all of the data. You will find this option in the Format Editor. Right-click on the field and select Format Text to open the Format Editor. The Can Grow field is on the Common tab.

52

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 5: Text Objects

Exercise: Inserting a Database Field to a Text Object


This exercise will demonstrate how to insert a database field into a text object. Follow the steps below and share your output with your neighbor. 1. Create a blank report displaying Customer Name, City and Credit Limit. 2. Group the report by State. 3. Apply any formatting and other Crystal functions you have learned to this point. 4. Insert a summary count for each group on customer name. 5. Add a text box with a message annotating the purpose of the count. 6. Drag your summary count into the appropriate point in your text object's message.

Check Your Work


Preview

Design

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

53

Section 5: Text Objects

Adding a Special Field to a Text Object


Adding a Special Field to a text object uses the same process as adding a database field into a text object. Special Fields are Crystal functions that add value to the report. The following table lists Special Fields.
Page Number Page N of M Report Comments File Author Print Date Modification Date Record Number Record Selection Formula Total Page Count Report Title (File +Report Options) File Path and Name File Creation Date Print Time Modification Time Group Number Group Selection Formula

54

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 5: Text Objects

Exercise: Adding a Special Field Into a Text Object


1. Add the following information into the report header:

2. Expand the size of your header to 2". 3. Use the button to add a text box to the report header.

4. Type two lines of text to look like this:

5. Insert the special fields to the right of the text. Only bold the special fields.

When adding text boxes, don't forget to add $, %, spaces or anything else that is needed to make the report look professional.

Check Your Work


Design

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

55

Section 5: Text Objects

Preview

Save this report.

56

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 5: Text Objects

Additional Text Object Formatting


To format individual elements of a text object:

1. Double-click the object to place it into edit mode. 2. Select the element you want to format. Elements can be a selection of text or a field. 3. Right-click the selected element. Result: You'll receive the short cut menu. 4. Click the appropriate menu item from the shortcut menu. For example: Change Font.

To set tabs in a text object: 1. Right-click the text object and click Edit Text Object. Result: The ruler line will appear. 2. Click the ruler at the point where you want the tab.

To move a tab, drag it inside the ruler (horizontally). To remove a tab, drag it off the ruler (vertically).

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

57

Section 5: Text Objects

Exercise
1. Change one word in your report title to a different font and color. 2. Customize the date to display MM/DD/YYYY.

Check Your Work

58

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics _____________________


Objectives
When you finish this section, you will be able to: Use basic formulas in Crystal Reports Work with the formula editor Create basic formulas Apply string manipulation Perform date calculations Apply a Boolean formula Create If-Then-Else formulas Use running totals

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

59

Section 6: Formula Basics

Using Formulas
Components of a formula include: Numbers Operators Functions Summaries Text Other formulas Database fields Create a new formula by clicking the New button or right-clicking + New. Then assign the formula name that will be its column heading. Edit a formula by clicking the Edit button or right clicking + Edit. Rename or delete a formula from the shortcut menu.

From the Field Explorer you can:

60

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics

Working with the Formula Editor


With the formula editor you combine database fields, numbers, operators, functions and text to create a working formula. You can type the formulas in directly or you can doubleclick the entire formula in most cases.

Defining the Parts of the Formula Editor

Formula

Report Fields

Functions

Operators

Report Fields - All database fields and formulas are here and available for selection into the formula. The fields and formulas already in the report are under Report Fields. Functions - All available functions are listed showing their arguments and arranged by their use. If you have created any functions, they will be listed at the end. Operators - Operators are special symbols that represent an action to be taken placed between two or more values. Crystal reads and performs the specified action. Formula - The formula is built in the Formula text box. Fields, functions and operators appear at the position of the cursor as you double-click them in the dialog boxes above. Crystal will place all [ ] () as they are needed. If you double-click the operators and functions, it will not place them when you are typing the formula.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

61

Section 6: Formula Basics

Exercise: Create a Report for Use with Formulas


1. Select File + New + "As a blank report." 2. Expand Create New Connection + ODBC (RDO) and select your data source and database. 3. Select the database tables CO and COITEM. 4. Clear all links and join the tables by CO-NUM. 5. Click OK. 6. Select co-num and order-date from CO and co-line, item, order qty and cost from coitem. Your design should look like this:

7. Set the report to Landscape under File + Printer Setup. 8. Group the report by salesman. (Co.slsmn.) 9. Save the report as formulas.rpt

62

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics

Basic Calculations
Basic calculations can be used to get data out of the database and perform basic functions in order to get the desired output. Often times the database won't include all of the values necessary for detailed reporting.

Exercise: Creating an Extended Cost

1. From the Field explorer, highlight Formula Fields, right-click and select New. 2. Name the formula Ext. Cost and click Use Editor to display the Formula Editor. 3. Under Report Fields, double-click coitem.qty-ordered. 4. Press the SPACEBAR and type "*", or select the operator for multiplication (x*y).

5. Double-click coitem.cost. 6. Your expression should look like this: {coitem.qty-ordered} * {coitem.cost}. 7. Click 8. Click to check for errors. to save and close the formula editor.

9. Your formula should appear in the field explorer. Click and drag it to the right of Cost. Your report should be similar to this:

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

63

Section 6: Formula Basics

Exercise: Creating a Conditional Sum

1. From the Field Editor, highlight formulas and click New. 2. In the Functions box, under Summary, select Sum (fld, condfld). 3. Inside the brackets and before the comma, select @Ext. Cost. 4. Place your cursor after the comma and select co.slsmn. 5. Your expression should look like this: Sum ({@Ext. Cost}, {co.slsman}) 6. Place this in your group footer under Ext. Cost. 7. Add a text box and place the following text, formulas and database fields in the text object and align the numbers to display under the Ext. cost.

Check Your Work

Refer back to the section on text objects if you need assistance with adding db and special fields into a text box. You can place the $ in the text box or select it under Format Field from the shortcut menu.

64

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics

String Manipulation
Next, we'll create a report containing employee information and apply some more formulas. Minimize or save and close the current report. We'll be coming back to it later. 1. Select File + New + As a blank report. 2. Choose the Employee table and Employee Salary table, then click Close. 3. Clear the links and join these tables by emp_num. 4. Select Employee Number and Name from employee. 5. Create the following formula, but do not place it on the report. a. Open the Field Explorer, highlight formulas and click New. b. Double-click employee.phone. c. Under Operators, select String + Subscript. Example: {employee.phone} [5 to 13] e. Check for errors, save and close the formula editor. 6. Add your formula to the details line. 7. Next, add the hire date to the report, but do not add the hire date field. We'll create a formula to demonstrate how to put a date field into a text format. a. Highlight formulas in the field explorer and click New. b. Select ToText (x.y,z,w) under Strings function. c. Create the following expression: ToText ({employee.hire-date}, "ddd, MMMM d, yyyy") 8. Add your formula to the report. d. Type "5 to13" without the quotes. Save and close the formula editor.

Check Your Work

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

65

Section 6: Formula Basics

Basic Date Calculations: Adding a Formula Inside a Formula


You can use formulas to give you a range of dates or time elapsed between dates in a Crystal Report. Use the employee report and calculate a Days Since Hire formula on this report. Follow along with the steps provided below: 1. Highlight Formulas in the Field Explorer. Click New. 2. Name the formula "Days since hire." 3. From the Date and Time function, select currentdate then add the employee.hire-date field. 4. Save the formula. 5. Create a new formula and name it, "time with company." 6. Create this formula: {@days since hire} / 365. 7. Save this formula and add it to the report. This may be useful to determine benefits.

Check Your Work

Formulas used: Days since hire: CurrentDate - {employee.hire-date} Time with company: {@Days since hire} / 365 Save and close this report.

66

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics

Exercise: Applying Boolean Formulas


You can change the display of the Boolean output under File + Options + Fields. Available options are 0/1, T/F, True/False, Y/N or Yes/No. An example of when to use Boolean formulas would be to display True or False on a sales report for orders over $50,000. 1. Open up your formula report and ungroup the salesman and group on order number. 2. Insert a subtotal for Ext. Cost column. 3. Create a new formula called High Line Sale. 4. Create the following expression: @Ext. cost > 10000 5. Place this in the details of your report. 6. Next, create a formula for High Sales: Sum ({@Ext. Cost}, {co.co-num}) > 50000. Hint: this is already a formula, double click the formula and > 50000. Do not use commas to separate your 1000's place. 7. Place this in the group footer.

Check Your Work


Design

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

67

Section 6: Formula Basics

Preview

68

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics

Applying If-Then-Else Formulas


If-then-else formulas are conditional formulas. This means that IF a condition is met then, a certain action will occur. And If it is not met, then another action will occur. Keep using the formulas report and complete this exercise.

Exercise: Using If-then-else Conditional Formatting


If line item sales > $12,000-Huge sale If line item sales > $5,000-Average sale If line item sales <= 5,000-Low sale

This formula will display a different message based on the total sales by order:

1. Create a formula called "Sales Rating." 2. Type the following formula: if {@Ext. Cost} > 12000 then 'Outstanding' else if {@Ext. Cost} > 5000 then 'Average' else 'low sale' 3. Place this in the details of your report.

Check Your Work

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

69

Section 6: Formula Basics

Working with Running Totals


Running totals are totals that are displayed record by record. They can be used to total all records in the report, in the group and so on-- up to and including the current record. The most basic type of running total is that of a single list. See the chart below to get an idea of what a running total is all about.
Values 2 4 6 8 Running Total 2=2+0 6=2+4 12 = 6 + 6 20 = 12 + 8

This example shows a running total for a SUM other running totals include count, distinct count, average and so on. Running totals are specifically suited for totaling these 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

Running Total Expert (Wizard)

The Running Total Expert creates the total by asking you to select a field to summarize, the summary operation to use, a condition which to base the evaluation, and a condition on which to reset the evaluation.

Running totals can be used on any database field or formula field, but they cannot be used to calculate the total of a print time formula.

70

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics

Placement of Running Totals

The chart below illustrates the behavior of running totals depending on its place within the report.
Placement Report Header Page Header Group Header Details Group Footer Page Footer Report Footer Results Returns first record of the report. Creates running total up to and including the first record of the current page. Creates running total up to and including first record of the current group. Creates running total for every record. Creates a grand total for each group Creates running total up to and including the first record of the next page. Creates a grand total that includes all records

Exercise: Running Totals in a List

1. Open the formulas report and bring up the Field Explorer. 2. Right-click Running Total Fields and select New to access the Running Total Expert.

3. Type a name for the running total. In this example, we'll keep a running total by line item, so we'll call it Line by Line Total. 4. Place your cursor in the field to summarize and highlight @Ext.Cost and click The default for the Type of Summary is Sum. That is ok. 5. Under Evaluate, choose For each record. 6. Under Reset, choose On change of group. .

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

71

Section 6: Formula Basics 7. Your Expert should look like this:

8. Click OK to accept the running total. 9. Place it in the details of your report.

72

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 6: Formula Basics

Check Your Work


Preview

Design

There are two items of note. First, notice the preview where the last line item's running total is equivalent to @Ext. Cost formula. This is a good indication that we have done this correctly. Second, On the Design tab, formulas have an "@" symbol and running totals have a "#" sign in front of them.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

73

Section 6: Formula Basics

74

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 7: Conditional Reporting ______________


Objectives
When you finish this section, you will be able to: Use the highlighting expert Use conditional formatting

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

75

Section 7: Conditional Reporting

Using the Highlighting Expert


This expert allows you to quickly apply conditional formatting to currency and number fields. From one dialog box, you can apply: Font color Background color Border style

Format + Highlight Expert To use the Highlight Expert: 1. Open the Highlight Expert, by clicking Format + Highlight Expert. 2. Select a comparison from the value-is box. 3. Enter a numeric value in the adjacent box. 4. Set the font, color, background and border. 5. Apply new formulas as needed. Use the priority arrow to specify the priority for each formula. 6. Click OK to return to the report or New Item to add another condition.

76

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 7: Conditional Reporting

Exercise: Using the Highlight Expert

Add highlighting if a line item is less than $500 and make them red. Add another for line items over $10000 and make them blue.

Check Your Work

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

77

Section 7: Conditional Reporting

Conditional Formatting
Absolute formatting is when every instance of an item or object is the same regardless of its contents. When you need to format objects based on conditions or different situations, you use conditional formatting.

Applying On or Off Properties

In the Format Editor you can simply check a box to suppress the object all of the time.

To suppress this field only when the value is less than $5000, click the Formula button and type {co.cost} > 5000. Click OK when you are done.

Attribute Properties

These are identical to ON or Off properties except they are truly conditional. Given the previous example, let's add another color: If {co.cost} < 5000 then red else black. OR If {co.cost} < 5000 then red else if {co.cost} < 15000 then black else green.

78

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 7: Conditional Reporting

Exercise
Format the fields on your formulas.rpt to display the True in Blue and False in Maroon. Next, make values in your running total (line item sales) to be orange if they are less than $5000, and green if they are higher than $20,000.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

79

Section 7: Conditional Reporting

80

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 8: Section Formatting _________________


Objectives
When you finish this section, you will be able to: Change the size of a section Format sections with the Section Expert Create a summary report

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

81

Section 8: Section Formatting

Changing the Size of the Section


When you start a report, the sections are assigned a default size. Perhaps you would like some additional space between the records on the report, in such a case you would drag the details section " in Design. To resize a section: 1. Move the cursor over the bottom boundary of the section you want to resize. 2. When the cursor changes to the resizing cursor, drag the boundary to make the section larger or smaller.

You cannot resize the section to be shorter than the lowest object's bottom boundary. You can use the Fit Section command from the area shortcut menu to eliminate any unused white space. It will resize the section automatically.

Exercise

Change the size of your Report Header and insert a graphic of your choice.

82

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 8: Section Formatting

Formatting Sections Using the Section Expert


The Section Expert is a powerful tool that allows you to format sections of your report absolutely or conditionally with a formula. To open the Section Expert, you may choose one of three methods: Using the icon Right-click Section in Design and Format Section Selecting Format + Section from the pull down menu.

Section Expert

The Section Expert contains these buttons: Insert - Adds a part to the report, the highlighted section will be added when you click Insert. Delete - Removes the highlighted section from the report. Merge - Combines sections into a single section.

Section Expert - Common Tab

With the exception of Free-Form Placement and Hide, all of the options on this tab can be set conditionally or absolutely. Applying formulas is how you conditionally format the selection. For example, if you want to suppress certain information when a condition is met, you could check the Suppress box, click the Formula button and create a condition as to when that data is suppressed. Most of these options are self-explanatory; however, let's review a couple of the non-intuitive selections:

Free Form Placement Keep Together

Select this checkbox to place objects in a free-form environment similar to that of a drawing program. When this checkbox is selected, Crystal keeps all the lines of the section together, either on the current page (if there is room) or on the next (if not).

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

83

Section 8: Section Formatting

Underlay Following Sections

Select this checkbox if you want the selected object to underlay the following section(s) when it prints. For example, you could create a Group #2 and embed an object (graphic, logo, image etc.) and Crystal will use this as a Watermark.

Formatting with Multiple Columns

Only available from the Details section, this allows you to display information in a column format as opposed to one after the other. An example of this is mailing labels. The checkboxes and selections available are different for each section of the report. This means that if you want the same results of a specific checkbox in multiple sections, you would have to highlight each section independently and select that box for each section.

Section Expert-Color Tab

On the color tab, you can select different background colors for each section of your report. You can format any section with this tab by selecting the section to the right of the tab. The section expert will display every section as well as newly created sections too.

Selecting a Background Color

1. Click the Background Color button for the section that is highlighted and pick a color from the drop down menu. 2. By clicking the Formula button , you can enter a Boolean formula to make the color of the section conditional. If you want more than one color, use an If-Then-Else formula. Or, perhaps you want a green bar report, in which case you could use the following formula: If Remainder (RecordNumber, 2) <> 0 then green else NoColor

84

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 8: Section Formatting The report should look like this:

Exercise

Format each section of your report to have different colors. For the Details section, use the example above to print every other line with a different color.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

85

Section 8: Section Formatting

Creating a Summary Report


All of the reports to this point have been detail reports. Suppose you are a manager and only want to see the aggregates or summarized information. Think back to the section on formatting the sections. There was a suppress or hide option that will do this. Summary reports are easy to create from a detail report. You must have at least one group and one summary field. Then you can hide the details. When the summary report is created, you must decide if the users will have the ability to drill down. In other words, to see the data behind the summarized totals.

Hide vs. Suppress

Hide (Drill down OK)

With this parameter selected, the users will receive a magnifying glass indicating that one can drill down on this field into its details.

Suppress (No Drill Down)

With this parameter selected, you cannot view the data behind the summarized totals. It is a true summary report and the details are not viewable.

Exercise

Go into the Section Expert. Select the details section and click Hide. View the results and drill into the detail. Next, return back to the section expert and unclick the Hide and choose Suppress instead. Go and view the results. What is different about the two? Discuss this with your neighbor.

86

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 9: Adding a Custom Report to SyteLine


Objectives
This is a cumulative exercise to maximize the training you have received so far. The idea is to combine your Customizing skills with the technical aspect of Crystal Reports. Upon completing this class, you will be able to: Create a new SyteLine form from scratch Add the appropriate components to the form to pass the report parameters Create a background task in SyteLine and assign it to a report Create a report in Crystal from a stored procedure Format the output of your Crystal report Store and access the stored procedure adequately

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

87

Section 9: Adding a Custom Report to SyteLine

Background Tasks, Stored Procedures and Crystal Reports


At this point, you will begin making the transition over to reporting topics. In the following pages you will complete an exercise that involves the creation of a report options form, a stored procedure and Crystal report from that stored procedure. It is important to understand what happens after the report parameters and information are entered by the user on your form and they choose to print the report. The following section will describe what happens in SyteLine 7.0 between the clicking of the Print button and the actual generation of the report. SyteLine 7.0 handles the running of a report as a background task to be executed. That said, it makes sense to assume that there must be a 'queue' of some kind that contains tasks to be executed. Also, there must be an application responsible for executing these various background tasks (including the running of reports). Is there also, you may ask, somewhere a user can create named background tasks that can be run as event handlers by, let's say, clicking a button? The answer to all of these questions is yes. 1. The 'queue' is called the 'Active Background Tasks' form (which is actually just a view to the ActiveBGTask table). You can view the form at any time to see which tasks are running (READY) or (RUNNING). 2. The application responsible for polling the ActiveBGTask table is called Taskman. Taskman is an NT service that listens for any new task to be posted to the ActiveBGTask table with a status of 'READY' and executes that task. 3. There is a form where a user can add named background tasks and give them parameters, such as a report and a report name. This is done from the 'Background Task Definition' form. 4. Once Taskman has completed the task, the task is viewable from the "Background Task History" form. You can view active tasks here as well, and it is recommended you do so as they show the start/stop times and give you success/failure indicators.

88

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 9: Adding a Custom Report to SyteLine

Comprehensive Exercise
The following exercise will be a cumulative review of forms creation, customization and Crystal Reports. Upon completion of this exercise, you will have a simple report and a report options form to use in launching a SyteLine report. There will be limited SyteLine report launching architecture discussed during this exercise. After completing this exercise you will have: Created a new 'Build from scratch' form Added two Enhanced combo boxes and one button Added list sources to the combo boxes Added events to the button Named and saved the form Created a Stored Procedure in Query Analyzer Created a Crystal report using the stored procedure

The goal of this exercise is to create the necessary components to allow a user to select a beginning and ending order number and launch a report that shows the order header and line information for those orders, grouped and summarized by salesman.

Step 1: Create a new Stored Procedure


1. Open Query Analyzer. 2. Change the database dropdown to your training database. (It will look something like "SyteLine_App" or "demo"). 3. Type the code below into Query Analyzer:
CREATE PROCEDURE RPT_OrderByNumberSp( @StartingOrder OrderNoType = Null, @EndingOrder OrderNoType = Null) AS SET @StartingOrder = ISNULL(dbo.ExpandKyByType('coNumType', @StartingOrder), dbo.LowString('coNumType')) SET @EndingOrder = ISNULL(dbo.ExpandKyByType('coNumType', @EndingOrder), dbo.HighString('coNumType')) SELECT co.co_num, co.order_date, co.slsman, coitem.co_line, coitem.item, coitem.qty_ordered, coitem.price FROM JOIN ON WHERE GO co coitem coitem.co_num = co.co_num co.co_num >= @StartingOrder AND co.co_num <= @EndingOrder

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

89

Section 9: Adding a Custom Report to SyteLine 4. Test your stored procedure by using the following information:

90

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 9: Adding a Custom Report to SyteLine

Step 2: Creating the Crystal Report .RPT

1. Open up Crystal Reports by selecting Start + Programs + Crystal Reports. 2. Select Using the Report Wizard from the Welcome to Crystal Dialog box.

3. Click OK from the Crystal Report Gallery. 4. Expand Create new Connection + ODBC in the next dialog, then your database, for example: SyteLine_APP. 5. You should have two options once the database is expanded: Tables and Stored Procedures. If Stored Procedures is not a selection, right-click the database and select Options to enter the Options dialog and select Stored Procedures.

6. Now that you have Stored Procedures as a selection, expand that option, find your stored procedure, and move it into the Selected Tables list.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

91

Section 9: Adding a Custom Report to SyteLine 7. Set the parameter fields to allow Nulls. This will allow the report to be run "wide-open".

8. Click OK to return to the Data Explorer and then click Close. 9. Click Next and then add all of the fields from the stored procedure.

10. Click Next to advance the Group Dialog. 11. Add Salesman and CoNum to the Group By column. 12. Click Next to advance to Summaries for the report.

92

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 9: Adding a Custom Report to SyteLine 13. Remove CoLine from the Salesman Tab.

14. Remove all of the entries from the CoNum tab.

This is done so that you only have totals for the main group on this report, Salesman. You may choose different options during steps 13-15 to provide a different flavor for your report. There is no right or wrong answer for your grouping options, but some options are more intuitive for the end users of this report. Other logical groups would be State, Customer, or Zip Code. 15. We are done with the Report Expert and we now need to put some special touches to the report's formatting. Thus, we will need to click the Design Report button. Our goal here is to "beautify" the output of our report. Take five minutes and format the report. It is easiest to remain on the Design tab while formatting your report. Format changes in the example below include, Font changes to column titles, dollar signs where applicable, green bar (remainder function), adding a title, print date, page numbers, resizing fields, date formatting (to remove the time element), suppressing duplicate values and more.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

93

Section 9: Adding a Custom Report to SyteLine Your report may look similar to this:

16. Save your .rpt in the correct folder with a name of xxxOrderByNumber. The location to the folder is c:\program files\ Frontstep\Taskman\Report\Reports (the xxx is your initials).

94

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 9: Adding a Custom Report to SyteLine

Step 3: Create a New Background Task

1. Open the Background Task Definition form and start a new record. 2. Give the task a name of xxxOrderByNumber (with xxx being your initials). Remember this name. It will be used as the BGTaskName on the report options form, a variable that we will pass back to Taskman. It must be added to that form just as you type it on this form. Copy it to your clipboard for easy recall.

3. Give the task a description. 4. Enter the name of the report as xxxOrderByNumber (with xxx being your initials. This should be the same exact name as your .rpt file, without the .rpt). 5. Select RPT as the Executable Type. 6. Save the record. Following the same example, here is a sample of how this form should look:

Step 4: Create a Basic Report-Criteria Form


You must have Site Developer editing permissions before you can create a form. 1. Create a new form by clicking Form + Definition + New. 2. Once the Specify Form Name and Type dialog is open, name the form something that indicates its overall function. 3. In the Form Type field, select Build From Scratch. 4. You do not need to select a data source for this form since it will be acting simply as a report options form. We will actually be passing parameters from this form to your stored procedure. 5. Click Next, then Finish to bring up the Form Properties window. You can either enter a description or just leave it blank and click OK.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

95

Section 9: Adding a Custom Report to SyteLine 6. Once you have a blank form in front of you, you will need to add an Enhanced Combo box. This component will be for the beginning order number. On the General tab of the component property window, select Enhanced Combo from the Type dropdown list.

7. Type CoNumVar in the Component Class dialog box.

Change back to run-time mode and see what kind of functionality this provides. 8. Move to the Data tab and click the Binding button. 9. Select Variable out of the dropdown and click Edit. 10. Type StartingOrder in the Variable field.

Click OK to return to the Components Attributes box. It should look like this:

11. Next, you will need to add a static label next to your combo box. 12. Repeat steps 6 through 10 for the ending order number. 13. You will next need to add two variables to the form. 14. While you are in Edit Mode, navigate to Edit + Variable and click New.

96

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 9: Adding a Custom Report to SyteLine 15. The first variable is BGTaskName, and it should look like this:

The value should be identical to the Task Definition Name. Use copy and paste to guarantee that they are identical. 16. The second variable is BGTaskParms. They are your combo boxes and should look like this:

17. Next, add a Push Button to the form. Give the button the caption Print. 18. Go to the Behavior tab and type Generate Report as the primary event. 19. Click the Primary button, then click the New button to enter a new event handler. 20. Select Run Background Task from the Type dropdown list. 21. Click the Parms button, then click the Type Specific Parameters button and enter the name of the background task from step 1 of the exercise. 22. Enter the following information - these are the parameters that will be passed to the stored procedure that will gather the correct information for your report.

23. Click OK three times to get back out to list of event handlers. 24. Click New once more to add one more event handler. 25. This time, select RunScript from the Type drop-down.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

97

Section 9: Adding a Custom Report to SyteLine 26. Next, type ReportSubmitted into the Parms field.

27. Typing ReportSubmitted will place the following text into the script window:
SubMain () MsgBox GetStringValue("sTaskSubmitted"), vbOKOnly, ThisForm.Caption

This will cause a message box to pop up to let the user know that the task has been submitted. 28. Close out of the script window and click the Done button. 29. Arrange and align your components on your form so that they look presentable and save your form definition. Your form may look like the following:

30. Test your work. Enter two order numbers and click Print.

98

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.

Section 9: Adding a Custom Report to SyteLine Background Task History will assign your request a Process ID Number. In this case it is 158 and you can see the parameters passed by the form in the Task Parameters dialog.

Finished!

Above is the output for the cumulative exercise. Your results may vary from this example.

2003 MAPICS, Inc.

SyteLine Crystal Reports Training Guide

99

Section 9: Adding a Custom Report to SyteLine

100

SyteLine Crystal Reports Training Guide 2003 MAPICS, Inc.