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

User Function - Undefined Function

3 Answers 179 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 14 Jan 2011, 10:57 PM
I am new to the Telerik suite and am just learning the ropes on creating Telerik reports.

I have a SQL Server stored procedure that outputs number of minutes (using datediff() function in SQL).  That is to be a signed integer.   My result set would look like this:
Date            Name        TotalMinutes
1/1/2011     Jim            20
1/2/2011     Jim            15
1/3/2011     Jim            30
1/4/2011     Jim            5 

I have a report setup to display the data just as it appears above. In a grouping footer I have it SUM the minutes to get a total (e.g. 70).  I created a user function that takes that value and adds 10 to it.  So, the expression for my textbox field in the footer is as follows:  = AddMinutes(Sum(Fields.TotalMinutes)), which given my example should return 80 for Jim

My user function is defined in a class file (DateFunctions.vb):

Public Shared Function AddMinutes(byval TotMinutes as Integer) as Integer
    return TotMinutes+10
End Function

I am not using any code-behind on the report itself.  I am just putting an Expression in through the GUI.  When I try to run this I get a Undefined Function error in the report.  I tried calling it as =DateFunction.AddMinutes(Sum(Fields.TotalMinutes)) and just as =AddMinutes(Sum(Fields.TotalMinutes)), but I keep getting the same error.

Please Help as I am stuck!

3 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 17 Jan 2011, 09:13 AM
Hi Chris,

Check the following KB article that elaborates on the known reasons for this problem:The expression contains undefined function call MyUserFunction() error.

Regards,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
0
Chris
Top achievements
Rank 1
answered on 17 Jan 2011, 07:22 PM
Steve,

Thanks for the reply.  I looked at that before I originally posted.  I have one parameter to my function and I have compiled the project.  Not sure what to check next.

Thanks,
Chris
0
Steve
Telerik team
answered on 20 Jan 2011, 04:09 PM
Hello Chris,

Try the following expression:

=DateFunction.AddMinutes(CInt(Sum(Fields.TotalMinutes)))

Kind regards,
Steve
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
Chris
Top achievements
Rank 1
Answers by
Steve
Telerik team
Chris
Top achievements
Rank 1
Share this question
or