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

Similar Messages

  • Error when upload Crystal report files to CMC

    hi All,
    i having an error when trying to upload a Crystal report files to CMC, the msg appears below :
    Unable to find servers in CMS obt-sg-a1mgr.obtechglobal.com:6400 and cluster @obt-sg-a1mgr:6400 with kind fileserver and service FileStoreV2. All such servers could be down or disabled by the administrator. (FWM 01014)
    any help would be appreciated, thanks.
    Regards
    Hariyono

    Hi
    can you please go to the CMC under Servers and check the status of your file repository servers? Are they enabled and in status running ?
    Regards,
    Stratos

  • Error when uploading file : Return code = 6 in LSMW

    Hello All,
    Getting the bleow mentioned error in LSMW.
    Error when uploading file Return code = 6 )
    Is it related to access. please suggest.

    did you define the file in step 7 without any error and allocate in step 8 without any error before? 
    I mean in the same system where you execute the read step.
    Make sure you have the file not open when you execute the read step.

  • Error when uploading file :( Return code = 6 )

    Hello All,
    Getting the bleow mentioned error in LSMW.
    Error when uploading file Return code = 6 )
    Is it related to access. please suggest.

    Hi,
    If the Sy-Subrc is 0 then Success,
             Sy-SUBRC is 4 then failure,
             Sy-SUBRC = 6 then the user might be not access to read the file.
    This is due to authorization issue.

  • 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.

  • Experiencing "timed out" error when uploading podcast

    I am experiencing a "timed out" error when uploading a podcast to iTunes. Using PC. I've updated iTunes...

    - You really need to ask the Basis team to extend the maximum run time for background processes (30 mins is too short).
    - You can also try to reduce the run time by setting up BOM Buffering in configuration so if the same BOM is used again and again (in your case of delete and recreate planned order, yes), it will read from memory.
    - You should set the planning horizon and use NETPL (net change in planning horizon) in daily run.  So that the run will only find the relevant changes in order proposal up to certain days, thus reduce run time.
    - You should discuss with your BASIS team about the list of background job in the batch windows.  Specify time in such a way that the performance-critical job (i.e., MRP, reschedule sales order, certain customized report, etc.) doesn't run at the same time.
    - You can increase the number of parallel processes to issue several jobs to run MRP at the same time.
    Rgrds,

  • Can anyone list problems/errors when uploading data using BDC's and BAPI's?

    Can anyone list the problems/errors when uploading data using BDC's and BAPI's?

    Hi,
    If you are actually creating a BDC to load data pls be more specific.
    Data format incorrect. Tab delimited/ etc
    Dates in wrong formats
    Currency incorrect formats
    Missing screens
    Wrong transaction code
    File not found,
    Missing Mandatory fields,
    Screen resoultion.
    You should always use refresh for your Bdcdata table.
    Loop at internal table.
    refresh Bdcdata.
    regards,
    sowjanya.

  • 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.

  • Good morning, my photoshop stopped working, it gives error when started, what can it be?  This is the message that appears: Unable to start the program it took a unexpected end of file  I hope answer

    Good morning, my photoshop stopped working, it gives error when started, what can it be?
    This is the message that appears:
    Unable to start the program it took a unexpected end of file
    I hope answer

    Could not initialize Photoshop because an unexpected end-of-file was encountered. | Mylenium's Error Code Database
    Mylenium

  • I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    I am getting a error IO when trying to upload multiple images within wordpress using the flash uploader. I do not get the error when uploading using explorer. The error only appears if I try uploading using firefox....any ideas?

    Logged the call with SAP who directed me to 'Define settings for attachments' in IMG and setting the 'Deactivate Java Applet' & 'Deactivate Attachment versioning' checkboxes - problem solved.

  • SSRS 2008 R2 rendering error when executing a report

    The value '1' is invalid. Valid values are between '0' and '1'. (rrRenderingError)
    I am receiving the above error when running the report in SSRS 2008 R2. It has run find in the 2005 version. After research, I read that this issue caused by tablix split on a new page or something. However, I have not found anything to be the resolution. I
    installed the latest hotfix that I thought addressed this issue but still not working. Any suggestions outside of touching the report?Sonya

    The value '1' is invalid. Valid values are between '0' and '1'. (rrRenderingError)
    I am receiving the above error when running the report in SSRS 2008 R2. It has run find in the 2005 version. After research, I read that this issue caused by tablix split on a new page or something. However, I have not found anything to be the resolution. I
    installed the latest hotfix that I thought addressed this issue but still not working. Any suggestions outside of touching the report?
    Sonya
    We too are encountering this problem with reports migrated from 2005 to 2008. We are getting the rendering error only when trying to use the paging controls to navigate forward through the report. This is on SSRS 2008 R2 running SharePoint Integration. When
    the result set is empty we get the tablix errors mentioned instead. The reports ran fine prior to migration to SSRS2008.

  • Outlook 2010 gives error when opening a PowerPoint attachment.

    Outlook 2010 gives error when opening a PowerPoint attachment. 
    Hi All,
    We have several VIP employees that are getting the following error on all PowerPoint documents that come as attachments from Outlook.
    I have researched and tried the following steps and verified these settings are already applied.
    I did find a work around but not a fix and our security team will NOT allow me to change this setting however if I uncheck the setting all employees can open the outlook attachment.
    Any other ideas on a fix for this if I am unable to uncheck Enable Protected View.

    Hi Matthew,
    This is a perennial problem, here is a thread which has a deep discussion about this issue:
    http://social.technet.microsoft.com/Forums/office/en-US/07f710a5-a6ca-4256-8f27-6aac41a6b37e/outlook-2010-unable-to-open-word-excel-and-power-point-attachments-from-an-email?forum=outlook
    It looks like nobady really find a solution there, the only workaround is what you have found - change the protected view setting in Trust Center. You will lose some security by doing this but it seems to be the only solid solution currently.

  • No suitable driver error when upload a pdf

    We are going to develop our own packaging tool which can provide convenient service for   Adobe Content Server.
    Before we begin on this project, we use the java sample console program which is called UploadTest to find out
    how to interact with Adobe Content Server.
    However, when we use the  UploadTest jar tool to package a PDF to Adobe Content Server and send our request
    successfully, the server always response a error as below with “httpStatus:200 " and “contentType:application/vnd.adobe.adept+xml”:
    <error xmlns="http://ns.adobe.com/adept" data="E_PACK_DATABASE http://192.168.34.56:8080/packaging/Package
    No%20suitable%20driver"/>
    Other details:
    (1)I am in Guangzhou China now ,but the server is  in the charge of our USA Team in American.
    (2)The commandline we use:
    java -Xmx1024M -jar UploadTest-1_2.jar http://our website/packaging/Package PdfFilePath -pass password.
    Who can help me?Why do the error arise? Do I need some other steps to make? Waiting for help online .Thank you very much!

    Thank you for helping us to catch the error.
    2012/12/13 Jim_Lester <[email protected]>
       Re: no suitable driver error when upload a pdf  created by Jim_Lester<http://forums.adobe.com/people/Jim_Lester>in
    Adobe Content Server - View the full discussion<http://forums.adobe.com/message/4918463#4918463

  • 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

  • Workflow status web part gives error when going back to previous stage (using GO TO) in Project Server 2013 workflow

    Hi,
    Workflow status web part gives error when going back to previous stage (using GO TO) transition activity  in Project Server 2013 workflow.
    Please guide how to create a workflow which restarts from a desired stage.

    Thanks for your prompt reply....
    It gives following error
    Workflow Status
    This Web Part was unable to load.
    Information that may be useful in solving this problem was written to the Unified Logging Service (ULS) log on the Project Web App with the following ID: e95a9c9c-1f68-90d7-0a3e-5951df70fec6
    For more information, contact your Project Web App administrator.
    what do you mean to restart the Project Server 2013 with different project name, please elaborate....

Maybe you are looking for