SSRS 2008 R2 如果为空则删除空格

发布于 2024-11-16 03:06:22 字数 431 浏览 9 评论 0原文

我有一个简单的 SQL Server 2008 R2 报告,其中包含一个包含几个字段的文本框。如果字段的值为空,我想抑制该行。该表达式的语法是什么?

所以我的字段是...

Name
AddressLine1
AddressLine2
AddressLine3
CityStateZip

并且我有这样的表达式...

=First(Fields!AddressLine2.Value, "dsPersonData")

我正在尝试下面的表达式但出现错误

=IIF(Fields!AddressLine2.Value, "",True,False)

换句话说,如果该值是空字符串,我试图将可见性设置为 false 但我不确定语法是什么。

I have a simple SQL Server 2008 R2 report with a textbox containing a few fields. I want to suppress the line if the value of a field is null. What would be the syntax for the expression?

So my fields are...

Name
AddressLine1
AddressLine2
AddressLine3
CityStateZip

and I have expressions like this...

=First(Fields!AddressLine2.Value, "dsPersonData")

I was trying the expression below but getting errors

=IIF(Fields!AddressLine2.Value, "",True,False)

In other words I was trying to set the visibility to false if the value was an empty string but I'm not sure what the syntax would be.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

把回忆走一遍 2024-11-23 03:06:22

你可以尝试

=IIF(First(Fields!AddressLine2.Value, "dsPersonData") is Nothing ,False,True)

you can try

=IIF(First(Fields!AddressLine2.Value, "dsPersonData") is Nothing ,False,True)
暮凉 2024-11-23 03:06:22

在 sql 查询中很容易做到这一点,例如:

在 SQL Server 中:

ISNULL(Name, '') as Name
ISNULL(AdressLine1, '') 作为 AdressLine1
ISNULL(AdressLine2, '') 作为 AdressLine2
ISNULL(AdressLine3, '') 作为 AdressLine3
ISNULL(CityStateZip, '') as CityStateZip

如果要将可见性设置为 false:
=IIF(First(Fields!AddressLine2.Value, "dsPersonData") = "",False,True)

Is easy to do this in the sql query, For example:

in SQL Server:

ISNULL(Name, '') as Name
ISNULL(AdressLine1, '') as AdressLine1
ISNULL(AdressLine2, '') as AdressLine2
ISNULL(AdressLine3, '') as AdressLine3
ISNULL(CityStateZip, '') as CityStateZip

and if you want to set the visibility to false:
=IIF(First(Fields!AddressLine2.Value, "dsPersonData") = "",False,True)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文