null dataset generates 'user defined function is undefined' error

2 posts, 0 answers
  1. kellyroberts
    kellyroberts avatar
    45 posts
    Member since:
    Jul 2007

    Posted 15 May 2013 Link to this post

    Hi All - Im looking at the KB article: The expression contains undefined function call MyUserFunction() error

    excerpt ...

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


    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? 

  2. Stef
    Stef avatar
    3611 posts

    Posted 18 May 2013 Link to this post

    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.

    the Telerik team

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

Back to Top