During the process of designing a report template, you might need to provide some specific formatting for a field not based on its position in the report, but instead based on the type of field it is. For example, a company might require that all date/time fields be displayed in military time regardless of operating system defaults. For example, "6:02 p.m. on March 31, 2004" would have to look like "3/31/04 18:02". Another requirement could be a space as the thousand separator for all numbers (instead of the usual comma).
These requirements could easily be corporate or industry standard requirements, such as the ISO 9000 standard. At the time the template is created, it's unknown where these fields will be located in the report or how many of them there will be. You would have to find another way of handling special formatting requirements. Template Field Objects help in this endeavor.
When designing a report specifically as a template, Template Field Objects take the place of regular database fields in a report. They can be placed anywhere that a database field would normally be placed.
These fields are a special type of formula field that contain no data but allow formats to be applied to them as if they were of any data type. Template Field Objects have a special dialog associated with them that exposes all the Formatting tabs of the Format Editor regardless of type. This provides a one-stop shop for all of your formatting needs regardless of the data type for a given position of a field in a report.
The best way to explain this is by actually performing it, so let's implement the examples given previously in this section:
Starting with a new report, follow these steps:
Figure 14.4. The Design tab with the first template object added to the report.
Figure 14.5. The Design tab with six template objects added to the report.
Figure 14.6. The Date and Time tab of the Format Editor with Military Date/Time selected.
Figure 14.7. The Custom Style dialog box with the space set as the Thousand Separator symbol.
Figure 14.8. The Report Title set to describe the Template report.
Figure 14.9. The Preview tab showing how the report looked when the original report was created.
Figure 14.10. The Template Expert dialog box with a template selected.
Figure 14.11. The Preview tab showing how the report looked after the template was applied.
TIP
Undoing a template is always an option. If for some reason you do not like the look that the applied template has given to your report, just return to the Template Expert and choose the Undo command at the bottom of the dialog box. Selecting this option and then clicking OK lets Crystal Reports revert to the original report before the template was applied.
Crystal Reports accomplishes this by opening up the temporary backup .rpt that it saved before applying the template file.
Notice that there was no need to know where the date and numeric fields were located in the report because the Template Field Objects were all formatted to handle the different requirements for the different fields. Using Template Field Objects along with the other template tips mentioned in the chapter will make report design quick and easy.
Part I. Crystal Reports Design
Creating and Designing Basic Reports
Selecting and Grouping Data
Filtering, Sorting, and Summarizing Data
Understanding and Implementing Formulas
Implementing Parameters for Dynamic Reporting
Part II. Formatting Crystal Reports
Fundamentals of Report Formatting
Working with Report Sections
Visualizing Your Data with Charts and Maps
Custom Formatting Techniques
Part III. Advanced Crystal Reports Design
Using Cross-Tabs for Summarized Reporting
Using Record Selections and Alerts for Interactive Reporting
Using Subreports and Multi-Pass Reporting
Using Formulas and Custom Functions
Designing Effective Report Templates
Additional Data Sources for Crystal Reports
Multidimensional Reporting Against OLAP Data with Crystal Reports
Part IV. Enterprise Report Design Analytic, Web-based, and Excel Report Design
Introduction to Crystal Repository
Crystal Reports Semantic Layer Business Views
Creating Crystal Analysis Reports
Advanced Crystal Analysis Report Design
Ad-Hoc Application and Excel Plug-in for Ad-Hoc and Analytic Reporting
Part V. Web Report Distribution Using Crystal Enterprise
Introduction to Crystal Enterprise
Using Crystal Enterprise with Web Desktop
Crystal Enterprise Architecture
Planning Considerations When Deploying Crystal Enterprise
Deploying Crystal Enterprise in a Complex Network Environment
Administering and Configuring Crystal Enterprise
Part VI. Customized Report Distribution Using Crystal Reports Components
Java Reporting Components
Crystal Reports .NET Components
COM Reporting Components
Part VII. Customized Report Distribution Using Crystal Enterprise Embedded Edition
Introduction to Crystal Enterprise Embedded Edition
Crystal Enterprise Viewing Reports
Crystal Enterprise Embedded Report Modification and Creation
Part VIII. Customized Report Distribution Using Crystal Enterprise Professional
Introduction to the Crystal Enterprise Professional Object Model
Creating Enterprise Reports Applications with Crystal Enterprise Part I
Creating Enterprise Reporting Applications with Crystal Enterprise Part II
Appendix A. Using Sql Queries In Crystal Reports
Creating Enterprise Reporting Applications with Crystal Enterprise Part II