3

私は、スーパーバイザーとスーパーバイザーの上のディレクターと共に 4 つのテスト タイプを使用して、さまざまなスキルに関する労働者のスコアを示すデータセットを持っています。スペースを節約するために、以下のデータセットの例は 1 つのワーカー用です。これは私が始めるものです:

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

テーブル ウィザードまたはマトリックス ウィザードを使用して、これを SQL Server Reporting Services にフィードします。スキル列をスコア列の上に移動して、スキルが列になるようにする必要があります。

行グループ:ディレクター、スーパーバイザー、ワーカー テスト 列グループ:スキル 値:スコア

私はこれを得る:

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

各セルに値が必要なので、グループごとに値を繰り返す必要があります。したがって、私が望むものは次のようになります。

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

各セルに値を入力できるようにするには、何を修正/変更/修正すればよいですか?

4

2 に答える 2

1

同様の問題がありましたが、マトリックスでは、行グループが 1 つしかない場合、詳細グループ レベルで以前の値を繰り返す必要がありました。これを行うために、カスタム コードを使用しました。

たとえば、マトリックスに「クラスター」という名前の列があります。行グループ フィールドは単純な日付フィールドです。私のデータ セットには、フィールドとして Date、Clusters、ResourceType があります。リソース タイプの値が異なるため、特定のリソース タイプに関連付けられたクラスターにデータがある日付を確認できます。私の課題は、私のデータ セットがまばらであるという事実から来ました。特定の ResourceType 値に対して、すべての日付に値があるわけではありません。私のマトリックスでは、基になるデータセットに対応する行がないセルに空白の値を持つ行になりました。Previous の使用はうまく機能しません (他の多くの例)。

この問題を解決するために、次のようにカスタム コードとハッシュ テーブルを使用しました。

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

最後に、[クラスターのマトリックス セル] 列で式を次のように設定します。

=Code.GetRowValue("Clusters", Fields!Clusters.Value, ReportItems!ResourceType.Value)

そして、それは問題を解決しました。追加の利点は、空白だったテーブルの最初の行にゼロが正しく含まれるようになったことです (これは私にとっては正しかったです)。1 つのトリッキーなことは、値型の存在を確認できないため、Integer (私の Clusters データ型) の代わりに FieldVal 引数を Object に入力することでした。ReportItem!ResourceType.Value instead of Fields!ResourceType.ValueResourceType は私の列のグループ化だったので、もう 1 つは を参照していました。最後に、関数の戻り値の型の選択は、データに小数点があるかどうかに影響します。そのため、Double を選択すると、整数と実数の両方を処理できます。この関数が文字列を正しく処理するようにするには、これを変更する必要があります。

以前、元の経験:

オリジナル体験

その後、以前は空白だった値が繰り返されるようになりました。

以前は空白だった値が繰り返されるようになりました

于 2016-01-08T01:11:22.053 に答える