I'd like to display a string without the last 2 chars in a text field in Reporting Services 2005 vs2005. I tried several ways and if the string is empty or null I get an error: rsRuntimeErrorInExpression - The value expression for the textbox contains an error: Argument 'Length' must be greater or equal to zero.
Here are the ways I tried: IIF(trim(Fields!kuku.Value) = "","", Left(Fields!kuku.Value, Len(Fields!kuku.Value) - 2))
IIF(IsNothing(Fields!kuku.Value) and Len(Fields!kuku.Value) = 0,"",Left(Fields!kuku.Value, Len(Fields!kuku.Value) - 2))
IIF(IsNothing(Fields!kuku.Value) ,"",Left(Fields!kuku.Value, Len(Fields!kuku.Value) - 2))
IIF(Len(Fields!kuku.Value) = 0,"",Left(Fields!kuku.Value, Len(Fields!kuku.Value) - 2))
Any ideas as to what I'm doing wrong? Thanks in advance.
how about changing the dataset on that field to use isnull(field,", ") that way you can always safely trim 2 characters.
or
IIF(IsNothing(Fields!kuku.Value) OR Len(Fields!kuku.Value) < 2,"",Left(Fields!kuku.Value, Len(Fields!kuku.Value) - 2))
note the and changed to an OR. And just in case the length is 1 changed =0 to <2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With