Custom code in SSRS

Posted on 2011-10-10
Last Modified: 2012-05-12
I am setting up code in the custom code area of report properties in SSRS 2008. I am having problems setting up the public function for two fields. I have to have one for pbm_propertyClass and one for pbm_TotalAssessment. I need the pbm_propertyClass to set up and If statement to see if it less than 710 and if so add the total to nonexempt field to use in a percentage calculation. Then if it less than 710 I willl need to set up a seperate function I believe. My problem is I don't know how to declare both virables in one public function statement.   Both of these virables are table fields in the dataset.  it gives me the following error when I try to view the report.  The definition of the report 'PropertyClass is invalid. There is an error on line 1 of custom code:[BC30205] End of statement expected.
' Non Eempt Property values
Public function PropClass(ByVal pbm_PropertyClass as Integer), nonexempt (byval pmb_totalAssessment as integer)

  ' Non Exempt property classes are less than 710
If pbm_PropertyClass < 710 
NonExempt = NonExempt + pbm_TotalAssessment
End if
End Function

Open in new window

Question by:stevenofva
    LVL 21

    Expert Comment

    by:Alpesh Patel
    LVL 27

    Accepted Solution

    you need something like this....

    Public Function PropClass (ByVal pbm_PropertyClass as Integer, Byval pmb_totalAssessment as integer) as Object
    If pbm_PropertyClass < 710
    NonExempt += pbm_TotalAssessment
           Return 0
    End if
        Return NonExempt
    End Function

    'IN Report ......
    '=Code.PropClass(Fields!pbm_PropertyClass.Value, Fields!pmb_totalAssessment.Value)

    Author Comment

    Sorry for not thinking everybody yesterday I got busy with another project. Thank you for helping me with the code.
    LVL 27

    Expert Comment

    Glad to help :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Should I Do With This Threat Intelligence?

    Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

    Introduction Earlier I wrote an article about the new lookup functions ( that ship with SQL Server 2008 R2.  In this article I’m going to show you another new feature of SSRS 2008 R2, this time in the vis…
    A recent questions about how to add SSRS named instances, couldn't find any that talks about SQL server 2008, anyway I decided to help by creating some screen shots. The installation is straightforward, you just pop the SQL server 2008 installati…
    This video discusses moving either the default database or any database to a new volume.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now