Index was outside the bounds of the array

Anonymous
2021-12-06T17:14:38.913+00:00

Using Report Builder v15.0.19611.0.
Getting "Index was outside the bounds of the array" errors when attempting to upload the .rdl file to the SSRS Server.

Microsoft SQL Server 2017 Reporting Services - 14.0.600.1763 (x64)
Microsoft SQL Server 2017 - Database Server - 14.0.3421.10 (x64)

Index was outside the bounds of the array.

RSPortal!reportserverwebapp!RSPortal.exe!3d!12/01/2021-21:06:18:: e ERROR: OData exception occurred: System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: An unexpected error occurred in Report Processing. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Microsoft.ReportingServices.Library.ReportingService2005Impl.SetReportDefinition(String Report, Byte[] Definition, Guid batchId, Warning[]& Warnings)
at Microsoft.ReportingServices.Library.ReportingService2005Impl.SetReportDefinition(String Report, Byte[] Definition, Warning[]& Warnings)
at Microsoft.ReportingServices.Library.ReportingService2010Impl.SetItemDefinition(String ItemPath, Byte[] Definition, String expectedItemTypeName, Property[] Properties, Warning[]& Warnings)
at Microsoft.ReportingServices.WebServer.ReportingService2010.SetItemDefinition(String ItemPath, Byte[] Definition, Property[] Properties, Warning[]& Warnings)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.SqlServer.ReportingServices2010.ReportingService2010.SetItemDefinition(String ItemPath, Byte[] Definition, Property[] Properties)
at Microsoft.SqlServer.ReportingServices2010.RSConnection2010.SoapMethodWrapper1.ExecuteMethod(Boolean setConnectionProtocol) at Microsoft.SqlServer.ReportingServices2010.RSConnection2010.SetItemDefinition(String itemPath, Byte[] definition, Property[] properties) at Microsoft.ReportingServices.Portal.Services.SoapProxy.SoapAuthenticationHelper.ExecuteWithWindowsAuth[TReturn](SoapHttpClientProtocol soapClient, IPrincipal userPrincipal, Func1 func)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemRepository.UpdateReport(IPrincipal userPrincipal, String origItemPath, Report item, Boolean renameOrMove, String[] delta)
at Microsoft.ReportingServices.Portal.Repositories.CatalogItemRepository.Update(IPrincipal userPrincipal, String origItemPath, CatalogItem catalogItem, String[] delta)
at Microsoft.ReportingServices.Portal.ODataWebApi.V2.Controllers.CatalogItemsController.PutEntity(String key, CatalogItem entity)
at Microsoft.ReportingServices.Portal.ODataWebApi.Controllers.Reflection.EntitySetReflectionODataController1.Put(ODataPath oDataPath, T value) at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---

From what I can tell, SSRS does not like the IF statements when I try to upload the report from a Report Builder session.

Need assistance with converting IF block/blocks to CASE statements:

declare @startDate as datetime
declare @endDate as datetime

declare @currentMonth int

select @currentMonth = datepart(mm, getdate())

--Show the current last week for the month.
if @wkStartDate is null and @wkEndDate is null
begin
if @currentMonth = @monthName
begin
select @startDate = DATEADD(wk, 0, DATEADD(wk, DATEDIFF(wk, 0,getdate()), -2))
select @endDate = dateadd(dd, 6, @startDate)
end
--Show the last week of the month that was choosen.
if @currentMonth <> @monthName
begin
select @endDate = max(TheDate) from hlxlookup.dbo.Lookup_date_calendar where datepart(yyyy, TheDate) = @year AND DATEPART(mm, TheDate) = @monthName
select @startDate = TheDate from hlxlookup.dbo.Lookup_date_calendar where TheDate < @endDate and TheDayOfWeek = 7
end
end

else
begin
select @startDate = @wkStartDate
select @endDate = @wkEndDate
end

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,928 questions
0 comments No comments
{count} votes

Accepted answer
  1. Anonymous
    2021-12-07T14:09:23.46+00:00

    I was able to revert back to an earlier version of Report Builder (v15.0.900.71), make the needed changes to the .RDL file and upload successfully to the Report Server.

    Which can be found here, for those that may need it:

    https://web.archive.org/web/20200803202838/https://download.microsoft.com/download/5/E/B/5EB40744-DC0A-47C0-8B0A-1830E74D3C23/ReportBuilder.msi

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Isabellaz-1451 3,616 Reputation points
    2021-12-07T02:12:21.027+00:00

    Hi @Anonymous

    The exception that is thrown when an attempt is made to access an element of an array or collection with an index that is outside its bounds. An IndexOutOfRangeException exception is thrown when an invalid index is used to access a member of an array or a collection, or to read or write from a particular location in a buffer.

    I refer to the thread:https://learn.microsoft.com/en-us/dotnet/api/system.indexoutofrangeexception?view=net-6.0

    And the statement you paste,what does it used for ,is it a dataset ? Can you paste all your statement ,for the statement I tested on my report builder ,It can‘t work.

    Best Regards,
    Isabella


    If the answer is the right solution, please click "Accept Answer" and upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.