Академический Документы
Профессиональный Документы
Культура Документы
Exercise 1: Starting the Crystal Reports Program, Exploring the Environment and
Database Expert ...........................................................................................................2
Exercise 3: Date/Time Selection Expert and Setting Print Date and Time................27
Exercise 11: Using Group Layout Charts and Creating Top N Reports...................137
This documentation contains confidential and proprietary business information of Saudi Aramco. This document, including
copies of all or any part thereof, may not be released or disclosed to persons other than Saudi Aramco employees except as
necessary for business purposes of Saudi Aramco under an appropriate confidentiality agreement.
Saudi Aramco
The objective of this exercise is to familiarize end users with the start up process of
Crystal Reports from the Start button on the user system.
Note: Users may select the Data Source Type from one of the
followings:
4. In the Data Expert window, click on the + sign to the left of Create New
Connections as shown below:
9. Click on OK button.
Note: The Field Explorer window displays with the Design grid
in the background. The field Explorer contains the fields
that belong to the selected table as shown:
Report Header Items Placed on the Report Header print only on the first page of
the report. Often the name of the report, the print date, company
logo, or “Title page” information is included in the Report Header.
Page Header Objects in the Page Header print at the top of every page of the
report. Column Headings, print dates and page numbers are
common entries in the Page Header.
Details Place the data fields on which you want to report in this area.
This information (database fields and text) prints for every record
selected on the report.
Report Footer Items placed here print only on the last page of the report. Grand
Totals, total number of pages, and other Summary information
are often placed here.
Page Footer Objects placed here print at the bottom of every page. Page
numbers are often placed in the Page footer.
10. Click on the Field Explorer button on the Application toolbar above the screen
if it is not displayed by default:
Note: Notice the Field Explorer with the Report Fields and Report
Sections tabs added to the left of the designer
screen. Notice also that some of the icons on the application
toolbar above are inactive. They will get activated once you drag
and drop the table fields to the Details section in the design
screen.
11. Expand the + to the left of Database Fields then expand the Customer table to
display all the fields as shown below:
12. Drag and drop the first field Customer ID to the Details section to activate the
inactive buttons. To help you discover the application, drag and drop customer ID
in the Details section of the design screen. Notice that the database of customer ID
Supplementary
Toolbar
D G G R S S F O T F I H
Table: Customer
Fields: Customer Name, Region, City, Last Year’s Sales
2. Click on OK button.
3. From the Field Explorer dialog box, expand the Database Fields by clicking on
the + sign to the left of the item.
Note: If the Field Explorer dialog box is not shown, users may
follow the menu path to display it: View → Field Explorer
or click on Field Explorer button.
5. Click on the Customer Name then drag and drop it to the details section in the
design window to the left side.
Note: Once the field is clicked on and dragged, the shape of the
6. Repeat this step with Region, City, and Last Year’s Sales.
Note: Ensure that the fields are not on top of each other.
9. To format the Last Year’s Sales field to print with no decimal places, with a
thousands separator (,) and with a floating dollar sign, click on Last Year’s
Sales in the Details section, right click and select Format Field from the drop
down menu as shown below:
10. Click on the Number tab on the Format Editor box if it is not shown by
default.
12. Click on the Decimals drop down arrow and select 1 (No decimals) as shown
below:
13. To set the dollar sign as Floating, click on the Currency Symbol tab
.
17. To preview the report and see the results of the design, click on the Print
Preview button.
18. To toggle between the Preview screen and the Design screen, click on the
Design tab on the top left of the design screen.
19. To format the Region column header, click on the Region field in the details
section and right click.
21. In the Format Editor box, click on the Font tab as shown below:
22. To change the Font color, click on the drop down arrow to the right of Color, then
select blue. Click on the Style and select Bold then click on OK .
24. Approach the mouse until its shape becomes cross arrows and drag the two
fields and drop them to the right of City as shown below:
Note: To set the right space for the right data field size, right
click On Details in the gray area on the left and select Fit
Section from the drop down list as shown below:
25. Repeat the previous steps 23-24 to place Region at the left side in the Details
and Page Header sections as shown below:
26. To create a title, click on the Text Object button or follow the menu path:
27. Release the mouse and drop the Text Object in the center of the Report Header
section.
28. To Activate the text Object for editing: click outside the text object then double
32. To add a border and drop down shadow to the border, in the Format Editor
box, click on the Border tab.
33. In the Line style area, select single for left, right, top and bottom.
35. To change the font color, click on the Font tab and select the color.
37. To center the title, click on the title, then approach click on the Align Center
button .
39. To show the Special Fields in the Field Explorer select Print Date and drag it
to the top of the report and drag Page Number to the Page Footer the bottom
of each page.
40. Click on the + sign to expand the Special Fields as shown below:
41. Click on the Print date and drag it to the left of the report title in the Report
Header.
42. Click on the Page Number and drag it to the right of the Page Footer as shown:
Table: Employee
Fields: First Name, Last Name, Hire Date, Employee Position, Birth Date.
1. Create a report showing the staff: First Name, Last Name, Hire Date
and Position… using drag and drop method from the field list to the Details
section.
Note: Don’t delete this selection.
6. Click on OK.
7. Change the Print Date to December 1, 1994 and preview the report again
(5 records):
Note: Delete this selection before step 11
11. List all Sales Representatives hired between 03/01/1991 and 12/31/1992.
To do this, ensure you Drag employee’s Position to the Details section in the
design screen → Right click → Select Expert → Equals to → Sales
Representative (6 Records) as shown below:
Table: Customer
It is important to sort your date in a variety of ways to meet your queries. In this
exercise we are going to practice how to sort in Ascending and Descending order,
how to Group data, and how to create a Summary report: Subtotal, Grand total ,
Count, and Percentage of Total.
• Sorting
• Grouping
• Summarizing : Sub -Total and Grand Total
• Count
• % of Total
Note: Select the field from the Available Fields List → Drag and
Drop to the right side in the Sort Fields List or by selecting
1. Sort the records in your report to print in Ascending Order by Region and
City then by Last Year’s Sales in Descending order,
(Click on Record Sort Expert → Select Region ( by default it is set
in Ascending order)
2. Repeat the same with City as ascending then Last year’s Sales as
Descending Order as shown below:
4. To Group your records by City, click on Insert from the menu bar Group
or click on the Group Expert button .
6. In the lower drop down list, select in ascending order (alphabetical order).
8. Click on OK
9. Preview the report
10. Redefine: (Delete or Change the Existing Group) to be based on Region
not City. (See the note below):
Note: There are two ways to change the definition of a group:
(1) Delete the Group and Define a New One.
(2) Modify (Change) the Existing Group.
11. Remove the Region field and Column Heading in the Page Header Section
(not the Group) from your report and reposition fields if needed.
12. Preview the report
13. Save the report
14. Add Country as a Group in Ascending Order:
15. Change the color of the Country Group#2 Name field to Red by Right Click
on the Country Group#2 Name → Format field) → Font tab → Color →
Red → OK).
16. Preview the report. It is in hierarchical form, Region first then Country… see
note, please:
Note: Click Record Sort Order on the toolbar to see that the
grouping order is Region then Country. Or Select Group right
click in the gray area on the left → Change Group as shown:
17. Reorder the groups so that the records are grouped by Country then by
Region.
18. (Drag Group Header # 2 (the group you want to move and drop it over Group
Header #1 in its new location) as shown below:
Note: Grand Total will appear in the Report Footer. See last
page of the report.
22. Insert the following Summary fields using (Insert Summary ): Based
on groups already created:
B. To find out the Subtotal of each Region’s Sales for Last Year’s Sales:
Insert Summary → Sum → Last year’s Sales → Customer. Region-A
group → OK).
Note: Users may select the field they are basing their
calculations on from the Details section to save
them the first three steps which will default
automatically)
Note: Result will appear in Group Footer # 1. of the
report.
23. To format the Subtotal to include a dollar sign and no decimal places:
27. To find out a Percentage Summary for each Country’s Sales for last Year’s
Sales based on the Entire report or (Grand total); and format it to 4 decimal
places, follow this menu path:
28. To format to 4 decimal: ( Right click on Last Years Sales % Summary to the right
of Group Footer # 2 → Format field
30. Click on the drop down menu to the right of Decimals field. Then select 1.0000
which means that there are 4 decimal places added to the number.
31. Create a text object as a label for each of the summary fields; make it stand out:
To do this click on the Text Object button and place it to the left of each
Summary that you have created already for :
*Count of Companies per region
*Subtotal
*% of each region’s sales
*% of each country’s sales
As shown below in the rectangles on the design screen below:
Table: Customer
2. Sort the report in Ascending order by country and city: To do this click on
Record Sort Expert button then from the Available fields section, select
the fields you want to sort and take them to the right in the Sort Fields section
→ OK as shown below:
5. Click OK twice
6. Preview the report
Note: The currency symbol is attached to the sales
figure with no space between them.
7. Click OK twice
8. Preview the report
9. Save the report
10. Open the Field Explorer *(it is already open in version 10). If it
disappeared for one reason or another click on the Field Explorer button.
11. Under Special Fields at the end of Field Explorer components drag and drop
the Print Date and Print Time into the Report Header. To do this expand the
13. Print Page N of M at the bottom right hand corner of each page (in the Page
Footer).
as shown:
15. Click on Insert Text Object button on the toolbar and place it in the
Report Header
16. Type Home Page in the text object as shown below:
17. In Design view highlight the Home Page text object: highlight Text Object
→ Right click → Format Text → hyperlink .
23. A pencil cursor appears. Use the tip of the pencil to draw a box around each
country
24. Click the Insert Picture button on the Supplementary toolbar
27. Place a colored border around it with a drop shadow. Select the picture →
Right click → Format Graphic → Border
To draw a border around the picture with drop down shadow: select Border from
Format Editor → Click on the sides of the border to select type → Then check in
the With Drop Shadow box as shown below:
50 Saudi Aramco Training 10/14/2008 Crystal
Reports10
28. Preview
The following screen is displayed:
Table: Customer
Fields: Text Objects database
The Mailing Label report wizard guides you through the creation of a report that
prints labels. It will help you visualize the size of the label and format it as necessary
to
print the label type you choose.
The Mail Label wizard will create a report where each record is printed in a
rectangular area rather than in rows. Crystal Reports is still using bands, but the
bands are narrower and can repeat across the page in columnar format. The Mail
Label wizard can be used for any report that requires this type of formatting and not
only for label creation. It might be used to create postcards, name tags, and so on.
1. Open Crystal Reports, choose Using the Report Wizard from the welcome
dialog box, and click OK. If Crystal Reports is already open, choose File | New,
or click the New button on the toolbar.
5. In the Fields screen, move Contact First Name, Contact Last Name, Customer
Name, Address1, Address2, City, Country, and Postal Code to the Fields to
Display list and click Next.
8. To Find out the gaps, you can Delete Address2 and insert a new one in a Text
Object in Details E.
9. To suppress gaps in the addresses select all the Address 2 in the Details E→
Right click → Format Text as shown below:
11. Finally, create a title to the report. Insert a Text Object in the Page Header :
To unsuppress Report Header and Page Header ,right click the left side of
the design screen in the gray area of the Report Header and Page Header
→ Don’t Suppress as shown below:
13. Next, drag and drop a Text object in the Page Header and enter the title”
Company Contact Information”.
14. Preview
15. Insert two more text objects in the Report Header: Details are on page 60 below.
Linking Tables
When users use more than one table in a report, they must tell Crystal Reports how
to link the tables. Tables are usually linked in Crystal Reports in the same way that
they are linked in the underlying database. A field from one table is linked to a field in
another table that contains identical field values. For example, the sample data
contains an Employee table that has an Employee ID field. It also has an Employee
Addresses table that has an Employee ID field. Employee can be linked to
Employee Addresses using the Employee ID field. Links are represented by lines
drawn between the linked fields. Users can create links for the XTREME sample
data by clicking the Link button. Links can also be created by selecting a field in one
table, pressing and holding down the mouse button, and then selecting a field in
another table:
1. You should be on the Links tab with Customer, Orders, and Orders_Detail
displayed. Click the Clear Links button, and notice that the links are removed.
(If you are asked whether you are sure you want to remove the links, click Yes.)
2. Select By Name in the Auto-Link panel, and then click the Link button. Notice
that the links reappear.
3. Clear the links again, and then manually create a link from Customer.Customer
ID to Orders.Customer ID.
4. Remove all the links again, and then re-create them using the Auto-Link By
Name
option.
5. Click OK to close the Database Expert. The Design tab will display with a blank
report.
6. Save the report.
In this exercise, you will learn some techniques for working with different type of
formulas including the use of functions and operators.
1. Create a new report based on the Customer and Orders table of the Xtreme
Sample Database 10.
From the Database Expert Screen → Make New Connections → Xtreme Sample
Database 10 → Tables → Customer → Drag Customer table and Orders table
to the Selected Tables: area as shown below:
2. Click on OK button.
Note: if you think there are Zeros in your database, then you can
suppress the zeroes by selecting the Order Amounts in the
Details section → right click → Format Field → Customize
→ Numbers → Check in Suppress if zero
Value as shown below:
From the design screen in the details section, select Order ID → right click
10. Format the Order Date to show only the date portion (without time).
From the design screen in the Details section, select Order Date → right click
→ Format field as shown below:
11. Select the preferred date format that you like. For the purpose of this exercise
select 03/01/1999 as shown.
12. Group the data by Customer Name.
14. Click on the drop down arrow in the upper field and select Customer Name from
the list as shown below:
The following Group Name is inserted in Group Header#1 and shown in the design
view:
16. Create a formula and call it Total Order / Customer that calculates the Sum of
Order Amounts for each customer.
17. In the Formula Editor expand Functions → Expand Summary → double click on
Sum (fld) → double click on Order Amount from the Report Fields List → ,
(comma) → Customer Name Field. The formula will look like this:
22. From the View Menu, select the Field Explorer option, if it is not
displayed.
23. Right-click on Formula Fields and select the New… option as shown below:
24. In the Formula Name field, type Order Plus Tax and click on Use Editor.
Note: The Order Amount Field will drop in the Formula Editor
pane as shown below:
27. To add a 9 % per cent to the Order Amount, click on * Multiply sign followed
by the number you want. For this example it is 1.09
28. Click on the Save and close button to close the Formula
Workshop editor.
29. Drag the newly created formula Order Plus Tax from the Field Explorer to the
Details section of your report to the right of the Order Amount filed. Your report
should look like the following:
31. Define a formula and call it Total Order Plus Tax / Customer that calculates the
sum of Order Amount Plus Tax for each customer
32. From the Functions menu, expand Summary → double click Sum {fld}.
Then from the Report Fields in the Formula Editor, double click on the Order
Plus Tax Formula as shown below:
The total Order Amount for {Customer Name} is {@Total Order /Customer}
The Total Order Amount Plus Tax for {Customer Name} is {@Total Order Plus
Tax/ Customer}
1. Continuing with the report in Part A above, save the report as “Using Formulas
Part B – Begin.rpt”.
2. Right-click on Formula Fields and select the New… option. (See steps 18-21
above for reference)
5. Expand the Report Fields list and double click on Customer Name as shown
below:
{Customer.Customer Name}[1]
8. We will now use this formula to group the data first on this formula and then
on the complete Customer Name. Click on the Group Expert button.
Note: How the grouping is done first: by the first letter of the
customer name and then by the full customer name.
There are two groups created so far. One group for the
Customer Name then a group on the Formula (first
Letter of Customer name).
1. Continuing with the report in Part B above, save the report as “Using Formulas
Part C – Begin.rpt”.
a. From the Functions pane expand Functions → Date and Time → Month
name → Month as shown below:
c. With the insert still blinking in the (I), double click on Month [x] this returns
d. With the insert point still blinking in the (I) double click on Order date from the
Report Fields pane
e. This returns
6. Click on the Save and close button to close the Formula Workshop editor.
Note: The sign __ between the two fields of the formula means minus.
12. Click on the Save and Close button to close the Formula
Workshop editor.
13. Drag the newly created formula Process Time from the Field Explorer to the
Details section of your report to the right of the Order Month filed
1. Continuing with the report in Part C above, save the report as “Using Formulas
Part D – Begin.rpt”.
To create the formula, double click the Order Amount field from the Orders
Table from the Report fields List in the Formula Workshop. → Enter > 5000
6. Click on the Save and close button to close the Formula Workshop editor.
7. Drag the newly created formula Apply Discount from the Field Explorer to the
Details section of your report to the right of the Order Month filed.
8. Format the field to show “Yes” or “No” values. To do this select your Apply
Discount formula in the Details section, → Right click → Format Field
In this exercise, you will learn how to use the Highlighting Expert, Create Conditional
Formatting and Trigger Alert Monitoring to show certain trends or deviations in your
reports.
1. Create a new report based on the Customer and Orders tables of the Xtreme
Sample Database 10.
2. Add the following fields to the Details section of the report: Customer Name
from the Customer table and Order Amount from the Orders table. Delete the
column headings from the Page Header.
3. Group the data by Order Date (for each month) and format the group name to
show the full month name and year like February 2003.
Click on the Insert Group button → Select Order Date from the Order Table
List from the drop down menu from When the report is printed, the records
will be sorted and grouped by: as shown below:
6. Click on Text Object button and place it in the center of Report Header
section as a title. Format it to bold, 14 point font size and blue ,double line
boarder with shadow around it .
7. To draw a border around the title, select the tile → right click → Format text →
Border as shown below:
9. Click on OK button.
100 Saudi Aramco Training 10/14/2008 Crystal
Reports10
10. Make sure to double click inside the Text Object, highlight the title and click on
the Align Center button.
11. Preview.
12. To format the group name to show the full month name and year like February
2003, Click on the Group # 1 Name from the Group Header # 1 Section on the
design Screen → right click → Format field
13. Select a date Like February 2003. In this case select March 1999.
15. To highlight the sales amount differently based on the amount value, start by
right-clicking on the Order Amount field in your report and select the
Highlighting Expert button.
17. In the Value of field, leave the option to: this field.
18. In the second field (Operator/Condition), select: is less than or equal to.
26. In the Font style field, select Bold, Green font color.
Note: Please check how the Order Amount values are formatted (Highlighted)
differently based on the Order Amount value. Your report should look
like the following:
1. Continuing with the report you created in Part A above, click the Undo button or
go to Highlighting Expert and remove your entries. We will now use conditional
formatting to achieve the same highlighting effects.
3. To highlight the sales amount differently based on the amount value, start by
right-clicking on the Order Amount field in your report and select the Format
Field… option.
5. Click on the Conditional Formatting button next to the Color option as shown
below:
6. From the Operator pane in the Formula Workshop Editor expand Control
Structures and double click on If x then y else z as shown below:
Note: Users have to decide on the option they are searching for
whether it is a Field, a Function, an Operator etc.
Colors are Functions therefore the Functions radio
button is selected.
1. Make sure you delete any Conditional Formatting Formula you created in
section b of this exercise as shown below:
2. From the design screen, right click on the Order Amount → Format Field →
Font → Click on the
Conditional formula
button to the right of
Color:
3. Highlight the formula in the formula editor and click on Delete on the keyboard
as shown below:
5. To do so, In the gray area on the left, of the Group #1 Name in the Design
screen, right click and select
Delete Group as shown below:
6. From the Customer table, add the following fields in the Details section of the
report: City and Last Year’s Sales as shown below:
9. Click on OK button.
10. Click on the drop down arrow below Customer. Country then select is one of
operator as shown below:
14. To group data by Region, from the design screen click on Insert Group
button as shown below:
16. Ensure that the Highlighting Condition on Order amount that you created before
is deleted. To do so, select Order Amount from the Details section → right click
→ Highlight Expert as shown below:
From the design screen in the Details section, select Last Year’s Sales →
Report → Alerts → Create or Modify Alerts as shown below:
26. Click on the Save and close button to close the Formula
Workshop.
28. Click on the Report Refresh button. The below Alert window appears as there
are some records that satisfy the alert condition:
29. Click on the View Records to see the records causing the alert.
30. To highlight this Alert result in red font color, select Last years Sales from
Details section → right click and select Highlighting Expert
32. Enter the following parameters that are reflected on the dialog box below and
click OK.
Table: Customer
Fields: Country, Region, Customer Name, Last Years Sales
A report consists of several sections, including the Report Header, Page Header,
Group Header, Details, Group Footer, Page Footer, and Report Footer.
Each report section is made up of a series of lines. When a text-based object is
placed in a section, it is placed on a line in such a way that the text is aligned to the
baseline. The line's height is then adjusted by the printer driver so that it is high
enough to accommodate the object.
• If a report contains many objects, suppressing sections may require fewer
conditional formulas.
• Not all settings and features can be formatted conditionally. By suppressing
sections, however, you can make any formatting changes you want.
• You may want to provide completely different types of information for people
viewing the accessible version of the report. For example, you may want to
split visual and audio objects into two different sections and conditionally
suppress them based on the parameter value the user chooses.
This section is generally used for the report title and other information you
want to appear at the beginning of the report. It can also be used for charts
and cross-tabs that include data for the entire report.
• Page Header
This section is generally used for information that you want to appear at the
top of each page. This can include such things as chapter names, the name of
the document, and other similar information. This section can also be used to
display field titles above the fields on a report.
• Details
This section is used for the body of the report, and is printed once per record.
The bulk of the report data generally appears in this section.
• Report Footer
This section usually contains the page number and any other information you
want to appear on the bottom of each page.
If a group, summary, or subtotal is added to the report, the program creates two
additional sections:
• Group Header
This section typically holds the group name field, and can be used to display
charts or cross-tabs that include data specific to the group. It is printed once at
the beginning of a group.
• Group Footer
This section generally holds the summary value, if any, and can be used to
display charts or cross-tabs. It is printed once at the end of a group.
When a group, summary, or subtotal is added, the Group Header area appears
directly above the Details area and the Group Footer area appears directly below the
Details area.
If you set up additional groups, the program creates new group areas between the
Details area and the existing Group Header and Group Footer area(s).
Like the original areas, each of these newly added areas can contain one or more
sections. By default, they each contain a single section.
2. To sort Region and Customer Name, click on the Records Sort Expert
button. Select Region, Customer Name and add them to the Sort Fields in the
right using the > arrow, then Press OK as shown below:
6. Make sure each country prints on a separate page. To do so go to the gray area
on the Left of Group Header #1 Right ClickSection Expert
as shown below:
10. Shade the background of every other line in the Detail section
12. Uncheck the Print After from the Group Header #1 Section.
13. Format the Group Footer to print with a red color background if the country’s
total sales were under $600,000. To do so select Group Footer #1 in the Section
Expert Color Check in the Background Color Select Red as shown:
if Sum ({Customer.Last Year's Sales},{Customer.Country})<=600000 then crred else
blue
16. Remove the selection condition so that all countries are shown in the report by
going to Select Expert and pressing on Delete twice :
17. Remove all Background colors from the report. To do so reverse the activity or
suppress Group Footer #1 Section as shown:
Table: Customer
Fields: Include Region (delete it later) , City, Customer Name, Last Year’s Sales
1. Design a report showing: Region, City, Customer Name and Last Year’s
Sales.
4. Set a record selection to show the Regions FL, CA, OH, PA… to do so, select
Regions in the Details section → Select Expert → Is one of → FL, CA,
OH, PA (adding them one by one) and clicking on Enter on the keyboard each
time as shown:
6. Hide the Details section. To do so, select the details in the gray area on the
left of the design screen→ Right Click → Hide (Drill down OK) as shown:
7. Create a Pie Chart comparing Total Sales (Sum of Customer last Year’s
Sales) for each Region: to do so click on (Insert Chart ) as shown:
9. Give your chart the title “Sales by Region”: To do so, click on Text → Title
→ enter text → OK
or Highlight the chart by clicking on the white area around the chart → right
click → Chart Options → Title as shown:
11. Now change the record selection to show a different set of regions. For
example, you can include NJ. To do so click on the Select Expert → Add NJ
from the list → OK as shown:
The following screen is displayed with the newly added region reflected on the
chart.
22. Add a title to the report – North American Sales: Top 3 Regions by
Country
23. Preview.
24. Save.
25. Remove the Top N settings. To do so click on Group Sort Expert button.
29. In the drop down list select is Greater than or Equal to and enter 300000 in
the second field as shown:
Formula:
4. Select only records from BC region and only records with Order Amount > 0
5. Delete the previous selection
6. Format Order ID to eliminate the commas.
Table: Employee
Details Section: Text Object: First initial. Last Name. Then outside the text
Object add the following formulas :Years of Service, Age, Salary Increase by
certain %
1. In a Text Object in Details section, drag and drop the Formula named First
Initial followed by Last Name .
Text
Object
Note: Employee Name: (in the Text Object → combine the first
letter of the first Name and last name of each employee).
The formula is {Employee. First Name}[1]..as shown:
3. In the Text Object that you created already, drag and drop the formula that you
named @ First Initial → Space → Period → followed by <Employee Last
Name> field from database fields in the Field Explorer.
Enter the formula in the Formula Editor:
5. After saving and closing the formula Editor, drag the Years of Service in the
Details just outside the Text box you created before.
6. To format the years without decimals, select the results column from the preview
8. After saving and closing your formula, drag and drop it in the details just to the
right of Years of service.
9. Preview
10. Age Formula: (calculated in years). To Calculate Age, create formula and call it
Age as follows:
Note: The blue font that you see while creating the
formula represents a function or operator
syntax by the system.
11. Drag and drop Age formula in the Details section as shown:
14. Drag and drop the X-1 2007 Salary formula to the Details section to the right of
current 2006 Salary to help create a comparison.
The following screen is displayed:
15. let’s check and proof who received 5.5% and who received 2%. To do this we
have to create a formula and call it % which read as follows:
17. Let’s Insert a Grand Total for 2006 Salary : Insert>summary→ Sum → 2006
Salary and Grand total for 2007 Salary at the bottom of the report:
To do so just select current salary or just Salary as it is called in the database
Insert Summary → Sum → 2007 Salary Formula as shown:
Table: Customer
Fields: drag and drop the following fields in the details section of the design screen:
Region, City, Customer Name, Last Year’s Sales
Grouping data
Grouped data is data that is sorted and broken up into meaningful groups. In a
customer list, for example, a group might consist of all those customers living in the
same Zip Code, or in the same Region. In a sales report, a group might consist of all
the orders placed by the same customer, or all of the orders generated by a
particular sales representative.
• Specified order :
Original order is the order the data was originally saved in the
database. The program leaves the records in the order in which they
appear in their originating database table, and begins a new group
whenever the value changes in the group field you select.
7. In Group Name field, enter the first name: Western Sales Territory and select
is one of from the drop down list as shown:
either select the Regions CA, ID, NV and BC one by one from the drop down list
or type them and using enter after each entry as shown:
12. In the field below Put all Others together, with the name: Unassigned
Regions as shown above.
13. OK
14. Preview
15. Insert a Group subtotal for the Region group and a Group subtotal for each
Country group. To do so, select Last Year’s Sales in the Details section of the
design view → Insert Summary → the following dialog box is displayed:
18. Preview.
19. Save
20. To delete the specified grouping, right click on the gray area on the left of Group
# 2 Name → right click → and choose Delete Group as shown:
21. Click on OK . The section that you suppressed will not print with the report.
22. To suppress Group Header, right click on the gray area to the left of Page
Header → Section Expert → Check in Suppress on the right side as shown:
In this exercise, you will learn how to use Cross-Tabs Wizard as an efficient and
concise way to summarize large data.
1. From the File menu, select the New Cross-Tab Report as shown
2. Click on OK button.
7. On the Cross-Tab screen, drag the Customer Country fields from the Customer
table to the Rows area or select the table and click on .
8. Drag the Product Name field from the Product table to the Columns area.
9. Drag the Order Amount field from the Orders table to the Summary Fields
area.
Note: On the Grid Style screen, leave the default Original style.
17. Click on the Finish button. The Cross-Tab is displayed in the Report Header.
20. To Pivot the table; i.e. swap the rows and columns, right-click on your Cross-Tab
table and select the Pivot Cross-Tab option. Note
how the Countries are shown on the Columns and the Product Classes are
shown on the Rows:
21. Optional: To re-invoke the Cross-Tab Expert (Wizard), right-click on you Cross-
Tab table and select the Cross-Tab Expert… option.
22. Optional: To change the formatting of the Cross-Tab, right-click on you Cross-
Tab table and select the Format Cross-Tab… option.
Table: Employee
1. Design a report showing Last Name, First Name in a text box into the Details
section and remove the column headings: as shown
Note: In the Available Groups list, select the group you want to
organize hierarchically.
Note: In the Parent ID Field list, select the field by which you want the
Instance ID Field organized.
For instance, for a company hierarchical report, you might select
the data field listing the supervisor to whom the employee
reports.
Table: Orders
Underlay
The ability of an object (a bitmap, a graph, and so on) to print beneath multiple
sections which follow the section in which it was placed. For example, you can place
a bitmap in one section, format the section to underlay the following sections and
then expand the bitmap so it appears as a background for the entire page of your
report.
1. Prepare a washed out image via PowerPoint or any graphic tool. In PowerPoint
follow the menu path Insert → Picture → From File and place it in the page
header section as shown:
2. To format the picture to watermark, right click on the picture and select Format
Picture as shown:
Note: Users may get to the Section Expert from the design
screen by clicking on Section Expert button.
7. While the Page Header is selected, check in the Underlay Following Section
and click OK as shown:
8. Click on Preview tab to display the background then click on Design tab.
10. save
Table: Customer
Fields: In a text Object in Details A Section: Customer Name, Address1,
Address2, City, Region, Postal Code
1. Create a Text Object in the Details section with the following information as
shown below:
Customer Name: From the Fields Explorer, drag and drop
Customer Name to the top left hand corner of the text object
rectangle as shown:
Customer Name
Step 1 step 2
Address 1
Step 3 Step 4
Step 5 Step 6
City, Region
Step 9 Step 10
Step 11 Step 12
• Postal Code
3. Create a Text box Object in section Details (b) with the following Thank You
message: As shown below:
Dear <Contact First Name> :
We would like to thank <Customer Name>.
With total sales of $ <Last Year’s Sales> , <Customer Name> played a
significant part in making this last year a successful one.
Sincerely,
As shown:
6. Preview
7. Save
8. Make sure that you send the Thank You message to distributors with sales
greater than $25,000.
12. Repeat this from Section Expert to suppress values greater than 25000 $
13. Click on Section Expert button
14. Select Details C and to the right of Suppress click on the Formula
button. As shown:
Note: It would be a good idea to check in the Suppress
( No drill-Down).
19. Go to the Section Expert button and select the Details area.
20. Turn on the New Page After check box to print each customer message on a
separate page as shown:
23. Click OK
24. Preview
25. Note that some Address 2 fields are blank (have a Null value). Use a condition
so that the Address 2 field will not print if it is blank:
Highlight the Text Object in Details A Section → Right Click → Format Text as
shown:
Table: Product
Fields: Product ID, Product Name, Price(SRP)
Objectives
Variables overview
A variable represents a specific data item, or value, and acts as a placeholder for that
value. When a formula encounters a variable, the formula searches for the value of
the variable and uses it in the formula. Unlike a constant value, which is fixed and
unchanging, a variable can be repeatedly assigned different values. You assign a
value to a variable and the variable maintains the value until you later assign a new
value. Because of this flexibility, it is necessary for you to declare variables before
you use them so that Crystal Reports is aware of them and understands how you
intend to use them.
Example
If you wanted to report on customers by area code, you could create a variable that
extracts the area code from a customer fax number. The following is an example of a
variable called areaCode:
The first line of the variable example is the variable declaration; it gives the variable
a Scope (local) name (areaCode) and type ( StringVar). The database field
{Customer.Fax} is a String field and [1 To 3] extracts the first three characters from
its current value. The variable areaCode is then assigned this value. Note, the
declaration lines should end with a semicolon ;
Any
name of
your
choice.
Example:
Global Stringvar Plocation ;
• Shared
The variable can be shared with a subreport as well as the entire current
report.
• Local
The variable is specific and can only be used in the formula in which it is
defined
1. The first character of the Product ID determines the location of the product
as follows:
If Product ID starts with 1 location is Chicago
If Product ID starts with 2 location is New York
If Product ID starts with 3 location is Vancouver
If Product ID starts with 4 location is Riyadh
4. The formula should look like the following in the formula editor:
Table: Customer
Fields: Customer Name, Last Year’s Sales
9. To activate this parameter we have to define the value of this parameter in the
Select Expert .
10. Select Last Year’s Sales in the details on the design screen → Select Expert
button
17. Select the Prompt for new parameter values radio button.
18. Click on OK button.
222 Saudi Aramco Training 10/14/2008 Crystal
Reports10
The following dialog box is displayed:
20. Add a title to your report such as Customer Listing – sales Over Followed
by [?]SalesAbove parameter so that it reflects the change in the parameter
value as shown:
21. Preview
22. Save
23. Add a string parameter RegionValue that will allow you to determine which
region to display, in addition to the SalesAbove parameter as shown:
36. Preview
37. Refresh
38. Prompt
41. Try Dublin, Eastern Province, Lazio, and Warsaw > 50000
42. Save the report.
Export command
Use the Export command to export your report in one of several popular word
processing, database, and spreadsheet formats, in HTML or ODBC format, or in one
of a number of standard data interchange formats. For example, you can export your
report in Microsoft Excel format and then open it in Excel as a spreadsheet file.
You can export to a disk file, to an application, to a Lotus Notes database, to an
Exchange Folder, or to email.
• HTML 3.2
• HTML 4.0
230 Saudi Aramco Training 10/14/2008 Crystal
Reports10
• MS® Excel 97-2000
• MS® Word
• ODBC
• Report Definition
• Tab-separated text
• Text
• XML
.
Note: There a lot of possible destinations for your report. Select the
destination you want from this list.
You can export to:
• An application
• A disk file
• An Exchange folder
5. Click OK
6. Enter any additional information you are prompted for and save
• Folder management so all users can share reports across the enterprise
• Web administration to manage viewing, accessing and running reports
• Publishing of reports using the Report Publishing Wizard
• Scheduling of reports
a. After designing the report on the Crystal reports design go to File → Save as,
and → select Enterprise from the Save as dialog box as shown below:
b. Select your folder to save the report in.
e. To display the report from the Enterprise server, Click on the Internet explorer
button Start the Internet Explorer and access the website
http://crystald.aramco.com.sa
( Development environment).
g. Enter use Internet password and ensure the Authentication Type is LDAP
h. To display the report in different format: HTML or ActiveX, Advanced HTML or
Java click on Preferences tab.
k. The following screen is displayed with all the folders you are authorized to see.
m. Click on the report name to display: For the purpose of this Exercise I will click on
: My Second Web Report