This is a migrated thread and some comments may be shown as answers.

null dataset generates 'user defined function is undefined' error

1 Answer 18 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
kellyroberts
Top achievements
Rank 1
kellyroberts asked on 15 May 2013, 02:19 PM
Hi All - Im looking at the KB article: The expression contains undefined function call MyUserFunction() error

http://www.telerik.com/support/kb/reporting/designing-reports/the-expression-contains-undefined-function-call-myuserfunction-error.aspx

excerpt ...

PROBLEM
The following error is thrown when running the report: #ERROR# The expression contains undefined function call MyUserFunction()

SOLUTION

This error can occur in any of these three cases:
  1. The class library has not been rebuilt and thus the function does not yet exist.
  2. Using the function with wrong number/type of parameters. The passed fields must match the function signature you've defined originally.
  3. A field specified as function argument is null. Make sure that such cases are handled in the user function.

In my case I think its #3. 

I have a report that uses date ranges to filter data.  if a user select a date range that results in zero records, I get the undefined user function error.  I assume because of the nulls.

#3 above mentions "Make sure that such cases are handled in the user function"  by this assume Telerik means use something to the effect of  ..

If (MyParam==null) {return 0;)

I tried this and still get the error, so I must be doing something wrong.

Could someone please test this and report back?

generate a report with a simple UDF.  pass a null dataset to the report.  Do you get the same error? 



1 Answer, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 18 May 2013, 02:51 PM
Hi Kelly,

Passing empty data source to the report renders blank report even if one of the items uses user-defined function. However, the result depends on the logic in the function, where and how it is used in the report.

In case your functions are defined in an outer assembly, typing "=<namespace>.<functionName>(<parameters>)"  as expression for an item in the report definition will cause a similar exception on preview in the designer. To check the report you need a ReportViewer control and to extend the viewer application configuration as follows:
When you run the application, expression containing functions from the referenced outer assembly will be processed successfully.

If you need further help, elaborate on your project structure, user functions code and report definition.

Regards,
Stef
the Telerik team

Have you tried the new visualization options in Telerik Reporting Q1 2013? You can get them from your account.

Tags
General Discussions
Asked by
kellyroberts
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or