Search code examples
.netreportgroupingrdlcrdl

How to group value which is result from expression in RDLC Report


I have dataset like these

enter image description here

Field "Type A" , "Type B" and "Type C" is a boolean type.

I made tablix for assign above dataset. At Type Column of Tablix is set by this expression.

enter image description here

     = Switch( 
      Fields!TYPE_A.Value = 1 And Fields!TYPE_B.Value = 0 And Fields!TYPE_C.Value = 0 , "Regrinding",
      Fields!TYPE_A.Value = 0 And Fields!TYPE_B.Value = 1 And Fields!TYPE_C.Value = 0 , "Coating",
      Fields!TYPE_A.Value = 0 And Fields!TYPE_B.Value = 0 And Fields!TYPE_C.Value = 1 , "Modifying",
      Fields!TYPE_A.Value = 1 And Fields!TYPE_B.Value = 1 And Fields!TYPE_C.Value = 0 , "Regrind & Coating",
      Fields!TYPE_A.Value = 1 And Fields!TYPE_B.Value = 0 And Fields!TYPE_C.Value = 1 , "Regrind & Modifying",
      Fields!TYPE_A.Value = 0 And Fields!TYPE_B.Value = 1 And Fields!TYPE_C.Value = 1 , "Coating & Modifying",
      Fields!TYPE_A.Value = 1 And Fields!TYPE_B.Value = 0 And Fields!TYPE_C.Value = 1 , "Regriding & Modifying",
      Fields!TYPE_A.Value = 1 And Fields!TYPE_B.Value = 1 And Fields!TYPE_C.Value = 1 , "Regriding,Coatin & Modifying",
      1 = 1 , "None" )

At "Type count" Column I need to count each type by grouping with two data

1.TOOLS_CODE from Datset

2.String value which is result from expression at "Type" Column of Tablix

What should I do?

OUTPUT :

if Dataset has items like these

  • TLD001 (typed Regriding)
  • TLD001 (typed Regriding)
  • TLD001 (typed Coating)
  • TLD002 (typed Regriding)
  • TLD003 (typed Regrind & Coating)

A report will show...

enter image description here


Solution

  • The easiest solution would be to create a new view inside your database that does the necessary grouping. And then you can just show that inside your report.

    Another solution would be to handle the grouping in C# and pass a custom list as a parameter to the reporter.

    If you really need to get this work in reporter, you could work with nested lists on which you add textboxes fetching the data by using expressions. But I don't recommend this, as it gets really complicated. I would strongly suggest the first solution.