SSRS 在 TextBox 中使用 vbcrlf 连接字段需要排除空白 return 行
SSRS using vbcrlf in TextBox to Concatenate field need exclude blank return line
我已经创建了一个 SSRS 报告来打印每个地址。
我正在使用 vbcrlf 将多个字段连接到一个文本框中。
在某些情况下,连接中带有的字段之一可能为空。如果是这种情况,返回的行会在我的文本框中创建一个空行。
有没有办法去除空白换行符?
=Fields!SOP10200_ADDRESS1.Value & vbcrlf & Fields!SOP10200_ADDRESS2.Value & vbcrlf & TRIM(Fields!SOP10200_CITY.Value) & "," & TRIM(Fields!SOP10200_STATE.Value) & " " & TRIM(Fields!SOP10200_ZIPCODE.Value)
预期结果:
4349 Green Ash Dr.
Earth City,MO 63045
实际结果:
4349 Green Ash Dr.
Earth City,MO 63045
我将添加一个 IIF 语句来检查地址 2 字段以确保它不是 NULL 或空白。如果它是空白或 null,则在 VBCRLF 中留出空白。
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value) OR Fields!SOP10200_ADDRESS2.Value = "", "", VBCRLF)
所以你的表达方式是
=Fields!SOP10200_ADDRESS1.Value & vbcrlf &
Fields!SOP10200_ADDRESS2.Value &
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value)
OR Fields!SOP10200_ADDRESS2.Value = "", "", VBCRLF) &
TRIM(Fields!SOP10200_CITY.Value) & "," &
TRIM(Fields!SOP10200_STATE.Value) & " " &
TRIM(Fields!SOP10200_ZIPCODE.Value)
谢谢汉诺威。我不得不稍微改变一下,然后它起作用了!
=Fields!SOP10200_ADDRESS1.Value & vbcrlf &
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value)
OR Fields!SOP10200_ADDRESS2.Value = "",vbcrlf,"")
& TRIM(Fields!SOP10200_CITY.Value) & "," & TRIM(Fields!SOP10200_STATE.Value)
& " " & TRIM(Fields!SOP10200_ZIPCODE.Value)
我已经创建了一个 SSRS 报告来打印每个地址。
我正在使用 vbcrlf 将多个字段连接到一个文本框中。
在某些情况下,连接中带有的字段之一可能为空。如果是这种情况,返回的行会在我的文本框中创建一个空行。
有没有办法去除空白换行符?
=Fields!SOP10200_ADDRESS1.Value & vbcrlf & Fields!SOP10200_ADDRESS2.Value & vbcrlf & TRIM(Fields!SOP10200_CITY.Value) & "," & TRIM(Fields!SOP10200_STATE.Value) & " " & TRIM(Fields!SOP10200_ZIPCODE.Value)
预期结果:
4349 Green Ash Dr.
Earth City,MO 63045
实际结果:
4349 Green Ash Dr.
Earth City,MO 63045
我将添加一个 IIF 语句来检查地址 2 字段以确保它不是 NULL 或空白。如果它是空白或 null,则在 VBCRLF 中留出空白。
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value) OR Fields!SOP10200_ADDRESS2.Value = "", "", VBCRLF)
所以你的表达方式是
=Fields!SOP10200_ADDRESS1.Value & vbcrlf &
Fields!SOP10200_ADDRESS2.Value &
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value)
OR Fields!SOP10200_ADDRESS2.Value = "", "", VBCRLF) &
TRIM(Fields!SOP10200_CITY.Value) & "," &
TRIM(Fields!SOP10200_STATE.Value) & " " &
TRIM(Fields!SOP10200_ZIPCODE.Value)
谢谢汉诺威。我不得不稍微改变一下,然后它起作用了!
=Fields!SOP10200_ADDRESS1.Value & vbcrlf &
IIF(ISNOTHING(Fields!SOP10200_ADDRESS2.Value)
OR Fields!SOP10200_ADDRESS2.Value = "",vbcrlf,"")
& TRIM(Fields!SOP10200_CITY.Value) & "," & TRIM(Fields!SOP10200_STATE.Value)
& " " & TRIM(Fields!SOP10200_ZIPCODE.Value)