首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >:使用表/矩阵向导时不重复单元格值

:使用表/矩阵向导时不重复单元格值
EN

Stack Overflow用户
提问于 2013-07-07 01:32:52
回答 2查看 7.3K关注 0票数 3

我有一个数据集,它显示了一名工人在各种技能上的分数,使用了四种测试类型,以及他们的主管和上级主管。为了节省空间,下面的dataset示例仅供一名员工使用。以下是我的开场白:

代码语言:javascript
运行
复制
Director Supervisor Worker Test Skill Score
Doris Smith Jane Awe Lorina Marc Overall 1: Identifying Support 1
Doris Smith Jane Awe Lorina Marc Test A 1: Identifying Support 4
Doris Smith Jane Awe Lorina Marc Test B 1: Identifying Support 1
Doris Smith Jane Awe Lorina Marc Test C 1: Identifying Support 5
Doris Smith Jane Awe Lorina Marc Overall 2: Tracking the Sequence 3
Doris Smith Jane Awe Lorina Marc Test A 2: Tracking the Sequence 2
Doris Smith Jane Awe Lorina Marc Test B 2: Tracking the Sequence 5
Doris Smith Jane Awe Lorina Marc Test C 2: Tracking the Sequence 5
Doris Smith Jane Awe Lorina Marc Overall 3: Searching for Exceptions 3
Doris Smith Jane Awe Lorina Marc Test A 3: Searching for Exceptions 3
Doris Smith Jane Awe Lorina Marc Test B 3: Searching for Exceptions 3
Doris Smith Jane Awe Lorina Marc Test C 3: Searching for Exceptions 3

我使用表向导或矩阵向导将其输入Server。我必须将技能列移到Score列上,因此技能现在是列。

行组:主管,主管,员工测试专栏组:技能值:分数

我明白了:

代码语言:javascript
运行
复制
Director    Suprviser   Worker  Test    1: Identifying  Support     2: Tracking the Sequence    3: Searching for Exceptions
Doris Smith Jane Awe    Lorina Marc Overal  1   3   3
            Test A  4   2   3
            Test B  1   5   3
            Test C  5   5   3
        Al Vega Overal  5   5   3
            Test A  3   3   2
            Test B  2   4   4
            Test C  5   2   5
        David  Osorio   Overal  1   1   3
            Test A  2   4   2
            Test B  4   5   1
            Test C  2   3   2
    Katie Lewis Ally McIntosh   Overal  1   2   3
            Test A  5   3   4
            Test B  3   3   2
            Test C  1   3   2
        Christina Gooderd   Overal  2   2   1
            Test A  4   4   1
            Test B  5   5   4
            Test C  2   5   4

我需要在每个单元格中有一个值,所以每个组的值都需要重复。所以,我想要的应该是这样:

代码语言:javascript
运行
复制
Director    Suprviser   Worker  Test    1: Identifying  Support     2: Tracking the Sequence    3: Searching for Exceptions
Doris Smith Jane Awe    Lorina Marc Overal  1   3   3
Doris Smith Jane Awe    Lorina Marc Test A  4   2   3
Doris Smith Jane Awe    Lorina Marc Test B  1   5   3
Doris Smith Jane Awe    Lorina Marc Test C  5   5   3
Doris Smith Jane Awe    Al Vega Overal  5   5   3
Doris Smith Jane Awe    Al Vega Test A  3   3   2
Doris Smith Jane Awe    Al Vega Test B  2   4   4
Doris Smith Jane Awe    Al Vega Test C  5   2   5
Doris Smith Jane Awe    David  Osorio   Overal  1   1   3
Doris Smith Jane Awe    David  Osorio   Test A  2   4   2
Doris Smith Jane Awe    David  Osorio   Test B  4   5   1
Doris Smith Jane Awe    David  Osorio   Test C  2   3   2
Doris Smith Katie Lewis Ally McIntosh   Overal  1   2   3
Doris Smith Katie Lewis Ally McIntosh   Test A  5   3   4
Doris Smith Katie Lewis Ally McIntosh   Test B  3   3   2
Doris Smith Katie Lewis Ally McIntosh   Test C  1   3   2
Doris Smith Katie Lewis Christina Gooderd   Overal  2   2   1
Doris Smith Katie Lewis Christina Gooderd   Test A  4   4   1
Doris Smith Katie Lewis Christina Gooderd   Test B  5   5   4
Doris Smith Katie Lewis Christina Gooderd   Test C  2   5   4

