Tuesday, March 20, 2012

Can''t see function for code added in Report Properties

I put a function in the code section of Report Properties. I went to add an expression and can't find the function. I type =code. and did not see the function I created in the list.

Here's my code below:

Code Snippet

Public Function ConvertToStartDate(ByVal StartDate As String) As DateTime
Select Case StartDate
Case "Today"
Return DateTime.Today
Case "Yesterday"
Return DateTime.Today.AddDays(-1)
Case "30DaysOut"
Return DateTime.Today.AddDays(+30)
Case "2DaysPrior"
Return DateTime.Today.AddDays(-2)
' Additional cases
Case Else
Throw New ArgumentException("Unknown argument, " & StartDate, "StartDate")
End Select
End Function

I should be able to put in expression =code.ConvertToStartDate.StartDate("Today"), but that does not work. I get a red squiggly line under StartDate.

Thanks for your help,

Iris

from your code snippet up above, you would use:

=Code.ConvertToStartDate("Today")

I havent had the intellisense work on custom function code.

BobP

|||

Works like a charm....Thanks!

Iris

No comments:

Post a Comment