Lesson 4: Grouping, Sorting and Filtering 101
Summary Functions
There are several functions that may be used to summarize data in various ways. Not all of the functions are
available for all data types. Below are some of the more common functions.
Functions Description
Operator Counts all of the values within a group
Count
Distinct Count Counts all of the unique values in a group
Maximum
Minimum Determines the largest value in a group
Mode
Determines the smallest value in a group
Nth largest
Determines the most frequently occurring value in a group
Nth smallest (most popular)
Nth most frequent Based on the designer’s definition of N, determines the Nth
largest value in the group
Sum
Average Based on the designer’s definition of N, determines the Nth
smallest value in the group
Median
Standard Deviation Based on the designer’s definition of N, determines the Nth
(population) most frequently occurring value in the group
Standard Deviation
(sample) Adds up all of the values in a group
Weighted average Takes the sum of all the numbers and divides by the number
with of items that were summed
Pth percentile Determines the value in the middle position of the group
Determines how far a population deviates from the average
Table 4-2 Summary Functions value of the population
Determines how far a sample (set) of the population deviates
from the average value of the sample (set)
Determines the average of a value based on the number of
times the value occurs in the group
Allows the designer to define a percent, then determines the
value for the defined percentile
Grand Totals
Grand totals are calculations that span the entirety of the report. All of the data from all of the visible groups
are included in the grand total. If you were to create a report that spans dozens of pages, it would be difficult
to total all of the numbers either in your head or by hand with a calculator. Luckily, we can create a grand
total for the report in seconds with the Insert Summary tool. This grand total will appear at the end of the
report in the report footer.
Copyright ©2017 Pathfinder Learning, LLP
102 Lesson 4: Grouping, Sorting and Filtering
Group Totals
Group totals behave the same way as grand totals but limit their scope of calculations to their respective
group. Because group totals are usually separated by great distances in the report, it can become difficult to
compare one group’s total with another. An interesting strategy is to hide the records in the Detail section,
thereby leaving nothing but the summary calculations.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 103
Exercise 4-6 Creating Summary Calculations
This exercise will demonstrate how to create summary calculations based on groups.
1. Browse to the location of the saved class files and open the My Completed Orders with Groups file
and then click Open.
2. Save the file as My Completed Orders with Groups and Summaries.
3. Switch to the Design tab if necessary.
4. Add the OrderAmount field to the Details section of the report.
a. If the field explorer is not present, click View then choose Field Explorer.
b. Expand the Database Fields folder by clicking the plus sign.
c. Expand the Orders table by clicking the plus sign.
d. Click on the OrderAmount field and drag to the details section of the report. Place it to the right of
the ShipAddress field.
5. Preview the report and navigate to the last page in the report by clicking the Show Last Page button
on the Navigation toolbar.
6. Click on any number in the OrderAmount column.
7. Click the Insert Summary button and then ensure that Orders.OrderAmount is selected in the top
dropdown list and click OK.
8. Expand the width of the newly created summary field to just over one inch (1”). Notice the newly
inserted summary calculation in the Report Footer section.
9. Click on the OrderAmount field in the Details section and click the Insert Summary button.
10. Ensure that Orders.OrderAmount is selected in the top dropdown list and select Group #1:
Orders.ShipCountry – A from the Summary Location dropdown list and click OK. Observe the
addition of the summary calculation in the Group Footer #1 section.
11. Now you see the newly created summary calculation for the last country in the report. If you browse
through the report you will see summary calculations at the end of each country’s sales.
12. Repeat steps 9 and 10 to create summaries for Regions (Group #2) and Cities (Group #3).
13. Click the Design tab.
Copyright ©2017 Pathfinder Learning, LLP
104 Lesson 4: Grouping, Sorting and Filtering
14. Verify your report is similar to the image below.
Figure 4-37 Exercise 4-6 Design Tab
15. Switch to the Preview tab.
16. Verify your report is similar to the image below.
Figure 4-38 Exercise 4-6 Results
17. Leave the file open for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 105
Exercise 4-7 Hiding the Details to Create a Summary-Only Report
This exercise provides experience with hiding sections in order to remove unnecessary data from a report,
creating a more concise and targeted report.
1. Continuing on with the My Completed Orders with Groups and Summaries file from the previous
exercise, switch to the Design tab.
2. Right-click on the Details section on the left and select Hide (Drill-Down OK).
Figure 4-39 Hide Option from Right-Click Menu
3. Observe the cross-hatch pattern that now overlays the Details section
Figure 4-40 Crosshatch for a Hidden Section
4. Add a textbox to the left of the summary calculation for the City field in Group Footer #3.
a. Click Insert then Text Box. When the cross hair displays, draw the box in the Group Footer section.
b. Type City Total: in the text box.
5. Add a textbox to the left of the summary calculation for the Region field in Group Footer #2.
a. Click Insert then Text Box. When the cross hair displays, draw the box in the Group Footer section.
b. Type Region (State) Total: in the text box.
Copyright ©2017 Pathfinder Learning, LLP
106 Lesson 4: Grouping, Sorting and Filtering
6. Add a textbox to the left of the summary calculation for the Country field in Group Footer #1.
a. Click Insert then Text Box. When the cross hair displays, draw the box in the Group Footer section.
b. Type Country Total: in the text box.
7. Using the formatting controls on the Standard toolbar, stylize the three newly created textboxes to be
bold and right-aligned.
8. Verify the Design tab is similar to the image below.
Figure 4-41 Exercise 4-7 Design Tab
9. Switch to Preview tab.
10. Verify your report is similar to the image below.
Figure 4-42 Exercise 4-7 Results
11. Save the file as My Completed Orders with Groups and Summaries
12. Close the file.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 107
Exercise 4-8 Creating Groups Based on Date and Time Intervals
This exercise will demonstrate how to filter records based on a date range as well as cluster the result records
by a defined interval period.
1. From the Start Page, under the START A NEW REPORT banner, click Blank Report.
2. From within the Database Expert, in the Available Data Sources section (left) expand the My
Connections folder. Expand the Northwind 2008.mdb entry.
3. Expand the category labeled Tables.
4. Select the table named Orders and add the table to the list of Selected Tables.
Figure 4-43 Selected Table in Database Expert
5. Click OK to close the Database Expert dialog box.
Copyright ©2017 Pathfinder Learning, LLP
108 Lesson 4: Grouping, Sorting and Filtering
6. Add the OrderID, ShippedDate, ShipAddress, ShipCity, and Freight to the Details section.
a. If the field explorer is not present, click View then choose Field Explorer.
b. Expand the Database Fields folder by clicking the plus sign.
c. Expand the Orders table by clicking the plus sign.
d. Click on each field and drag to the details section of the report.
7. Add a textbox to the Report Header section entitled Orders Shipped - 2006 and format the title with
the font and size of your choosing.
8. Preview the report.
9. Verify your report is similar to the image below.
Figure 4-44 Exercise 4-8 Report Preview
10. Filter the list to only show shipped orders occurring in the year 2006.
a. Click on any shipped date and click the Select Expert button.
b. From the Orders.ShippedDate dropdown, select is between and define the top parameter as
1/1/2006 and the bottom parameter as 12/31/2006 then click OK.
Figure 4-45 Filter Records for 2007 button.
11. Click the
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 109
12. Group the orders by month, January through December
a. Click the Group Expert button.
b. In the Group Expert dialog box, add the Orders.ShippedDate field to the Group By: list on the
right.
c. Click the button and on the Common tab click the dropdown list for The section
will be printed: and select for each month and click OK two times.
13. Switch to the Preview tab if necessary.
14. Verify your report is similar to the image below.
Figure 4-46 Exercise 4-8 Results
15. Save the report as My 2006 Shipped Orders.
16. Leave the file open for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
110 Lesson 4: Grouping, Sorting and Filtering
Exercise 4-9 Cleaning Up the Report
This exercise will provide you with further experience with transforming data into more understandable
formats.
1. With the My 2006 Shipped Orders file from the previous exercise, switch to the Preview tab.
2. Right-click on any number in the OrderID column and select Format Field…
3. In the Format Editor dialog box, on the Number tab, select the style -1123 and click OK.
4. Right-click on any date/time in the ShippedDate column and select Format Field…
5. In the Format Editor dialog box, on the Date and Time tab, select the style 03/01/1999 and click OK.
6. Right-click on any date/time group header and select Format Field…
7. In the Format Editor dialog box, on the Date and Time tab, select the style March 1999 and click OK.
8. Return to the Design tab and increase the height of the Group Header #1 section.
9. Move the five column headings from the Page Header section to the Group Header #1 section below
the Group #1: ShippedDate object.
10. Verify the Design tab is similar to the image below.
Figure 4-47 Exercise 4-9 Design Tab
11. Preview the report.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 111
12. Verify your report is similar to the image below.
Figure 4-48 Exercise 4-9 Results
13. Save the My 2006 Shipped Orders report.
14. Leave the file open for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
112 Lesson 4: Grouping, Sorting and Filtering
Calculating Percentages in Summaries
If you have the desire to calculate a group’s total as a percentage of the whole, the Insert Summary feature will allow
you to create just such a calculation with relative ease.
For example; suppose the report needs to show the percentage of sales for a product relative to all of the products
sold, or the percentage of a state’s population relative to the entire national population. Examples like these are
prime uses for using percentages in summaries.
When inserting summary calculation in groups, there exists an option in the Insert Summary dialog box called Show
as a percentage of. If selected, a dropdown becomes available to define the group total or grand total to calculate the
percentage against.
Figure 4-49 Insert Summary as Percentage Checkbox
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 113
Exercise 4-10 Calculating Percentages in Summaries
This exercise will demonstrate how to add summary calculations that are designed to show percentages of a
group’s activity relative to the whole report.
1. With the My 2006 Shipped Orders file from the previous exercise, switch to the Design tab.
2. Click on the Freight field in the Details section.
3. Click the Insert Summary button and then ensure Orders.Freight is the selected field in the top
dropdown list.
4. Ensure Sum is the selected method of calculation.
5. In the Summary Location dropdown, select Group #1: Orders.ShippedDate – A
6. Under the Options section, check the box labeled Show as a percentage of and ensure Grand Total:
Sum of Freight is selected from the dropdown.
Figure 4-50 Insert Summary Settings
7. Click OK.
8. Preview the report.
Copyright ©2017 Pathfinder Learning, LLP
114 Lesson 4: Grouping, Sorting and Filtering
9. Verify your report is similar to the image below.
Figure 4-51 Exercise 4-10 Results
10. Save the file as My 2006 Shipped Orders with Percentages.
11. Close the file.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 115
Sorting Groups According to Subtotal Rankings
Once subtotals have been established, it is often a requirement to sort the groups according to the subtotals. The tool
for performing this type of sort is called the Group Sort Expert .
Where the Record Sort Expert is responsible for sorting records within a group, the Group Sort Expert sorts the
groups as a whole against one another. This can be a powerful means of determining high performers or low
performers within a group strategy.
Because the Group Sort Expert requires the presence of groups and summary calculations, if either of these
components are not present in the report, the Group Sort Expert button will not function; the tool will be grayed-out.
The Group Sort Expert allows sorting based on six criteria. The criteria are as follows:
No Sort – All groups are sorted based on the name of the group; not by any summary calculation. This is
the default group sort behavior of the Group Sort Expert.
All – This option sorts all of the groups based on the summary values contained in the groups. The groups
may be sorted in either ascending or descending order.
Top N / Bottom N – This option allows the designer to define a limit as to the number of groups that should
be displayed (ex: Top 3, Bottom 5, etc…) and sorts the list based on the Top or Bottom selection. All groups
that do not fall within the defined Top/Bottom value will be grouped together under a single group named
Others. The designer can choose to include this aggregated group in the report or leave it out of the report.
The designer may also rename the group from Others to any name the designer desires.
Top Percentage / Bottom Percentage – This option works in the same manner as Top N / Bottom N; the
only difference is that instead of defining an integer as the inclusion cutoff, a percentage is defined. All
other behaviors work the same as Top N / Bottom N.
The Group Sort Expert dialog box will present different options depending on which of the criteria is chosen.
Figure 4-52 Group Sort Expert Dialog Box
Copyright ©2017 Pathfinder Learning, LLP
116 Lesson 4: Grouping, Sorting and Filtering
Exercise 4-11 Using the Group Sort Expert to Sort Groups
In this exercise, you will create a report that summarizes groups by percentages as well as creating restrictive
results via the Top N function.
1. From the Start Page, under the START A NEW REPORT banner, click Blank Report.
2. From within the Database Expert, in the Available Data Sources section (left) expand the My
Connections folder. Expand the Northwind 2008.mdb entry.
3. Expand the category labeled Tables.
4. Select the table named Orders and add the table to the list of Selected Tables then click OK.
5. Add the OrderID and OrderAmount fields to the Details section
6. Click the Group Expert button and group by Orders.OrderDate in ascending order.
7. Click the button and select for each month from the dropdown labeled the section
will be printed.
8. Click OK twice.
9. Preview the report.
10. Click any number in the OrderAmount column and select the Insert Summary button.
11. From the Summary location dropdown list, select Group #1: Orders.OrderDate – A.
12. In the Options section, check the box labeled Show as a percentage of and click OK.
13. Return to the Design tab and right-click on the Details section heading (far left of the screen) and select
Hide (Drill-Down OK).
14. Preview the report to see only the month labels and the month percentages.
15. Click on any percentage calculation in the OrderAmount column and select the Group Sort Expert
button.
16. From the For this group sort dropdown list, select Top N.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 117
17. Check the box labeled Include Others, with the name: and type All Other Months in the field below
the checkbox.
Figure 4-53 Group Sort Expert Settings
18. Click OK.
19. Verify your report is similar to the image below.
Figure 4-54 Exercise 4-11 Results
20. Save the file as My Top 5 Months Sales.
21. Close the file.
Copyright ©2017 Pathfinder Learning, LLP
118 Lesson 4: Grouping, Sorting and Filtering
Challenge Exercise – Grouping and Sorting
This challenge exercise will use the report that you created in the challenge exercise from lesson 3 and add
groups and sorting.
1. Open the lesson 3 challenge exercise, My Orders Shipping.
2. Save the report as My Orders Grouped.
3. If needed, change to Design view.
4. Change the report title to Order Shipping Details.
5. Remove ShipName from the Detail Section.
6. Move ShipCity.
7. Create a group for ShipName.
a. On the Experts toolbar, click the Group Expert button.
b. From the Available Fields, choose ShipName. Click OK.
c. Make Group1 header area twice as tall.
d. Move the column headers from Page Header under Group #1 Name.
8. Sort the group to display descending:
a. Right click on the Group Header #1 section (the area to the left of the report) and choose Change
Group.
b. On the Common tab, change the sorting dropdown to in descending order. Click OK.
9. Add a second group on ShipCountry.
10. Preview the report.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 119
11. The groups need to be reversed – the order should be by Country then by Shipping Name. In Design
view, click on Group Header #1 (blue area to the left of the report) and drag down to Details. Release
the mouse and note the group name changes.
Figure 4-55 Group Header #2
12. Preview the report, it should resemble the image below.
Figure 4-56 Challenge Exercise Grouping and Sorting Results
13. Save the report.
Copyright ©2017 Pathfinder Learning, LLP
120 Lesson 4: Grouping, Sorting and Filtering
,
Challenge Exercise - Filtering
This challenge exercise will use the report that you created in the previous challenge exercise and add
filtering on the shipping country and order date.
1. If needed, open My Orders Grouped.
2. Save the report as My Orders Grouped and Filtered.
3. Filter to only include shipping addresses in Brazil, Canada, USA and Mexico.
a. Click on a blank area of the report.
b. Click the Select Expert . In the Choose Field dialog box, click Orders.ShipCountry and
click OK.
c. Click the dropdown with is any value and choose is one of. Click the dropdown and select Brazil.
Repeat and select Canada, Mexico and USA.
Figure 4-57 Record Select Expert
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 121
d. After selecting all 4 countries, you should see
Figure 4-58 Select Expert
e. Remove Brazil so that only Canada, Mexico and USA are listed. Select Brazil and click Remove.
Click OK.
4. Preview the report. You may be asked if you want to use the existing data or refresh the data. Since this
report uses only part of the existing data and nothing new, you may safely use the existing data, rather
than refreshing.
5. Save the report.
6. Add another filter to include only orders in 2007 or 2008.
a. Click on a blank area of the report.
b. Click the Select Expert .
c. Click New (either the button or the tab) and select Orders.OrderDate. Click OK.
d. Change is any value to is between. In the first blank type 1/1/2007. In the second blank type
12/31/2008. Click OK.
7. Sort by the order date in ascending order.
a. Click the Record Sort Expert .
Copyright ©2017 Pathfinder Learning, LLP
122 Lesson 4: Grouping, Sorting and Filtering
b. Double-click Orders.OrderDate. It will be added to the Sort Fields box. Click OK.
Figure 4-59 Record Sort Expert
8. Add any formatting you wish.
9. Preview the report, it should resemble the image below. When asked if you want to use existing data or
refresh the data, you can use the existing data – there is no new data included in the report so there is no
need to query the database again.
Figure 4-60 Challenge Exercise Filtering Results
10. Save the report.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 123
Challenge Exercise - Add a Group and Summary Fields
This challenge exercise will use the report that you created in the previous challenge exercise and add a
group and summary fields.
1. If needed, open My Orders Grouped and Filtered.
2. Save the report as My Orders Grouped and Summarized.
3. Change the orientation to landscape.
a. File > Page Setup
b. Select Landscape.
c. Click OK.
4. Add a group on OrderDate by month. Make it the first (outer) group.
a. Click the Group Expert
b. Double-click on Orders.OrderDate; that adds it to the Group By box.
c. In the Group By section, click Orders.OrderDate – A and click the up arrow above the Group By
box to move it to the top.
Figure 4-61 Group Expert
d. Click Options.
Copyright ©2017 Pathfinder Learning, LLP
124 Lesson 4: Grouping, Sorting and Filtering
e. Under The section will be printed, choose for each month.
Figure 4-62 Change Group Options
f. Click OK.
g. Click OK.
5. Format the monthly group date to display the full month name and year.
a. Right click on the Group #1 Name field in the report and select Format Field.
b. Scroll down to select March 1999.
c. Click OK.
6. Make room for labels. Move the column headings, not the group names, to the right to make room for
text object labels for the summary amounts. CustomerID should be at about 4”.
a. Select CustomerID, OrderAmount, OrderDate, ShippedDate and ShipCity: either click and drag or
hold the shift key while clicking each field and header to be moved.
b. Once all fields are selected, use the mouse or right arrow key to move them all to the right.
CustomerID should be at approximately 4”. If needed, move ShipCity closer to ShippedDate.
7. Summarize the OrderAmount for all groups and add a grand total.
a. Click on OrderAmount in the Detail section.
b. Click on Insert Summary .
c. Click the check box by Add to all group levels.
d. Click OK.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 125
8. Starting at the left margin, add labels to each group footer. Group Footer #3 - Amount of Orders for
Customer, Group Footer #2 - Amount of Orders for Country and Group Footer #1 - Amount of
Orders for Month.
9. Update the report title to read Shipping for North America Customers.
10. Format the title to add a single line border on all 4 sides and a drop shadow.
a. Right click on the text object and select Format Text…
b. Click the Border tab.
c. Choose Single for the Left, Right, Top and Bottom Line style.
d. Check the Drop Shadow option.
e. Click OK.
11. Expand the Group Footer #1 for OrderDate, Group Footer #2 ShipCountry and the Report Footer
so they are tall enough for three lines of summary fields. To accomplish this, click on the section bottom
and drag down. Expand the Group Footer #3 ShipName so it is tall enough for two lines.
12. Add summaries to count the number of orders and number of customers placing orders.
a. In the Detail section, click on the CustomerID and click Insert Summary .
b. Choose Count from the Calculate this summary dropdown.
c. Check Add to all group levels.
d. Click OK.
Figure 4-63 Insert Summary
13. Move all of the remaining CustomerID summary fields down one row in each footer. An easy way to do
this is to click on a field and press the down arrow key twice.
Copyright ©2017 Pathfinder Learning, LLP
126 Lesson 4: Grouping, Sorting and Filtering
14. Add the following labels to the appropriate group footer: Group Footer #1 - Number of Orders for
Customer, Group Footer #2 - Number of Orders for Country and Group Footer #3 - Number of
Orders for Month.
15. For Group Footer #2 and #1, move the labels and CustomerID summary fields down to the bottom of
their summary group so there is room for another summary field and label above them.
16. Insert a summary to count the number of customers that placed orders for each country and month and
for the grand total, but not for Orders.ShipName since that count will always be one. There are two ways
to create summaries for all but one group. We can either insert three separate summaries (for Group
Footer 2, Group Footer 1 and Report Footer) in three steps or insert all summaries in one step and then
delete the summary we don’t need. For this exercise, we will add all in a single step and then delete the
summary for the ShipName footer. To find the number of customers who place an order, use Distinct
Count. It ignores duplicates.
a. In the Detail section, click on the CustomerID and click Insert Summary .
b. Choose Distinct count from the Calculate this summary dropdown.
c. Check Add to all group levels.
d. Click OK.
Figure 4-64 Insert Summary
e. Delete the summary for the Orders.ShipName group.
f. Move each of these summaries down to the second row in each footer
17. Add the following labels to the appropriate group footer: Group Footer #2 - Number of Customers
placing orders for Country and Group Footer #1 - Number of Customers placing orders for Month.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 4: Grouping, Sorting and Filtering 127
18. Format all of the Count and Distinct Count to include a comma and no decimals.
a. Do this in one step by selecting all of the Count and Distinct Count fields (shift-click on each field),
then right click and select Format Objects…
b. On the Number tab select -1,123.
c. Click OK.
19. Add labels to the report footer fields: Grand Total Amount of Orders Placed, Grand Total Number
of Customers placing orders and Grand Total Number of orders.
20. Save and preview the report. Add any additional formatting that you wish.
Figure 4-65 Challenge Exercise Group and Summary Fields Results – First Page
Copyright ©2017 Pathfinder Learning, LLP
128 Lesson 4: Grouping, Sorting and Filtering
Figure 4-66 Challenge Exercise Group and Summary Fields Results – Last Page
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 129
Lesson 5: Additional Formatting Objects
Unit time: 75 minutes
In this lesson, you will be introduced to:
1 Adding Lines
2 Adding Boxes
3 Inserting Graphics
4 Formatting Page Options
5 Combining Fields with Text Objects
6 Inserting Special Fields
Copyright ©2017 Pathfinder Learning, LLP
130 Lesson 5: Additional Formatting Objects
Reports with columns of transactional data are no doubt useful, but in order to get someone to want to read a report,
the report must be pleasing to the eye. Adding small artistic touches to a report help lead the reader’s eye to key data
points as well as lend a hand in the readability of the report.
The inclusion of logos in the report header, brand the report to a particular organization or department. Strategically
placed lines help divide the report into sections while boxes help separate or draw attention to critical data points.
Beyond the data being reported on, additional fields assist in the organization and layout of the report. Page
numbers, date and time stamps, and filename information all put the finishing touches on a well-designed report.
Figure 5-1 Sample Report Heading
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 131
Adding Lines
Adding lines to a report help separate it into sections. These sections assist the report reader with breaking the report
into smaller, more easily managed sections. Lines can be added in both the vertical and horizontal plane. Line style,
thickness, and color can also be customized to bring a signature look and feel to the report.
Depending on the placement of the line in a report, the line can be displayed once or repeat after each record. This is
especially useful when reading reports in a landscape orientation where it becomes difficult for the eye to track
records across a wide page.
Figure 5-2 Line Added Beneath Column Headers
To add a line to a section it is as simple as click and drag. From the Insert toolbar, click the Insert Line button.
This will temporarily change the standard arrow pointer to a pencil pointer . Click and hold the left mouse
button where you want the line to begin and drag to where you want the line to end. Don’t be too concerned as to the
exact location and size of the line since it is so easily resized or relocated.
Accessing the Formatting Options for a Line
Formatting options for a line can be accessed by either of the following methods:
Click the Format dropdown menu and select Figure 5-3 Format Line from Format Dropdown Menu
Format Line…
Right-click on the line and select Format
Line…
Figure 5-4 Format Line from Right-Click Context Menu
Copyright ©2017 Pathfinder Learning, LLP
132 Lesson 5: Additional Formatting Objects
The Format Editor displays all of the ways in which a line may be formatted. In addition to traditional
cosmetic options such as line style (single, dashed, or dotted), line thickness, and line color, behavioral
controls add some low-level intelligence to the line. These include:
Move to Bottom of Section when Printing – Displays the line at the bottom of the section
regardless of where the last line of data is positioned within the section.
Suppress – Ideal for displaying lines when working in the Design view but hidden when in
Preview mode or printing.
Repeat on Horizontal Pages – Draws the line across pages that print in a horizontal fashion.
This is especially useful when working with crosstab reports which have a tendency to cross
many pages left to right.
Read-only – Line cannot be formatted with this option. This is a way to protect the formatting
of the line. When this option is checked, all other options on the format editor are inactive.
Lock Position and Size – Line cannot be re-sized or moved on the report.
Figure 5-5 Format Editor Dialog Box - Line
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 133
Adding Vertical Lines to a Report
Lines can also be used to separate columns of information. Depending on the placement of the line, the
displayed result will vary. Two strategies for drawing vertical lines are:
Draw the line within the boundaries of the Details section. This will produce a small vertical line
between each field on a record by record basis.
Figure 5-6 Draw Line in Single Section
Figure 5-7 Draw Line Result
Draw the line in a way that crosses sections. Typically, this would be done by starting the line in the
Page Header section and having the line cross into the Details section. This will produce a single line
that travels down the length of the page in tandem with the number of displayed records.
Figure 5-8 Draw Line Across Multiple Sections
Figure 5-9 Draw Line Result
Copyright ©2017 Pathfinder Learning, LLP
134 Lesson 5: Additional Formatting Objects
Exercise 5-1 Adding Lines to a Report
This exercise will provide you with experience adding lines to a report.
1. Browse to the location of the saved class files and open the folder named Exercise Files\Lesson 05.
2. Select the E5-1 Order Totals file and then click Open.
3. Switch to the Design tab.
4. Increase the height of the Page Header section by approximately 20%.
5. Select all of the header fields in the Page Header section. Click the first field, hold down CTRL and
click each additional field.
Figure 5-10 Heading Selection in Page Section button to remove the underlines from the header
6. On the Formatting toolbar, click the Underline
fields.
7. On the Insert toolbar, click the Insert Line button and then draw a line beneath all of the field
headers in the Page Header section.
Figure 5-11 Line Draw Example
8. Click Preview.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 135
9. Verify your report is similar to the image below.
Figure 5-12 Exercise 5-1 Results
10. Save the file as My Order Totals.
11. Leave the file open for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
136 Lesson 5: Additional Formatting Objects
Adding Boxes
Boxes help visually group areas of a report to either draw attention to data or separate sections of data from one
another. Boxes can be customized with borders and fill colors.
As with lines, depending on the placement and size of the box, the box may be contained in a single section of the
report or automatically resized to encompass many pages of data.
Figure 5-13 Box Drawing Example
Just like a line, adding a box to a section is as simple as click and drag. From the Insert toolbar, click the Insert Box
button. This will temporarily change the standard arrow pointer to a pencil pointer . Click and hold the
left mouse button in what would be one corner of the box and drag diagonally to establish the general size and
placement of the box. Don’t be too concerned as to the exact location and size of the box since it is so easily resized
or relocated.
Accessing the Formatting Options for a Box
Formatting options for a box can be accessed by either of the following methods:
Click on the box to select, then click the Figure 5-14 Format Box from Format Dropdown Menu
Format dropdown menu and select Format
Box…
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 137
Right-click on a box and select Format
Box…
Figure 5-15 Format Box from Right-Click Context Menu
The Format Editor displays all of the ways in which a box may be formatted. In addition to traditional
cosmetic options such as border style (single, dashed, or dotted), border thickness, and border color,
behavioral controls add some low-level intelligence to the box. These include:
Drop Shadow – Places a shadow on your box. This will appear below and to the right of the box.
Fill – Checking this box will cause a drop down with a list of colors to display.
Always Close Border – This ensures that the first or last box in the section does not end up with an
open top or open bottom of the box when data crosses multiple pages.
Extend to Bottom of Section when Printing – Draws the box to the bottom of the section. This
creates the appearance of a lined table because every record’s box connects to the next record’s box.
Suppress – Ideal for displaying the box when working in the Design view but hidden when in
Preview mode or printing.
Repeat on Horizontal Pages – Draw the box across pages that print in a horizontal fashion. This is
especially useful when working with crosstab reports which have a tendency to cross many pages
left to right.
Read-only – Box cannot be formatted with this option. This is a way to protect the formatting of the
box. When this option is checked, all other options on the format editor are inactive.
Lock Position and Size – Box cannot be re-sized or moved on the report.
Figure 5-16 Format Editor Dialog Box - Box
Copyright ©2017 Pathfinder Learning, LLP
138 Lesson 5: Additional Formatting Objects
Depending on the placement of the box, the displayed result will vary. Two strategies for drawing boxes are:
Draw the box within the boundaries of the Details section. This will produce a small box that
surrounds each field on a record by record basis.
Figure 5-17 Draw Box in Single Section
Figure 5-18 Draw Box Result
Draw the box in a way that crosses sections. Typically, this would be done by starting the line in the
Page Header section and having the box cross into the Details section. This will produce a single
box that travels down the length of the page in tandem with the number of displayed records.
Figure 5-19 Draw Box Across Multiple Sections
Figure 5-20 Draw Box Result
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 139
By adding a fill color, the box can be used to draw attention to specific column details.
Figure 5-21 Fill Color for Box
Figure 5-22 Sample of Box with Fill Color Applied
Copyright ©2017 Pathfinder Learning, LLP
140 Lesson 5: Additional Formatting Objects
Exercise 5-2 Adding Boxes to a Report
This exercise will demonstrate how to add boxes to reports, show the different behaviors of a box depending
on its location in the report, as well as performing basic visual customizations.
1. Continuing with the My Order Totals file from the previous exercise, switch to the Design tab.
2. Click the Insert Box button and drag a box around the entire [@Total] field in the Details section.
3. Switch to the Preview tab to see the results of adding the box object to the form.
4. Return to the Design tab.
5. Select the box surrounding the [@Total] field.
6. Grab the resize handle located on the top-center of the box. Extend the height of the box to encompass
the Total field in the Page Header section.
7. Switch to the Preview tab to view the new layout of the box object.
8. Right-click on the box object and select Format Box…
9. In the Fill section of the Format Editor dialog box, place a checkmark in the Color: option and then
select a color of your choosing and click OK. NOTE: If you select a darker color that renders the
numbers difficult to read, click on a number in the Total column of the report and change the font color
to white.
10. Return to the Design tab and increase the height of the Report Header section by approximately 20%.
11. Click the Insert Box button and draw a box around the Order Details report title.
12. With the newly inserted box selected, click Format from the dropdown menu and select Format Box…
13. On the Box tab, click the Drop Shadow option.
14. Click the Color option in the Fill section and then select a color of your choice. Click OK.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 141
15. Return to the Preview tab.
16. Verify your report is similar to the image below.
Figure 5-23 Exercise 5-2 Results
17. Save the My Order Totals file.
18. Close the file.
Copyright ©2017 Pathfinder Learning, LLP
142 Lesson 5: Additional Formatting Objects
Inserting Graphics
Adding graphics to a report is a great way to establish corporate branding within a report. Graphics and images, used
appropriately, can bring life to a report and focus your reader's attention on key points and data. This does not mean
scattering pleasant pictures across the report in an attempt to make it look more attractive - any image or graphic you
include should add something to the points you are making. Generally, images such as pictures and photographs
would not be included in formal business reports - although graphs may be appropriate.
To insert a graphic into a report, click the Insert dropdown menu and select Picture, or from the Insert toolbar click
the Insert Picture button.
Once a graphic has been added to the report, resizing and correct placement of the graphic are typically required.
Resizing a graphic can be performed in a variety of ways. One way is to grab one of the blue resize handles located
around the perimeter of the selected graphic.
Figure 5-24 Image Resize Handles
Keep in mind that resizing in this manner is completely free form. The image can be easily distorted if the height
and width are not sized proportionately. To maintain the original proportions of an image when resizing, press and
hold the Shift key on the keyboard while resizing the graphic. This will resize the height and width simultaneously,
which prevents image distortion.
Another method for resizing graphics is to access the formatting controls of the graphic. Formatting options for a
graphic can be accessed by either of the following methods:
Click the Format Figure 5-25 Format Graphic from Format Dropdown Menu
dropdown menu and select
Format Graphic…
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 143
Right-click on a graphic
and select Format
Graphic…
Figure 5-26 Format Graphic from Right-Click Context Menu
All of the controls for Cropping, Scaling, and Resizing are located on the Picture tab of the Format Editor dialog box.
Scaling a graphic would simply be a matter of placing the same percentage number in both the Width and Height
fields of the Scaling section.
Figure 5-27 Format Editor - Image Scaling Controls
Copyright ©2017 Pathfinder Learning, LLP
144 Lesson 5: Additional Formatting Objects
Exercise 5-3 Adding Graphics to a Report
This exercise will allow you the opportunity to add a graphic to your report as well as scale and position the
graphic.
1. From the Start Page, under the START A NEW REPORT banner, click Blank report.
2. From within the Database Expert, in the Available Data Sources section (left) expand the My
Connections folder. Expand the Northwind 2008.mdb entry.
3. Expand the category labeled Tables.
4. Select the table named Employees and add the table to the list of Selected Tables.
5. Click OK to close the Database Expert dialog box.
6. Add the following fields to the Details section of the report; place the fields left to right:
Employee ID
First Name
Last Name
Title
Salary
Figure 5-28 Details Section Example
7. Add a Text object to the Report Header section and type Employee Salaries in the text box.
a. Change the font style to Verdana.
b. Change the font size to 18 points.
8. Click the Insert Picture button and browse to the location of the saved class files and open the
folder named Images.
9. Select the Northwind2008Logo.jpg file and click Open.
10. With the orange bounding box visible, click somewhere in the upper right corner of the Report Header
section. This will automatically expand the section’s size to accommodate the logo dimensions.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 145
11. Resize the logo to approximately 50% of its original size by selecting the logo and then clicking the
Format dropdown menu and select Format Graphic…
12. Select the Picture tab and enter 50% in both the Width and Height fields in the Scaling section. Notice
it will change the values you entered from 50 to what is shown below.
Figure 5-29 Scaling Controls
13. Click OK.
14. Resize the height of the Report Header section to be large enough to accommodate the report title and
logo.
15. Preview the report.
16. Verify your report is similar to the image below.
Figure 5-30 Exercise 5-3 Results
17. Save the file as My Employee Salaries.
18. Leave the file open for the next exercise.
Copyright ©2017 Pathfinder Learning, LLP
146 Lesson 5: Additional Formatting Objects
Formatting Page Options
It is common for reports to contain more columns than can be displayed in a standard portrait oriented report. The
ability to rotate the report into a landscaped format, along with the ability to define the paper’s size and margins, help
ensure that the paper is utilized in the most efficient manner as prescribed by the report designer.
To access the page options in Crystal Reports, click the File dropdown menu and select Page Setup…
Figure 5-31 Page Setup Dialog Box
The Page Setup dialog box is comprised of three main sections:
Printer Options
This section provides a dropdown from which a destination printer may be selected for printed output. This
section also contains an option for ignoring the limitations of paper (size, margins, orientation, etc…) and
render the report for screen output.
Page Options
This section is where the orientation and physical size of the paper are defined. Crystal Reports is equipped
with a variety of the more common paper sizes along with the ability to define a custom paper size. The
paper’s size may also be defined in a variety of dimensional units (pixels, inches, or centimeters.)
Margins
The margin controls allow for the reservation of unused space around the four sides of the printed report.
These four sides may be controlled independently or adjusted automatically based on the needs of the report
in relation to the size and orientation of the report.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 147
Exercise 5-4 Setting Paper Size and Margins for a Report
This lesson will provide experience with changing the paper size as well as the report orientation.
1. With the My Employee Salaries file from the previous exercise, click the File dropdown menu and
select Page Setup…
2. In the Page Options section, click the dropdown menu to examine the available paper size options.
Select Letter (8 ½ × 11 in).
3. Ensure Inches is selected from the Unit section.
4. Verify Portrait is selected from the Orientation section.
5. Set the margins to the following dimensions
Left = .5
Right = .5
Top = 1
Bottom = 1
Figure 5-32 Page Setup Dialog Box
6. Click OK to submit the changes.
7. Notice the report shifts on the page.
8. Save the My Employee Salaries file.
9. Close the file.
Copyright ©2017 Pathfinder Learning, LLP
148 Lesson 5: Additional Formatting Objects
Combining Fields with Text Objects
Adding text to a report is a fine way of imparting information provided that information does not require extensive
modification from record to record. If reports require text content to change from record to record, utilizing an
embedded field within a text object provides the ability to generate dynamic form content.
Any text typed into the text object is considered static text and will remain constant from record to record. The
information contained in the database field will change from record to record.
Virtually any field in a database can be embedded in a text object to create form letters.
In order to add an embedded field to a text object, the text object must be created first. Once the text has been
inserted into the text object, the fields may then be inserted to augment the static text.
One of the key advantages to using embedded fields inside of text objects is that Crystal Reports will automatically
resize the text object based on the size of the combined static text and field data. This ensures that the amount of
space necessary for the record is not overestimated.
When adding fields into text objects, an insertion bar will appear (similar to a text edit bar) indicating the location
where the field will be inserted. When a field is inserted into a text object, the field’s name is always enclosed in
{braces}.
Copyright ©2017 Pathfinder Learning, LLP
Lesson 5: Additional Formatting Objects 149
Exercise 5-5 Embedding Fields Inside of Text Objects
In this exercise, you will create a report that will contain text fields with embedded database fields.
1. From the Start Page, under the START A NEW REPORT banner, click Blank report.
2. From within the Database Expert, in the Available Data Sources section (left) expand the My
Connections folder. Expand the Northwind 2008.mdb entry.
3. Expand the category labeled Tables.
4. Select the table named Employees and add the table to the list of Selected Tables.
5. Click OK to close the Database Expert dialog box.
6. Click the Insert Text Object button on the Insert toolbar.
a. Add a box in the left portion of the Report Header section.
b. Add the text Employee Summary to the text box object.
c. Format the font with any font style, size, or color you wish.
7. Add a text box in the left portion of the Details section.
8. Type Employee Name: Include a space after the colon so the field to be added does not rest directly
against the text.
9. In the Field Explorer (right side of the screen), click and hold on the FirstName field and drag the field
into the text box, until a flashing vertical line appears after the space to the right of the colon.
10. Add a space after the {FirstName} field.
11. Click and hold the LastName field and drag and drop the field to the right of the space in the text object.
12. Resize the width of the text object to cover the width of the report; approximately 7 inches wide.
13. Right-click on the text object and select Format Text…
14. To allow the field to grow and shrink based on the amount of field content, click the Can Grow option.
The maximum number of lines a field may grow to can be defined in this section. If a Zero is defined as
the row maximum, no limit will be imposed on the text object.
15. Click OK to close the Format Editor dialog box.
16. Double click the text object to resume editing. Place the edit cursor to the right of the {LastName} field.
17. Press ENTER, then type Current Title: and then add a space to allow a buffer between the colon and
the following field.
Copyright ©2017 Pathfinder Learning, LLP
150 Lesson 5: Additional Formatting Objects
18. Click and hold the Title field and drag and drop the field to the right of the newly added space in the text
object.
19. Press ENTER, then type Current yearly salary: and then add a space to allow a buffer between the
colon and the following field.
20. Click and hold the Salary field and drag and drop the field to the right of the newly added space in the
text object.
21. Press ENTER, then click and hold the Notes field and drag and drop the field to the new line in the text
object.
Figure 5-33 Finished Text Box with Embedded Fields
22. Preview the report. Note that there is an issue with easily recognizing where one record ends and
another record begins.
23. Return to the Design tab and increase the height of the Details section to 1 ½ inches.
24. Draw a line across the bottom of the Details section.
Figure 5-34 Separator Line
25. Preview the report.
Copyright ©2017 Pathfinder Learning, LLP