Presentation on theme: "Crystal Reports In Depth Session XII. Crystal Reports - In Depth Reports outside of halFILE Selecting an ODBC Datasource Selecting a second table and."— Presentation transcript:
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 Source to your database and add Primetable and Multi from the list of tables
Once you close the Data Explorer Window, the Visual Linking Expert is displayed to define the relationship between 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 the Crystal 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 the report, select the Database-Add Database to Report menu. For halFILE tables, you should find the HFWParams32.dsn file data source in the dsn folder under halFILE.
I added the DocTypes table to the report. In Visual Linking Expert, I then drag an arrow from the Document_Types field in Primetable to the Code field in DocTypes to establish the relationship.
Now in Field Explorer, I have the DocTypes to select fields for the report.
Crystal Reports - In Depth Primetable vs Multi Primetable 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 fields from the Field Explorer into the Details Section of the report. Titles are automatically placed in the Page Header section.
If you right click on the field in the Details Section of the report, then select Properties, the Format Editor screen is displayed. Here, you can use the tabs to set the field format as needed. I am going to set the 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, the report 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 selection is used to define how the records are groups together. When you insert a group, the report is automatically sorted by that group. For the sample report, we will group by Grantee first, and then File Number
Now that the Groups for Grantee and File Number have been added, the Crystal desktop includes Group Headers and Footers. If you hover the mouse over the Group Header #1, it shows that the Group field is Grantee in the lower left corner of the screen.
I placed the Grantee field into Group Header #1 section and the File Number field 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 Amount to 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 Object menu to add “Lender Total” to the left of the running total.
Now when I refresh the report, it is beginning to look pretty good!
To get a Grand Total, another Running Total is inserted. It is never reset. I drag this field to the Report Footer section.
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 month is 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 and can 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 or functions to include them in the formula.
When you refresh the report, it now needs to know what records to select. This screen lets you enter your parameter fields.
This formula is used for a nice header 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 include the currency symbol. I also suppressed the File Number Group by 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 into the 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 Group Footer #1 section.
Now the report includes a summary by 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. The above form is used to design the chart.
The Data tab of the Chart Expert lets you select how the chart is built. I’ve specified chart sections of the Grantee field, showing the Mortgage Amount totals.
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