SQL Reporting Services Blank String Processing

I want to display a string without the last two characters in a text box in Reporting Services 2005 vs2005. I tried several ways, and if the line is empty or null, I get the error message: rsRuntimeErrorInExpression - the value expression for the text field contains an error: The argument "Length" must be greater than or equal to zero.

This is how 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 on what I'm doing wrong? Thanks in advance.

+3
source share
1 answer

how about changing the dataset in this field to use isnull (field, ",") so you can always trim 2 characters safely.

or

IIF(IsNothing(Fields!kuku.Value) OR Len(Fields!kuku.Value) < 2,"",Left(Fields!kuku.Value, Len(Fields!kuku.Value) - 2))

pay attention to and change to OR. And just in case, length 1 is changed =0to<2

+4
source

Source: https://habr.com/ru/post/1716233/


All Articles