Creating Crystal reports User Function Libraries (UFL) with Visual Studio .NET
A User Function Library (UFL) is a dynamic link library, created by an application developer. Crystal Reports is then able to use these UFLs to add customized functions to the formula language. In this way UFLs may remove the need to format data with complex formulas in order to get usable report output. UFLs essentially extend the Crystal Reports formula language and are used in the same way as any other predefined Crystal Reports functions. Additionally, complicated formulas, or a high number of formulas will result in report performance issues and UFLs may help to alleviate these issues as complex or difficult calculations are removed from Crystal Reports into an environment the developer has much more control over.
The ability of creating UFLs was added in version 6 of Crystal Reports and this ability persists through to version 12.x . These original UFLs had to be built in a COM compliant language (VB 6, C++, Delphi, etc.). With the release of Visual Studio .NET, Crystal Reports UFLs can now also be created using .NET.
A User Function Library (UFL) built in Visual Studio .NET is a .NET class library that has similar requirement to the original COM UFLs:
The project name must be prefixed with the string “CRUFL”.
Upon compilation, the assembly is registered for COM Interop so that it is viewed as a COM object.
The project consists of an interface and an implementation class.
Both the interface and the implementation class have COM and GUID attributes.
The User Function Library, is visible within the Crystal Reports Designer as a new function in the Formula Workshop under Additional Functions.
Additionally, the .NET assembly/COM (UFL) object must be added to the Global Assembly Cache so that it is available to all .NET applications on the machine.
Detailed documentation on creation, use and distribution of .NET UFLs can be found in the article, “Crystal Reports For Visual Studio 2005 Walkthroughs”, pages 390 to 399. Additional information can be found in the “Crystal Reports 2008 .NET SDK Developer Guide”, by searching the file for UFL.