RDLC报告隐藏空列

时间:2018-06-04 15:53:03

标签: c# rdlc

我有一个带有列的Tablix,我添加了这个表达式以显示此列中的数据:

=Fields!PhoneNumber.Value & System.Environment.NewLine & Fields!Email.Value & System.Environment.NewLine & Fields!Address.Value

我想要的是当一个或多个字段(PhoneNumber,Email,Address)为空时,表达式仅显示非空字段并且不显示新行

怎么做?

1 个答案:

答案 0 :(得分:1)

why not throw-in IIF() to only add the new line IF a value is present

    =iif( string.IsNullOrWhiteSpace( Fields!PhoneNumber.Value ), '', Fields!PhoneNumber.Value & System.Environment.NewLine ) 
& iif( string.IsNullOrWhiteSpace( Fields!EMail.Value ), '', Fields!Email.Value & System.Environment.NewLine )  & Fields!Address.Value

Could get lengthy though.