Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Formulas and Custom Functions

Status
Not open for further replies.

kutoose

Technical User
Sep 11, 2002
169
US
Application : Crystal Reports 10

I was trying to create a custom function from a formula using extractor. The formula was having an 'isnull' function. I got the following error message :

A custom function can not be extracted from this formula.

The formula contains functions that can not be used in custom functions.
isnull



Have any one come across this ? What is a solution ?

kutoose@yahoo.com
 
I found this blurb in the help files:

Custom function syntax rules
Due to the independent nature of custom functions, there are some limitations:

You cannot use report or database fields, including summary fields, in a custom function.
You cannot use shared or global variables in a custom function, but you can pass a global or shared variable in as an argument when calling a custom function from within a formula.
You cannot use recursion, either direct or indirect, in a custom function.
You cannot directly use UFLs in a custom function.
You cannot call Evaluation Time, Print State, or Document Properties functions. Also, you cannot use the functions: Rnd, CurrentFieldValue, DefaultAttribute and GridRowColumnValue.
These restrictions are designed to make custom functions independent of the report they are being used in.


IsNull is a Print Time formula. I am going to see if I can determine a workaround.

~Brian
 
Thanks Brian - Let us know if there is a workaround.

kutoose@yahoo.com
 
This may or may not work for you. The basic idea is to move check for the NULL's before you call the custom function.

I set my formula up like this to check for NULL's, and to return a default character to the custom function that I can test for.

Code:
if isnull({table.field}) then
    myCustomFunction ("/")
else
    myCustomFunction ({table.field})

In the Custom Function, check for the character instead of checking for IsNull(). I know this requires a littel more work for each report, but hopefully it helps get the bulk of the logic into the function.

~Brian
 
Umm..
Let me try this. Looks cumbersome.

Thanks !

kutoose@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top