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

The expression contains undefined function call...

2 Answers 675 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael Hunt
Top achievements
Rank 1
Michael Hunt asked on 27 Jun 2014, 03:52 PM
Hi,

I am using version 6.2.12.1017 of your Reporting components.

PROBLEM
=========
I am getting the following error in a textbox, when my report runs:

The expression contains undefined function call ConvertIntToString().

MORE INFORMATION
==================
- I have a C# Reporting project that contains the reports and a public static class that contain two public static methods.
- The methods names are "GetParentAppType" and "ConvertIntToString" and they both return a string.
- This class is in the same project as my report class.
- Here is the strange part:  I call the two different methods in the Value Property of two different textboxes.
   One textbox DOES find the call to the GetParentAppType Method, but the other textbox gives the error because for some reason it cannot find the ConvertIntToString function.

- Below is what has been entered in Value property of each textbox.

= Cbs.Reporting.Reports.CommonReportingMethods.ConvertIntToString(Fields.BowlerHasCountermeasure)
= Cbs.Reporting.Reports.CommonReportingMethods.GetParentAppType(Fields.parentAppType)

NOTE:  I didn't type this in.  I used the "Edit Expression" dialog and I picked my functions from the "Functions - Misc" treeview.  I've attached an image of how the functions display in that dialog, which means in the designer, those functions are found.  But at runtime, the ConvertIntToString function is not found.

I'm sure if I move these functions to the report's class (code-behind), it would probably find it, but I will want to share these functions across many reports so I don't want to duplicate them in every report.

Any ideas what is causing the error?

Thanks,
Michael

2 Answers, 1 is accepted

Sort by
0
Michael Hunt
Top achievements
Rank 1
answered on 27 Jun 2014, 04:02 PM
MORE INFO:  I actually moved that ConvertIntToString function into the code-behind of the actual report, and then chose it from the expression dialog, and I still get the error.

This makes no sense.  I even changed the name of the method in case the method name conflicted with something and again chose it from the expression dialog, and the reports still cannot find that function.

Why does it find one method and not the other?
0
Michael Hunt
Top achievements
Rank 1
answered on 27 Jun 2014, 04:17 PM
RESOLVED:
This was my own dummy mistake.  The field I was passing was a boolean (bit from database) while I had defined the method I was calling to accept an int.

I've changed it to accept a bool and it is working now.
Tags
General Discussions
Asked by
Michael Hunt
Top achievements
Rank 1
Answers by
Michael Hunt
Top achievements
Rank 1
Share this question
or