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

Null DateTime parameter in user function

0 Answers 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Patrick Saunders
Top achievements
Rank 1
Patrick Saunders asked on 14 Mar 2013, 11:27 PM
Just writing this here for anyone else who gets stuck by this.

My function was:
public static string CalculateFieldDescription(DateTime deliveredDate)
{
....
}

If deliveredDate was null in the data, I would get error:
"An error has ocured while procesing TextBox: The expression contains undefined function call CalculateFieldDescription() .

Now here:
http://www.telerik.com/support/kb/reporting/designing-reports/the-expression-contains-undefined-function-call-myuserfunction-error.aspx
Telerik in their wisdom say "3.A field specified as function argument is null. Make sure that such cases are handled in the user function.
Um, you don't get the opportunity dude, it is ERRORING BEFORE IT IS GETTING CALLED.
So your point #3 is clearly bogus and wrong.

A solution is simply, change your function to have Object parameter:
public static string CalculateFieldDescription(Object deliveredDate)
{
  if (deliveredDate != null)
  {
     // Do conversion and use it.
  }
}

Hope this is more helpful then Telerik's doco.

Pat.




No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Patrick Saunders
Top achievements
Rank 1
Share this question
or