Search code examples
reporting-servicesssrs-2008

The Group expression for the grouping ‘Origin2’ contains an error: Argument 'Length' must be greater or equal to zero. (rsRuntimeErrorInExpression)


I am getting this error every time this report is rendered. I looked at the group expression for this group and it looks like this:

=Trim(Left(Fields!ILS_LS_USER_10.Value,InStr(Fields!ILS_LS_USER_10.Value,"->")-2))

The field ILS_LS_USER_10.Value is: BNST -> USWEOLN

I can't see the error. Can anyone help me diagnose this error, please?


Solution

  • It works if you put the string literal in place of Fields!ILS_LS_USER_10.Value.

    The issue is that it isn't getting the value of the field as a string by default. Use the ToString() method after .Value and it should work, or at least it did on my machine.

    =Trim(Left(Fields!ILS_LS_USER_10.Value.ToString(),InStr(Fields!ILS_LS_USER_10.Value.ToString(),"->")-2))