一行中的多个 SSRS IIF 语句

Multiple SSRS IIF statement on one line

我有一份报告,我需要在一个查询中完成 3 个任务。

=IIF (Fields!Name.Value = " "," ", & vbcrlf & Name)

=IIF (Fields!Lastname.Value="" ," ", & vbcrlf & lastname)

=IIF(Fields!Middle.Value = " "," ", & vbcrlf & Middle)

所以我想做的是 运行 在一行中进行这些查询,在不同的行中输出姓名、姓氏和中间名

=IIF(Fields!Name.Value is nothing," ", & vbcrlf & Name, IIF(Fields!Lastname.Value is nothing," ", & vbcrlf & lastname), IIF(Fields!Middle.Value is nothing," ", & vbcrlf & Middle))

好像没有运行,它只是打印 False。

有人可以帮忙吗?谢谢

这应该有效...

=IIF(LEN(Fields!FirstName.Value) = 0 , "", Fields!FirstName.Value + vbcrlf )
+ IIF(LEN(Fields!MiddleName.Value) = 0 , "", Fields!MiddleName.Value + vbcrlf )
+ IIF(LEN(Fields!LastName.Value) = 0 , "", Fields!LastName.Value )

这是一些包含结果的示例数据。它包括 NULL 和空字符串的名称,并通过测试字段的长度来处理两者。

如果你想要空行,那么它总是 returns 3 行,然后将 + vbcrlf 移到每行的右括号之外。