Friday 21 April 2017

Connect /Use Custom Function In Your Crystal Report

The Seagate Crystal Reports Formula Editor can access User Defined Functions  through a User Function Library (UFL). A User Function Library is a specially designed Dynamic Link Library (DLL) that exposes one or more functions that you create.UFLs can be designed and programmed in any language that supports the development of Windows DLLs. 

The 32-bit version of Seagate Crystal Reports Professional Edition includes the  User Function Library U2lcom.dll. This UFL is installed in your \WINDOWS\CRYSTAL directory when you install Seagate Crystal Reports and provides an interface through which you can expose User Defined Functions in Automation Servers. An Automation Server is a DLL or executable file that exposes its functionality to other modules and processes through the Component Object Model. For complete information on the Component Object Model (COM), refer to the Microsoft web site at www.microsoft.com.  



Using a User Defined Function in Seagate Crystal Reports 
Once you have created a User Defined Function, you can access it from the 
Crystal Report Designer. To do this: 
1.  Open an existing report in the Crystal Report Designer 
2.  On the Insert menu, click Formula Field and create a new formula with 
the name “Greeting”. 
3.  From the Functions column, select AdditionalFunctions and scroll down 
to your newly created functions.  
•  The naming convention for functions is: 
 - <Project Name> <ClassName> <FunctionName> 
•  The functions just created will show as  
 - aaaStringFunctionsUCaseConversion 
 - aaaStringFunctionsLCaseConversion 
4.  Double click the function, ”aaaStringFunctionsUCaseConversion” and 
insert a string database field or a string value.  
•  For example: 
aaaStringFunctionsUCaseConversion(“Hello World”)



5.  Click the Check Formula button on the toolbar.   
  
6.  If there are no errors click the Save and Close button to save the formula 
and close the Formula Editor. 
7.  Insert the Formula field, “Greeting”,  into the Report Header in your main 
report and preview the report.  

To Add a DLL to the registry: 
1.  Click Start, and then click Run. 
2.  In the Run dialog box type “Regsvr32.exe” SPACEBAR opening quotation 
marks [drive:][path] filename closing quotation marks. For example:  
Regsvr32.exe “C:\Windows\Crystal\Aaa.dll”  
3.  Click OK.  
The following message will appear: 
“DLLRegisterServer in C:\Windows\Crystal\Aaa.dll succeeded” 

No comments:

Post a Comment

Control Structures (Crystal Syntax) In Crystal Report : If Expressions (Crystal Syntax) in Crystal Report

Formulas without control structures execute each expression in the formula exactly once when the formula is evaluated. The expressions are...