Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

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

$
0
0

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



Viewing all articles
Browse latest Browse all 10045

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>