Custom code in ssrs 2005

hi sir
i am fresher, 
i need breif about custom code in ssrs,
what is cutom code,
why it is used,
what is the perpose of this code...
help me to learn.
thank you.

custom code is used mostly for implementing functionalities which cannot be done using standard features available in SSRS. Custom code should be written using .NET language. If you want to share same code across multiple reports you should make it into
a dll and reference it from all the required reports.
More details here
https://msdn.microsoft.com/en-us/library/ms156028.aspx
https://msdn.microsoft.com/en-us/library/ms159238.aspx
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • Custom Code in SSRS 2008

    Hi,
    I am trying to write Custom Code in SSRS for Age Calculation for two requirements in the same report,But report is giving error #Error in expression with my below code.
    whole logic is same for both but only two lines are different,Do i need create two functions or can i use them in one function.Please guide me.
    1)Age in Years (Ex: 4)
    2) Age in Years + months (ex: 3 Years 6 months)
    My SSRS Custom Code:
    Public Shared Dim Years as Integer
    Public Shared Dim Months as Integer
    Public Shared Dim Days as Integer
    Public Shared Dim Age as Integer
    Public Shared Function CalAge(ByVal D1 As Datetime,ByVal D2 As Datetime ) As Integer
      Years=Year(D1)-Year(D2)
      Months=Month(D1)-Month(D2)
      Days=Day(D1)-Day(D2)
           If Days < 0 then 
               Months=Months-1
             End if
           If Months < 0 then 
              Years=Years-1
             End if
           If Months < 0 then
              Months=Months+12
           End If
         Return Years 
    If Months=1 then
        Age=Years+" Years " + Months + "Month"
    else
      Age=Years+" Years " + Months + "Months" 
    End If 
    Return Age
      End Function

    hi Guys,
    I have finally changed my custom code to below :
    Public Shared Dim Years as Integer
    Public Shared Dim Months as Integer
    Public Shared Dim Days as Integer
    Public Shared Function CalAge(ByVal D1 As Datetime,ByVal D2 As Datetime ) As Integer
      Days=DatePart(DateInterval.Day,D1)-DatePart(DateInterval.Day,D2)
     Months=DatePart(DateInterval.Month,D1)-DatePart(DateInterval.Month,D2)
      Years=DatePart(DateInterval.Year,D1)-DatePart(DateInterval.Year,D2)
             If Days < 0 then 
               Months=Months-1
          End If
           If Months < 0 then 
              Years=Years-1
            End If
           If Months < 0 then
              Months=Months+12
           End If
         Return Years 
      End Function
    Public Shared Function CalMon(ByVal D3 As Datetime,ByVal D4 As Datetime ) As Integer
       Days=DatePart(DateInterval.Day,D3)-DatePart(DateInterval.Day,D4)
       Months=DatePart(DateInterval.Month,D3)-DatePart(DateInterval.Month,D4)
      Years=DatePart(DateInterval.Year,D3)-DatePart(DateInterval.Year,D4)
         If Days < 0 then 
               Months=Months-1
          End If
           If Months < 0 then 
              Years=Years-1
            End If
           If Months < 0 then
              Months=Months+12
           End If
     Return Months 
      End Function
    and using expression in SSRS fo display like this  :
    =IIF((Code.CalMon(Parameters!AgeCalcDate.Value,Fields!StudentBirthDate.Value))=1,Code.CalAge(Parameters!AgeCalcDate.Value,Fields!StudentBirthDate.Value) & " Years " & Code.CalMon(Parameters!AgeCalcDate.Value,Fields!StudentBirthDate.Value)
    & " Month ",
        Code.CalAge(Parameters!AgeCalcDate.Value,Fields!StudentBirthDate.Value) & " Years " & Code.CalMon(Parameters!AgeCalcDate.Value,Fields!StudentBirthDate.Value) & " Months ")
    got the correct solution.

  • Using custom code in SSRS PDF rendering

    Hi,
    I have a written some custom code ( a simple function to maintain a counter ) in SSRS Report properties.
    Everything works fine when I render the report in Report Viewer, but the custom code is not recognized when I render the report to PDF.
    What is wrong with my code?
    There is no error reported. The custom code is just getting skipped when I render to PDF.
    My custom code is as follows..
    Public Shared Dim iCounter AS Integer = 1
    Public Function IncrementCounter(SomeValue As Boolean) As Boolean
    iCounter = iCounter + 1
    Return SomeValue
    End Function
    Public Function GetCounter() As Integer
    Return iCounter
    End Function
    and my call to the custom code is..
    =code.GetCounter()

    Hi ha_emp,
    From your description, it seems that custom code work well when you preview the report. While it would be skipped when the report is exported to PDF. After testing the custom code in my environment,I find that the custom code will run again when exporting
    the report, so when we run the report on Report Server and export it to PDF, the custom code will be run twice, the value will be counted twice.
    Based on my research, I find that we can delete the “Shared” in the first row of the custom code to fix this issue. Then the custom code will works well on Report Server.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks, 
    Katherine Xiong
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • Custom code in SSRS gives error when uploaded to report in CRM online

    Hi All;
    Below is my custom code 
    Function SumLookup(ByVal items As Object()) As Decimal
    If items Is Nothing Then
    Return Nothing
    End If
    Dim suma As Decimal = New Decimal()
    Dim ct as Integer = New Integer()
    suma = 0
    ct = 0
    For Each item As Object In items
    suma += Convert.ToDecimal(item)
    ct += 1
    Next
    If (ct = 0) Then return 0 else return suma
    End Function
    and this code is used in 
    =Code.SumLookup(LookupSet(Fields!new_mainprogrammeid.Value & "," &
    Fields!new_subprogrammeid.Value & "," &
    Fields!new_outputs.Value & "," &
    Fields!new_claimmonthid.Value,
    Fields!new_mainprogrammeid.Value & "," &
    Fields!new_subprogrammeid.Value & "," &
    Fields!new_outputs.Value & "," &
    Fields!new_claimmonthid.Value,
    Fields!new_fte.Value, "JobOutcome"))
    when this code is uploaded in CRM online report it gives an error 
    below is the error from the log file 
    Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again. If this problem persists, contact your system administrator.Detail:
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
    <ErrorCode>-2147188072</ErrorCode>
    <ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>An error occurred while trying to add the report to Microsoft Dynamics CRM. Try adding the report again. If this problem persists, contact your system administrator.</Message>
    <Timestamp>2014-10-07T14:21:25.5823821Z</Timestamp>
    <InnerFault i:nil="true" />
    <TraceText i:nil="true" />
    </OrganizationServiceFault>
    but when i remove the custom code and upload the lookup as below i dont get any error
    =(LookupSet(Fields!new_mainprogrammeid.Value & "," &
    Fields!new_subprogrammeid.Value & "," &
    Fields!new_outputs.Value & "," &
    Fields!new_claimmonthid.Value,
    Fields!new_mainprogrammeid.Value & "," &
    Fields!new_subprogrammeid.Value & "," &
    Fields!new_outputs.Value & "," &
    Fields!new_claimmonthid.Value,
    Fields!new_fte.Value, "JobOutcome"))
    I need to calculate the sum of fte hence needed the custom code
    Any help on this much appreciated
    Thanks
    Pradnya07

    Hi Simran08,
    According to your description, you fail to add your report to CRM due to the custom code. Right?
    In this scenario, based on my knowledge, I find two issues in your custom code.
    You pass the array Items as argument to the function. This array is from the LookupSet() function. However, it returns an concatenated string with commas. When you convert it into decimal, it will throw error.
    In your For Each loop part, we should follow the format below:
    For Each element In group
    [statements]
    [Exit For]
    [statements]
    Next [element]
    It seems you miss Item after Next.
    If you still have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • SSRS VB Code error while deploying report -- There is an error on line 5 of custom code: [BC30201] Expression expected._

    Function MakeList(ByVal items As Object()) As String
        If items Is Nothing Then
          Return Nothing
    END if 
    Dim builder As System.Text.StringBuilder = 
          New System.Text.StringBuilder()
          builder.Append("<div>")
       For Each item As Object In items
          builder.Append("<div <ul>")
          builder.Append(item)
          builder.Append("</ul>")
       Next
       builder.Append("</div>")
       Return builder.ToString()
    End Function
    Function Length(ByVal items as Object()) as Integer
       If items is Nothing Then
          Return 0
       End If
       Return items.Length
    End Function

    Hi Wintersbay,
    According to your description, when you use the custom code in SSRS report, you got the error message.
    To solve the problem, please refer to the custom code below:
    Function MakeList(ByVal items As Object) As String
    If items Is Nothing Then
    Return Nothing
    END if
    Dim builder As System.Text.StringBuilder =
    New System.Text.StringBuilder()
    builder.Append("<div>")
    For Each item As Object In items
    builder.Append("<div <ul>")
    builder.Append(item)
    builder.Append("</ul>")
    Next
    builder.Append("</div>")
    Return builder.ToString()
    End Function
    Function Length(ByVal items as Object) as Integer
    If items is Nothing Then
    Return 0
    End If
    Return items.Length
    End Function
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • How to dynamically set width of SSRS columns in custom code?

    How can I change the width of a table column based on a parameter value using custom code in SSRS?
    If the parameter value is "Excel", I'd like the width to be 2 inches. If the parameter value is "Standard", I'd like the width to be 1 inch.

    Hi mmx_pdx,
    Based on my research, we can only type static values for the width size in report. In Reporting Services, it not supported to set the size of width based on an expression currently. This is by design.
    Personally, I recommend you that submit this suggestion at
    https://connect.microsoft.com/SQLServer/. If the suggestion mentioned by customers for many times, the product team may consider to add the feature in the next SQL Server version. Your feedback is valuable for us to improve our products and increase the
    level of service provided.
    Thanks for your understanding.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Hi iam new to implement custome code in sssrs when iam created connection in ssrs its throwing error please find the screen shot

    when iam previwing report this error is occured
    System.Data.SqlClient.SqlException: Login failed for user 'FPS\hariprasad.a'.
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
       at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
       at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
       at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
       at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
       at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
       at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnec

    hi pasted error .iam impleting custom code in ssrs like below
    Public Shared Function DeleteData(Byval empno AS Integer) As String
                    Dim strResult As String
                    Dim conn As New System.Data.SqlClient.SqlConnection
                    conn.ConnectionString = "Integrated Security=SSPI;Data Source=172.16.1.111\DATA_SERVICES;Initial Catalog=Recounsiled"
                    Dim sql As String
                    sql = "sp_empno"
                    Dim com As New System.Data.SqlClient.SqlCommand
                    com.CommandText = sql
                    com.CommandType = System.Data.CommandType.StoredProcedure
                    com.Parameters.Add("@empno", System.Data.SqlDbType.Int).Value =empno
                    com.Connection = conn
                    Try
                                    com.Connection.Open()
                                    com.ExecuteNonQuery()
            com.Connection.Close()
                                    strResult = "Successful"
                    Catch ex As Exception
                                    com.Connection.Close()
                                    strResult = ex.ToString()
                    End Try
                    return strResult
    End Function

  • How to control or manipulate a report parameter through SSRS Custom Code

    Hi,
    In reporting services 2005 or 2008, is it possible to control the parameters inside the custom code of a report?
    for example:
    Let's say I have a parameter that displays the following value:
    Red
    Green
    Blue
    In typical scenario I can select one of the values or I can select all of the values then click the View Report button in reporting services.
    I know that this approach is much easier to do if I have an external application like ASP.Net and from there I'll just add report viewer and control the parameters to be passed and then generate the report.
    In the report I added text box that will serve as a hyperlink to refresh report:
    In the Text Box Properties\Action tab. Is it possible to control the selection of values through a custom code(SSRS Custom Code) then the report will be automatically refreshed?
    thanks,
    Joefer

    Not sure about doing a multiple selection. But you can pop up an input box to get the input on the fly.
    Add the below custom code and expression for the above parameter
    Public function Getparamvalue() AS STRING
    Dim x as STRING
    x = InputBox("Enter Red / Blue / Green")
    Return(x)
    End function
    =Code.Getparamvalue()

  • Custom code dll as a data source for an SSRS report

    I'm trying to create a report which relies on using some custom code written in VB.net. I am using the custom code to access the Server Management Objects SMO API in MSSQL 2012. I am able to supply an MSSQL object name (a database table
    for example)and then return a list of dependant objects using the dependency walker class (stored procedures, triggers, UDF's, other tables etc.) which rely on the parent object if you will. I am able load the results into a dataset in the custom code. My
    question is how can I get that dataset to be consumed as a data source and appear in my report. I've read many articles on how to use scripts to supply values for various report property settings. I just haven't seen an example of using a dll
    to supply a dataset. I am assuming it is possible. Any thoughts or advice would be appreciated. Cheers     

    Hi mdmck,
    According to your description, you want to create an SSRS report with custom code as data source, right?
     To use custom code in Reporting Services, we need to add a reference to your custom assembly, create a new CodeGroup for your custom assembly, and then grant full trust permissions. For detail information, please refer to the following steps:
    Open the report that will reference the custom assembly.
    On the Report menu, click Report Properties.
    In the Report Properties dialog box, click the References tab.
    Under References, click the ellipsis (...) button that is next to the Assembly name column header.
    In the Add References dialog box, click Browse.
    Locate and then click the custom assembly. Click Open.
    In the Add References dialog box, click OK.
    In the Report Properties dialog box, click OK.
    If the custom assembly requires more permissions than the default Execution level permissions, we need to create a new CodeGroup for your custom assembly, and then grant full trust permissions.
    Here are relevant threads you can reference:
    https://social.technet.microsoft.com/Forums/en-US/c297bddc-c33c-4386-b284-41c1d87f37c6/custom-dlls-in-ssrs-reports?forum=sqlreportingservices
    https://social.technet.microsoft.com/Forums/en-US/27de3f46-5174-480d-b4d1-5e32772dae35/ssrs-2005-custom-code-shared-data-source-connection-string?forum=sqlreportingservices
    For more information about How to use custom assemblies or embedded code in Reporting Services, please refer to the following document:
    https://support.microsoft.com/kb/920769?
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    If you have any feedback on our support, please click
    here.
    Wendy Fu
    TechNet Community Support

  • SSRS 2005 report: Cannot bulk load Operating system error code 5(Access is denied.)

    I built a SSRS 2005 report, which calls a stored proc on SQL Server 2005. The proc contains following code:
    CREATE TABLE #promo (promo VARCHAR(1000))
    BULK
    INSERT #promo
    FROM '\\aseposretail\c$\nz\promo_names.txt'
    WITH
    --FIELDTERMINATOR = '',
    ROWTERMINATOR = '\n'
    SELECT * from #promo
    It's ok when I manually execute the proc in SSMS.
    When I try to run the report from BIDS I got following error:
    *Cannot bulk load because the file "\aseposretail\c$\nz\promo_names.txt" could not be opened. Operating system error code 5(Access is denied.).*
    Note: I have gooled a bit and see many questions on this but they are not relevant because I CAN run the code no problem in SSMS. It's the SSRS having the issue. I know little about the security of SSRS.

    I'm having the same type of issue.  I can bulk load the same file into the same table on the same server using the same login on one workstation, but not on another.  I get this error:
    Msg 4861, Level 16, State 1, Line 1
    Cannot bulk load because the file "\\xxx\abc.txt" could not be opened. Operating system error code 5(Access is denied.).
    I've checked SQL client versions and they are the same, I've also set the client connection to TCP/IP only in the SQL Server Configuration Manager.  Still this one workstation is getting the error.  Since the same login is being used on both workstations and it works on one  but not the other, the issue is not a permissions issue.  I can also have another user login into the bad workstation and have the bulk load fail, but when they log into their regular workstation it works fine.  Any ideas on what the client configuration issue is?  These are the version numbers for Management Studio:
    Microsoft SQL Server Management Studio 9.00.3042.00
    Microsoft Analysis Services Client Tools 2005.090.3042.00
    Microsoft Data Access Components (MDAC) 2000.085.1132.00 (xpsp.080413-0852)
    Microsoft MSXML 2.6 3.0 5.0 6.0
    Microsoft Internet Explorer 6.0.2900.5512
    Microsoft .NET Framework 2.0.50727.1433
    Operating System 5.1.2600
    Thanks,
    MWise

  • SSRS custom code for count in Report Footer

    Hi All,
    Please help me with the custom code used for below requirement
    Debtor Name     current    30+days   60+days    90+days
    aaa                       7000        0.00          0.00          10.00
    bbb                       5000        0.00         20.99         3.00
    ccc                        1000       0.00          0.00           0.00
    Expected result in report footer :                  
                                              0                1            
       2
    if  the value of  30+ , 60+ and 90+ columns  >=1 then i have to display the count in Report footer,for that i have tried using a custom code like below :
    Shared Dim OD As Integer=0
    Public Shared Function Test(ByVal OP As Decimal) As Integer
            If OP >= 1 Then
                OD = OD + 1
            Else
                OD = OD
            End If
            Return OD
       End Function
    and using below code to display
    Code.Test(Overdue)  
    but when i use this code in report footer is not displaying correct value.Please guide me where i am going wrong.
    Please let me know if you need any other details.
    Thanks in advance,
    Samhith.

    Hi Samhith,
    Per my understanding you what to count the rows which values >=1 and display them at the bottom of the table, you are trying to use the custom code to do this but failed, right?
    I have tested in my local environment and find the custom code is not correctly, and I have an alternative method which is more easy and can work in both table  and matrix.
    As Vaibhav Chaudhari also mentioned that we can use the CountDistinct function, but more correctly, we can use the count() function and the RunningValue() function, because CountDistict will not count the duplicated values if they >=1.
    Please find the expression as below:
    =Count(IIf(Fields!Yourfield.Value>=1 , Fields!Yourfield.Value, Nothing))
    OR:
    =RunningValue(IIf(Fields!Yourfield.Value>=1 , 1, Nothing),Sum,"DataSetName")
    If you still have any problem, please feel free to ask.
    Regards
    Vicky Liu

  • SSRS Custom Code Error There is an error on line 0 of custom code: [BC30205] End of statement expected.

    I am receiving this error with the following code, which counts the number of work days between two parameters and I don't see the problem. Please help.
    Public Function GetDateCount(ByVal StartDate AS DateTime, ByVal EndDate AS DateTime) AS Integer
    Dim TempVal AS Integer
    DimTotalDays AS Integer
    TotalDays = 0
    TempVal = DateDiff(DateInterval.Day, StartDate, EndDate) + 1
    for I as Integer = 1 to TempVal
    If(StartDate.DayOfWeek.ToString() <> "Sunday" AND StartDate.DayOfWeek.ToString() <> "Saturday") Then
    TotalDays = TotalDays +1
    End If
    StartDate = DateAdd(DateInterval.day, 1, StartDate)
    Next
    Return TotalDays
    End Function

    Hi CNet Vase,
    According to your description, you want to use custom code to count the number of work days between two parameters in the report, but when you run the report, an error occurs.
    I reproduced the issue in my environment, the error message: ‘DimTotalDays’ is not declared. The error is caused by there is no space between Dim and variable TotalDays, so the system regards it as a unit. To fix this issue, please type
    space behind the word Dim like below:
    Dim TotalDays AS Integer
    If there is any misunderstanding , please feel free to let me know.
    Best Regards, 
    Wendy Fu

  • SSRS Custom code

    Can we call custom code in parent report, which written in the subreport
    Thanks in advance

    Can we call custom code in parent report, which written in the subreport??
    Example :
    i have written code in subreport as follows 
    This can call it on parent report as "code.EmbeddedFunction()"
    Thanks in advance

  • SSRS Running Totals Custom Code

    I have a report in which I need to total a column with an expression and created simple code to have a running total.  When I run the report through report builder, the total only reflects the current page (it is 6 pages long) but if I export the report
    out to Excel, the total is correct.
    Below is the code:
    Public running_roy as Double = 0
    Public Function roy_tot(ByVal cust_type, ByVal roy, ByVal ret_value) as Double
    Dim temp_var as Double
    if cust_type = 0 then
    running_roy = running_roy + roy
    if ret_value = 0 then
    temp_var = roy
    else
    temp_var = running_roy
    end if
    ELSE
    temp_var = 0
    end if
    return temp_var
    End Function
    If I change the Public variable to "Public Shared" the totals change as I flip back and forth between the pages in report builder.
    Any suggestions?

    Hello alan2624,
    Thanks for your clarification.
    In the report, the custom code will be compiled as a class before it is used. Every time the page is loaded, the class on the page will be initialized. The un-shared (non-static) instance will be reset. Therefore, you will see the value is reset back to
    zero if the public variable is not announced as "Shared". If you announced it as shared, then the variable is on the class level. It will not be changed by instance initializing. In addition, any operations on the variable will be recorded. This is not the
    bug, but it is by design of the VB.net code.
    If you export the report to the Excel, I think it will only generate a single page, and the total value is only the last one. It should be correct. If it is used in the pages in browser, I suggest you need design your code carefully for VB.net design.
    If you have any questions about this issue, please let me know.
    Regards,
    Edward
    Edward Zhu
    TechNet Community Support

  • How to allow custom colors to SSRS Pie-Chart?

    Hi,
     I have a pie-chart in my report.
    Can anybody please tell me How I can allow custom color to each part/slice of the piechart..??or How i can assign cutom pallete to pie-chart?
    BhushanBhushan

    Hi,
    I think u r using one data Field and One category Field in the Graph.
    Then We have use Code Option
    -----Add this in Code
    Private colorPalette As String() = { "Teal", "Gold", "Aqua"}
       Private count As Integer = 0
     Private mapping As New System.Collections.Hashtable()
      Public Function GetColor(ByVal groupingValue As String) As String
            If mapping.ContainsKey(groupingValue) Then
                Return mapping(groupingValue)
            End If
            Dim c As String = colorPalette(count Mod colorPalette.Length)
            count = count + 1
            mapping.Add(groupingValue, c)
            Return c
        End Function
    Finally add this Expression in the Fill Option. And we can add more colors in the Code based on no. of Category
    =Code.GetColor(Category_Field)
     for example =Code.GetColor(Fields!Zone.Value)
    Regards,
    Thiyagu
    I've done everything listed here and in the link provided, but I get an error that reads, "There is an error on line 0 of custom code: [BC30201] Expression expected." I'm using SSRS 2005.
    Does anyone know what this could be?

Maybe you are looking for