Index was outside the bounds of the array. (rsRuntimeErrorInExpression) with Parameters - by dmlenz

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 416371 Comments
Status Closed Workarounds
Type Bug Repros 4
Opened 2/19/2009 10:58:28 AM
Access Restriction Public


1) I believe we have discovered a change in behavior with Reporting Services 2008 that I haven't seen previously (2000, 2005).

We have a parameter, we'll call this @SearchValue will accept text to search for.
The second parameter @SearchResult, has data populated from a data set.  It also has the default values populated from that same data set (single value).

When we type in a valid search value, the @SearchResult drop down has valid values in it.  However, when we enter search criteria that results in now rows returned for our data set, we see the following error message:

"An error has occurred during report processing. (rsProcessingAborted) 
The Value expression for the query parameter ‘@SearchResult’ contains an error: Index was outside the bounds of the array. (rsRuntimeErrorInExpression) "

I believe this is a bug.  Before, we would get an empty drop down list.  Even if this is intended behavior, why not pop up a messagebox with a friendly message in it?

2) There is possibly another related bug with a similar behavior.  We have a drop down list populated from a data set.  If this drop down list has no values and we try to access the report via querystring (passing in a value on querystring), we used to get (in 2005) "value required for parameter: x", but now we get the same error about index outside the bounds of the array.

Thank you,


Sign in to post a comment.
Posted by nuclear on 10/20/2011 at 4:57 AM

This also causes the following to give the Index was outside the bounds of the array error if the "parameter2=" string is not present in the original StringParameter even though I try to check for that...
It is as if the true part is ran before the IIf is evaluated

=IIf( InStr
    (Parameters!StringParameter.Value, "parameter2=" , CompareMethod.Text) > 0,
        IIf( Filter
                (Parameters!StringParameter.Value, ",")
            ,"parameter2=",true, CompareMethod.Text
             <> "", "there", "emptyFilter"
    , "blankStart"

The following works fine:

=IIf( InStr(Parameters!StringParameter.Value, "parameter2=" , CompareMethod.Text) > 0, "there", "blank")

I hope it helps someone else...
Posted by Max The Data Analyst on 10/28/2010 at 11:21 AM
i have also encountered the same issue. I was trying to install SQLH2Repository on SSRS 2008. I have installed all the required objects on my server, created required data source on Report manger and made proper connections. at last when i tried to run the reports i got this error.

An error occurred during client rendering.
An error has occurred during report processing.
The Value expression for the query parameter ‘@srv_id’ contains an error: Index was outside the bounds of the array.

Your guidelines will be appriciated.

Posted by Lucas Ferguson on 5/5/2010 at 9:04 PM
Hi There,
Is there a hot fix for this issue or is it fixed in R2?
Posted by Microsoft on 3/10/2009 at 3:42 PM
Thanks for reporting this and providing the excellent repro. I've been able to confirm that this is a bug in RS 2008 caused by a parameter DefaultValues list bound to a query that returns zero rows. Unfortunatly, the only workaround would be to ensure the DefaultValues list always has at least one item. The good news is that this should be fixed in the next version of RS.

Posted by dmlenz on 2/26/2009 at 10:47 AM
I added one more attachment. The previous attachment might not work if you don't have code access setup for the custom code area. This one should be clean enough for and out of the box installation to work.
Posted by dmlenz on 2/26/2009 at 9:06 AM
I have attached a rdl file that replicates this behavior. This may be related to parameters not refreshing properly if they are nested more than one deep. 2005 didn't give an error, it just had an empty drop down.

To duplicate the error:
1) Open the report, change the connection string to any mssql server
2) type the number 1 in the search for, the parameter refresh appropriately
3) Now, if you change the search type to "reference", the error appears.
Posted by Microsoft on 2/24/2009 at 4:15 PM

Thanks for reporting this. Can you please attach an RDL file that reproduces this issue? We will investigate once we receive the RDL.

Many thanks,
Chris B.