So I have stored procedure which returns data in following:
GroupId FieldName Value
1 Foo 28
1 Bar 2
1 FooBar 11
1 Bizz 22
1 UserName John Smith
2 Foo 4
2 Bar 13
2 FooBar 27
2 Bizz 23
2 UserName Peter Jones
3 Foo 5
3 Bar 4
3 FooBar 12
3 Bizz 18
3 UserName Lisa Johnson
...........
As you see in sample data above, there is 3 groups (1
, 2
& 3
(for real there are 10 groups)). Each group have the same field names in FieldName
column (It's like header) and in Value
column are stored values.
I need to create SSRS Report in following:
Foo 28 4 5
Bar 2 13 4
FooBar 11 27 12
Bizz 22 23 18
UserName John Smith Peter Jones Lisa Johnson
As you see above, each group should be in different column and headers stored in left side (1st column).
In 1st column I've passed FieldName
;
In 2nd column I've passed expression: =IIF(Fields!GroupId.Value = 1, Fields!Value.Value, "")
In 3rd column I've passed expression: =IIF(Fields!GroupId.Value = 2, Fields!Value.Value, "")
In 4th column I've passed expression: =IIF(Fields!GroupId.Value = 3, Fields!Value.Value, "")
But I achieve output like this:
Foo 28
Bar 2
FooBar 11
Bizz 22
UserName John Smith
Foo 4
Bar 13
FooBar 27
Bizz 23
UserName Peter Jones
Foo 5
Bar 4
FooBar 12
Bizz 18
UserName Lisa Johnson
Have you any ideas, what's wrong? Should I try to do something with groups? I've tried but also unsuccessfully. If something unclear - ask me, I'll try to provide more details.