Crystal Reports - User Function Libraries

Download Report

Transcript Crystal Reports - User Function Libraries

Crystal Reports
User Function Libraries
Bruce Ferguson
Chelsea Technologies Ltd
A Presentation to the Auckland Visual Basic User Group, 28 April, 1999
Chelsea Technologies Ltd
•
•
•
•
Crystal Reports training
Crystal Reports development
Crystal Reports consulting
VB development
• www.chelseatech.co.nz
• [email protected]
Visual Basic and Crystal Reports
• CR 4 distributed with VB
• Can design/modify reports
– database, ODBC, ADO, ACT, Outlook, servers
• License to distribute run time DLL’s
• CRYSTL32.OCX object
– 200+ properties and methods (usually use < 6)
• Crystal API
Versions of Crystal Reports
• Crystal Reports 5
– Sub reports, variables, crosstab objects, UFL
• Crystal Reports 6
– More functions, Group tree, Web integration
• Crystal Reports 7
– Running Totals, Maps, Parameters, Web
services
Crystal Formula Fields
• Calculations based on DB fields
• Extensive list of built in functions
– Numeric, string, date, time, boolean, ranges,
arrays, summary, etc.
Demonstration:
Simple Crystal Report
But what if you want more...
Complex Report Development
• Sub Reports
– Reports inside a report (linked/unlinked)
– Separate DB, formulas, format
• Variables
–
–
–
–
Temporary storage
Complex If…then…else
Multi line formulas
Can control evaluation time
Crystal Reports Limitations
• Based around Database fields
– plus some special fields
– (print date, page number, page count, author,
report filename, etc.)
• No loops, for.. next, do… while, etc.
• No case statement
• Local to each report/sub report
User Function Libraries
• You can write your own functions
– VB, Delphi, C++
• Special formatting/data conversion
• Information not in the database
– Registry
– Disk volume information
– Text/Data files
• Other things - any suggestions?
Why use UFL?
•
•
•
•
•
Available to all reports/versions
More efficient processing
More powerful
Can be placed in any section
Customise your reports
Writing a UFL
• Create a new VB project (ActiveX DLL)
• Create a new class
• Create a public function
– (numeric, date, string, etc.)
• Compile the DLL
• Register the DLL
Naming the UFL
• Project file Name CRUFLxxx.DLL
• Project Name: CRUFLnnn
• Class Name: ccc
• Public Function Name: fff
• UFL: nnncccfff
Demonstration
Processing the UFL
•
•
•
•
•
Report Header/Footer
Page Header/Footer
Group Header/Footer
Details
Sub Report
Conclusion
•
•
•
•
•
•
•
UFL are very powerful and easy to develop
Available to all reports/versions
More efficient/consistent processing
More powerful
Can be placed in any section of the report
Customise your reports
Any questions?