1209040 - Custom function from a User Function Library does not appear in the Formula Editor

SAP Knowledge Base Article - Public

1209040 - Custom function from a User Function Library does not appear in the Formula Editor

Symptom

In Crystal Reports 2008, Crystal Reports XI, and Crystal Reports 10, a custom User Function Library (UFL) is created. This is called CRufltest.dll. The DLL has one function, MyFunction ( ).

The function is declared as public. The DLL is registered and is in the same directory as U2lcom.dll. However, the function does not appear in the Formula Editor.

Cause

This behavior occurs because the data type is not declared as a supported type.

The function was declared as follows:

Public Function MyFunction( )

Since the return type is not defined in the declaration, Microsoft Visual Basic assigns it the variant data type by default. The Crystal Reports Formula Editor does not support the variant data type.

Resolution

To resolve the behavior, declare the function using a specific and supported data type. The following are supported data types:

  • integer
  • long
  • single
  • double
  • currency
  • date
  • boolean
  • string.

Declare the custom function using a return type. For example:

Public Function MyFunction( ) As String

Once the data type is declared properly, the DLL is recompiled and placed in the same directory as U2lcom.dll. The function then appears in the Formula Editor under Additional Functions.

Keywords

SCRCOM, U2LCOM.DLL, Custom Function, UFL User Defined Function Library Formula Data Type , c2001961 , KBA , BI-RA-CR , Crystal Reports designer or BusinessViews Manager , Problem

Product

Crystal Reports 2008 V0 ; SAP Crystal Reports 10.0 ; SAP Crystal Reports XI ; SAP Crystal Reports XI R2