SSRS Custom code - Exception when uploading thru Epicor

Hello Epi gurus,

Trying to upload SSRS report thru Epicor , Report style but I get the following error when doing so. Please help. Also I had to add a reference to System.Core

image

Dim values As New System.Collections.Generic.Dictionary(Of Decimal, Decimal)

Function AddValue(newValue As Decimal) As Decimal
If Not values.ContainsKey(newValue) Then
values.Add(newValue,newValue)
Else
values.item(newValue) = newValue
End If
End Function

Function GetMedian() As Double
Dim count As Integer = values.Count
If count = 0 Then
Return 0
Else
dim keys as New System.Collections.Generic.List(Of Decimal) = System.Linq.Enumerable.ToList(values.Keys)

If count Mod 2 = 1 Then
Return keys(CInt((count / 2) - 0.5))
Else
Dim index1 As Integer = count \ 2
Dim index2 As Integer = index1 - 1

Dim value1, value2 As Decimal
value1 = keys(index1)
value2 = keys(index2)

Return (value1 + value2) / 2
End If
End If
End Function

Application Error

Exception caught in: Epicor.ServiceModel

Error Detail

Message: There is an error on line 15 of custom code: [BC30311] Value of type ‘System.Collections.Generic.List(Of TKey)’ cannot be converted to ‘System.Collections.Generic.List(Of Decimal)’.
Program: Epicor.ServiceModel.dll
Method: ShouldRethrowNonRetryableException

Client Stack Trace

at Epicor.ServiceModel.Channels.ImplBase`1.ShouldRethrowNonRetryableException(Exception ex, DataSet dataSets)
at Ice.Proxy.BO.ReportImpl.ImportSsrsReports(DataSet reports)
at Erp.UI.App.ReportEntry.SsrsTransfer.UploadReports(String clientDirectory, String reportLocations)
at Erp.UI.App.ReportEntry.ReportForm.UploadSsrsReport()
at Erp.UI.App.ReportEntry.ReportForm.OnClickMiscTool(String ToolKey)
at Ice.Lib.Framework.EpiBaseForm.handleToolClick(String tKey, ToolClickEventArgs ea)

Why do you have to convert the values.Keys into a list?

Have you tried this instead?

I just want to prevent the list from adding duplicate values , that’s why I am using a dictionary. Then I want to sort the keys to get it in order.

In additional , I don’t even call any function inside the report, just by having that line of code it breaks.

Thanks a lot for the link I’ll take a look.