Upload
dorcas
View
50
Download
0
Tags:
Embed Size (px)
DESCRIPTION
Session XII. Crystal Reports. In Depth. Crystal Reports - In Depth. Reports outside of halFILE Selecting an ODBC Datasource Selecting a second table and linking it to the primary table Grouping data records Using formulas Adding parameters fields Using record selection - PowerPoint PPT Presentation
Citation preview
Crystal ReportsIn Depth
Session XII
Crystal Reports - In Depth
• Reports outside of halFILE
• Selecting an ODBC Datasource
• Selecting a second table and linking it to the primary table
• Grouping data records
• Using formulas
• Adding parameters fields
• Using record selection
• Sub-totals and grand totals
• Adding a sub-report
• Graphs
• The Crystal Web Component
The screens shown in this presentation use Crystal Reports version 8.0
Crystal Reports - In Depth
• Begin a new report
• Select a halFile database using a File Data Source
• Select tables in the database– primetable vs multi
Selecting an ODBC DataSource
To start a new, blank report, click the As a Blank Report option
on Crystal’s welcome screen
In Crystal’s Data Explorer,find the File Data Sourceto your database and add
Primetable and Multi from thelist of tables
Once you close the Data ExplorerWindow, the Visual Linking Expert
is displayed to define the relationshipbetween tables. Drag an arrow from
Multi.PRSERV to Primetable.PRSERV.
Once you close the Visual Link Expert,The Field Explorer is shown to let you
drag and drop fields onto theCrystal Desktop.
Crystal Reports - In Depth
Primetable vs Multi
Primetable
Document Number
other single-entry fields
Multi
Document Number
Counter (“number”)
other multi-entry fields
In Field Explorer, halFILE’s Document Number is called “PRSERV”
Crystal Reports - In Depth
Primetable vs Multi
Primetable
00000001
Multi
00000001, 0, Jones
00000001, 1, Smith
00000001, 2, Brown
The above shows the relationship between Primetable and Multi using PRSERV
Crystal Reports - In Depth
• halFILE table in parameters database
• How to determine table names
Selecting a Table in a different database and linking it to the primary table
To add a halFILE table to thereport, select the
Database-Add Database to Reportmenu. For halFILE tables, you
should find the HFWParams32.dsnfile data source in the dsn folder
under halFILE.
I added the DocTypes table to thereport. In Visual Linking Expert,I then drag an arrow from the
Document_Types field in Primetableto the Code field in DocTypesto establish the relationship.
Now in Field Explorer, I have theDocTypes to select fields for
the report.
Crystal Reports - In Depth
Primetable vs MultiPrimetable
Document Number
Coded Field
other single-entry fields
halFILE Table
Code
Description
The above shows the relationship between a coded field and a halFILE table. In the report I am building, I’ve established a relationship between the Document_Type field and the Code field in the DocTypes table of HFWParams.
Crystal Reports - In Depth
Primetable vs Multi
Primetable
00000001
Doc_Type: MTG
halFILE DocTypes Table
MTG
Mortgage
If the Document Type is MTG, the link to the DocTypes table lets you obtain the description “Mortgage” from the DocTypes.
I’ve dragged some fieldsfrom the Field Explorerinto the Details Sectionof the report. Titles areautomatically placed
in the Page Header section.
If you right click on the field in theDetails Section of the report, then
select Properties, the Format Editorscreen is displayed.
Here, you can use the tabs to set thefield format as needed. I am going to setthe date field to print in a different format
than the default.
Crystal Reports - In Depth
• Right click on field in detail section
• Suppress if duplicated is used for Primetable fields to prevent the field from printing on every line for the document
• Date formatting
• Can grow option defines if the field can take up more than one report line
Field Properties
When I click the Refresh button, thereport is previewed so I can see how
it will look when printed.
Crystal Reports - In Depth
• Defines how report is sorted
• Adds sub-headers and sub-footers
• Multiple groups are allowed in a report
Grouping Data Records
The Insert-Group menu selectionis used to define how the records
are groups together. Whenyou insert a group, the report
is automatically sorted by that group.For the sample report, wewill group by Grantee first,
and then File Number
Now that the Groups for Grantee and File Numberhave been added, the Crystal desktop includesGroup Headers and Footers. If you hover themouse over the Group Header #1, it shows
that the Group field is Grantee in the lower leftcorner of the screen.
I placed the Grantee field into GroupHeader #1 section and the File Numberfield into the Group Header #2 section.Now, when I refresh the report, I see
my Group Headers.
Crystal Reports - In Depth
• Totals
• Concatenating fields
• Parsing fields– Subdivision and Township-Range
formulas are available from Tech Support
Using “Formulas”
Crystal Reports - In Depth
• Summary, running totals, grand totals
• Averages
• Maximum
• Minimum
• Count
Sub-Totals and Grand Totals
To add a running total of Mortgage Amount, right click on the Mortgage Amount field in the Details Section and select Insert-Running Total.
This displays this screen where I’ve set it up to add the Mortgage Amountto the running total every time the File Number changes and to clear the
running total when the Grantee changes. So, I get a total by Grantee.
The Running Total was placed into the Group Footer for Grantee.I increased the size of the font for the Grantee field in Group Header #1.I also selected the Insert-Line menu and dragged a line at the top of the
Group Footer #1 to designate the total. Finally, I used the Insert-Text Objectmenu to add “Lender Total” to the left of the running total.
Now when I refresh the report, it isbeginning to look pretty good!
To get a Grand Total, another Running Total is inserted. It isnever reset. I drag this field to the Report Footer section.
And here is the refreshed report.
Crystal Reports - In Depth
• Prompting the user for a parameter
• Uses:– Dynamic report headers– Dynamic selection criteria
Adding “Parameters Fields”
A Parameter field called SelectMonth is used to designate what monthis selected for the report. Select Insert-Parameter Field, then in the
Field Explorer, right click on Parameter Field and select New.I fill in the form above to create the field.
Now the SelectMonth field is in Field Explorer andcan be placed on the report or used for
selection criteria.
Crystal Reports - In Depth
• Selecting data for the report
• Changing the selection formula
Using “Record Selection”
Use the Report-Edit Selection Formula-Record Selection menu to select certain records fromthe database. In the above example,
I’ve selected only records for the selected month and year.The Record Selection Formula Editor helps
you set up the record selection. You can double click fields orfunctions to include them in the formula.
When you refresh the report, it now needs to knowwhat records to select. This screen lets you enter
your parameter fields.
This formula is used for a niceheader of month and year.
Since I indicated 09/2002 for the selected date of the report,the report now includes only records for September 2002.I’ve placed the ‘FormatSelectedMonth’ formula field in the
header and formatted the Mortgage Amount field to includethe currency symbol. I also suppressed the File Number Groupby right clicking in the Group Header and Group footer areas
and selecting ‘Hide (Drill-Down ok)’.
Crystal Reports - In Depth
• Designing a sub-report
• Placing the sub-report into the main report
• Changing the sub-report
Inserting a Sub-Report
Sub-Reports
– Save the report as a new name – Close the report and re-open it– Select the File-Insert Sub-report menu– Select an existing report and open the saved
report as the sub-report– Modify the sub-report as needed
If the sub-report is a summarized version of the report you are working on, the easiest way to build it is:
The main report was saved as Hug_Mortgae_Reportsub.rpt.The report was reopened and the sub-report was inserted intothe Report header section. If you double click the sub-report,
you can design the report as needed.
The sub-report was changed to hide the detail.Also the date and file number fields were removed.
Finally, the Grantee was placed in the GroupFooter #1 section.
Now the report includes a summaryby lender in the report header.
Crystal Reports - In Depth
• Inserting a graph
• Selecting the type of graph
• Placing the graph on the report
Graphs
To add a graph to your report,select Insert-Chart. Theabove form is used to
design the chart.
The Data tab of the Chart Expertlets you select how the chart is built.I’ve specified chart sections of the
Grantee field, showing theMortgage Amount totals.
The chart is placed in theReport Footer.
Crystal Reports - In Depth
• Allows reports to be viewed in a browser• Requirements
– Requires Internet Information Server– Not included in Crystal Standard– First included in Crystal Pro 7.0
• Report Viewer download if not already installed
• Refresh the report by clicking the lightning bolt
Crystal Web Component
The End