如何修复/更改/修改,以便在每个单元格中填充一个值?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-07-07 12:30:47

正如您所看到的,SSRS对行标题单元格的处理方式不同,即将它们扩展到任何子组。

您的报告可能看起来有点像这样:

我强调了分隔报告区域的虚线。此示例报告具有与示例相同的问题:

为了解决这个问题,需要将各种行组值从行标题区域移动到主报表区域。

首先,删除左边的四行-当提示选择删除列仅

您应该只保留技能列。

右击和插入列->外组-左

继续使用插入列左添加列.

拥有足够多的新列后,添加各种分组值。报告应该是这样的:

注意,现在在技能列和测试列之间没有虚线。

现在,将根据需要对每一行重复组值:

票数 10
EN

Stack Overflow用户

发布于 2016-01-08 01:11:22

我有一个类似的问题,但在一个矩阵中,当只有一个行组时,需要在details组级别重复先前的值。为此,我使用了自定义代码。

例如,我的矩阵中有一列名为“群集”。行组字段是一个简单的日期字段。在我的数据集中,我有日期,集群,ResourceType作为字段。我有不同的资源类型值,因此我可以看到与给定资源类型关联的集群拥有数据的日期。我的挑战来自这样一个事实:我的数据集是稀疏的--对于给定的ResourceType值,并不是所有的日期都有值。在我的矩阵中,我最终得到了单元格中没有对应行的行,这些行在基础数据集中没有对应的行。以前的使用效果不佳(很多其他例子)。

为了解决这个问题,我使用了自定义代码和哈希表,如下所示:

代码语言:javascript
运行
复制
Private LastSeenValue as System.Collections.HashTable = New System.Collections.HashTable
' GetRowValue is used to fill in blank cells in the dynamic matrix with the nearest value above them in the same column.
' The data can contain multiple sets according to ResourceType field, and not all dates are present in all of these sets.
' This has the effect on the screen of having blank cells for each given date where there is no corresponding resource type.
' The requirement this function enables is that it allows filling in the blank cells with the nearest real value above.
' The SSRS PreviousRow function does not do this.
' Author:  DanRo, 1/8/2016
'
' Some behavior notes for developers who follow and seek to alter the function.
' The prototype for the GetRowValue function performs "null to zero" coercion as a result of return type.  This was done purposefully.
'  The Object type for the FieldVal inpute parameter allows null rows to be processed with the same type of coercion
'  on the incoming side.  
' This is report specific logic that takes advantage of the fact that all of data requiring this function is numeric.
Function GetRowValue(ByVal FieldName as String, ByVal FieldVal as Object, ByVal ResourceType as String) As Double

' TheKey variable allows this function to be used for any number of columns for any number of resource types.
Dim TheKey as String 

TheKey = "[" & FieldName & "][" & ResourceType & "]"

' See if a value was passed.  In SSRS, when the cell tries to render in the matrix, there 
' is no underlying data row for the column region, so a null (Nothing) gets passed by the runtime environment.
    If FieldVal is Nothing Then
       ' Coercion on the return type happens when the HashTable Item property returns Null if the lookup fails.
       '  If the lookup succeeds, the last value encountered (top to bottom) will be present.
    Return LastSeenValue(TheKey)
    End If

    ' now we know that a value was passed
    If (Not LastSeenValue.ContainsKey(TheKey))  Then
        LastSeenValue.Add(TheKey, FieldVal)
        Return FieldVal
    End If

    ' A value was passed and we have an old value. Update it
    LastSeenValue(TheKey) = FieldVal
    Return FieldVal

End Function

最后,在集群矩阵单元格中,我将表达式设置为:

代码语言:javascript
运行
复制
=Code.GetRowValue("Clusters", Fields!Clusters.Value, ReportItems!ResourceType.Value)

这就解决了问题。另一个好处是,表开头的行现在是空白的,现在正确地包含了零(对我来说是正确的)。一件棘手的事情是将FieldVal参数输入到Object,而不是Integer (这是我的集群数据类型),因为您不能检查值类型是否存在。另一个是指ReportItem!ResourceType.Value instead of Fields!ResourceType.Value,因为ResourceType是我的专栏分组。最后,函数的返回类型选择将影响您的数据是否有小数点,因此选择Double可以同时处理整数和实数。必须对此进行修改,以使该函数正确处理字符串。

以前,原始经验:

之后,值现在重复以前为空的位置:

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17508526

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档