SQL Server 2008 报告服务

发布于 2024-11-09 10:55:51 字数 673 浏览 0 评论 0原文

我正在尝试生成矩阵报告。我有一个 SSN 行和一个 3 位数代码列。 3 位代码随机插入整个报告的单元格中,每行一个。我想让它们全部显示在一列中。我已经尝试过......

=Iif(IsNothing(Fields!CODE.Value),"The Field Is Null",Fields!CODE.Value)

但这只是显示“该字段为空”。我希望注释显示为...

=Iif(IsNothing(Fields!CODE.Value),"",Fields!CODE.Value)

但将空单元格本身排除在外。有人知道解决这个问题的技巧吗?

结果看起来像这样......

ssn          code
123456789    123
123456789    123
and so on

我的矩阵结构看起来像这样...... 在此处输入图像描述

并且 Exp 现在设置为 =Iif(IsNothing(Fields!ID5.Value),"The Field为 Null",Fields!ID5.Value) 注意:ID5 只是一个快速命名约定。 ID5对应代码。 ID2 对应于 SSN。

I'm trying to generate a matrix report. I have an SSN row and a 3 digit code column. The 3 digit codes are randomly inserted into cells through out the report, one per row. I would like to have them display all in one column. I have tried...

=Iif(IsNothing(Fields!CODE.Value),"The Field Is Null",Fields!CODE.Value)

But this just displays "The Field is Null". I want noting displayed as in...

=Iif(IsNothing(Fields!CODE.Value),"",Fields!CODE.Value)

But have the null cells themselves excluded. Anyone know a trick to pull this off?

the result would look like this...

ssn          code
123456789    123
123456789    123
and so on

My matrix structure looks like this...
enter image description here

and the Exp is now set to =Iif(IsNothing(Fields!ID5.Value),"The Field Is Null",Fields!ID5.Value)
Note: The ID5 is just a quick nameing convention. ID5 corresponds to the code. ID2 corresponds to the SSN.

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

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

发布评论

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

评论(1

許願樹丅啲祈禱 2024-11-16 10:55:51

基本上,您想将几列压缩为一列(不包括空列)?

也许最简单的方法是在查询中执行此操作:

SELECT SSN, IsNull(Code1, '') + IsNull(Code2, '') + IsNull(Code3, '') AS Code
FROM MyTable

或者,在 Reporting Services 中的表达式中执行此操作:

=IIF(IsNothing(Fields!Code1.Value), "", Fields!Code1.Value) + IIF(IsNothing(Fields!Code2.Value), "", Fields!Code2.Value)

等等...

Basically, you want to compress several columns into one column excluding the null columns?

Probably the easiest way is to do it in the query:

SELECT SSN, IsNull(Code1, '') + IsNull(Code2, '') + IsNull(Code3, '') AS Code
FROM MyTable

Alternatively, do it in the expression in Reporting Services:

=IIF(IsNothing(Fields!Code1.Value), "", Fields!Code1.Value) + IIF(IsNothing(Fields!Code2.Value), "", Fields!Code2.Value)

and so on...

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