SSRS 2005 Custom code not working

  • Hi All,

    I developed a report in BIDS 2005.

    I have 2 date parameters of calender type.

    1) FromDate

    2) LastDate

    User has to enter the dates and then the records in the selection creteria will be displayed.

    I have to add validation to the dates. Fromdate should be less than the Lastdate. To implement this I had followed the below steps.

    1) Go to Report -> Properties -> Code

    In the code window I gave the following code

    Public Function CheckDate(ByVal FromDate As String,_

    ByVal Lastdate as String) As String

    Dim msg As String = Nothing

    msg = " "

    If (FromDate > Lastdate) Then

    msg = "Start Date cannot be greater than the Last date."

    End If

    End Function

    2) In the report parameters I added another parameter (DateValidation) with datatype as String. I also checked the Hidden and Allow blank check boxes.

    In the default values I selected the Non-queried and added the following code in the Fx

    =Code.CheckDate(FromDate.Value,LastDate.Value)

    The problem is While I try to add the above code in the parameter Fx I am not geeting the reference to the function in the intellisense.

    Is there any mistake in the code i gave above ?

    Do I have to add any further references to the report befor I call a fucntion that is written in the Code window?

    I also tried to add other functions in the code window but I am getting the same result.

    Please help.

    With Regards,
    Anu..;-):hehe:

  • This does not answer your question directly, but it may be the solution you are looking for:

    http://msdn.microsoft.com/en-us/library/aa337169.aspx

    Hope this helps.

  • Thanks dbowlin for the reply.

    But this is not what Iam trying to do. Iam trying to call a custom code from expression which Iam not able to perform successfully.

    Please go through my post once again and let me know if you can help me anyway.

    Iam clueless about what iam missing in it...

    With Regards,
    Anu..;-):hehe:

  • You wrote:

    The problem is While I try to add the above code in the parameter Fx I am not geeting the reference to the function in the intellisense.

    Are you referring to the red squiggly line, indicating some type of error? Or does you function doesn't run at all?

    I use a divide by zero funtion and thought I was doing something wrong because I could not get rid of the red squiggly line, but when I ran the code it worked with no problems.

  • du7777 (8/13/2010)


    You wrote:

    Are you referring to the red squiggly line, indicating some type of error? Or does you function doesn't run at all?

    Although you can use code in the expression builder, the Intellisense does not work and it will look like you are getting an error. Run it anyway and it should work.

  • Hi Annu,

    I am getting exactly same error. Please let me know the solution if you get the same

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply