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

Problem passing multiple params to a static function when one is an aggregate

1 Answer 65 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Enigma
Top achievements
Rank 1
Enigma asked on 14 May 2010, 05:31 AM
Hi,

I am trying to show a caculate result in a specific format in the group footer row.  If I only format a single aggregate value, it works fine but a double parameter does not work.  I get the error message "An error has occured while processing TextBox 'textBox5':
The expression contains undefined function call GetTimeString2()"

So basically if I do this
=GetTimeString1(Sum(Fields.Hours))
or I do this
=GetTimeString1(Sum(Fields.Minutes))
it works fine, but if I do this

=GetTimeString2(Sum(Fields.Hours), Sum(Fields.Minutes))
it does NOT work and I get the above error message and even if I try this
=GetTimeString2(Sum(Fields.Hours), 40)
it does NOT work, but this will work
=GetTimeString2(2, 40)

So basically if there is an aggregate, one or many doesn't matter, it will not work.

the static function signature are
=========================
public static string GetTimeString1(int hrs)
public static string GetTimeString2(int hrs, int mins)

Can someone point out why it won't take two aggregates in the function.  I looked at the limitations post and it does not look like this is a limitation.

Thanks for your assistance.
- Mans.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 18 May 2010, 04:12 PM
Hi Enigma,

Internally all of the data types are converted to the "biggest" numeric data types (long and double) to avoid any data/precision loss (common practice in scripting languages). In this line of thoughts the Sum aggregate returns Int64 (long) data type when we sum int values.  In order the expression engine to recognize your User Function you have to modify it to accept Int64 parameters as shown in the following code snippet:

public static string GetTimeString2(Int64 hrs, Int64 mins)

Best wishes,
Peter
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
General Discussions
Asked by
Enigma
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or