Search code examples
c#crystal-reports

Crystal Report Group Issue


I am new to Crystal Report. I have a data set like this:

DataSet:

Name    Type    Unit     Price
One      p1      3        10
Two      p2      2        8
Three    p1      1        5

In my crystal report I want to group the data by Type and then only list the group data that Type is equal to p1
How could I apply some logic to hide other groups?


Solution

  • I'm not sure how far along you are, so in a nutshell...

    1. Add a group by right-clicking inside any one of the sections:

    enter image description here

    1. Select the field you want to "group" by, in this case a field named "fieldName":

    enter image description here

    1. Right-click the group section header bar and open the "Section Expert". Check the "Suppress" checkbox, press the formula button next to it, and enter a formula that tells it when to suppress the group, in this case when "fieldName <> "P1".

    enter image description here

    1. Right click on the "Details" section and do the same thing (click the same checkbox and enter the same formula). If you have anything in the group footer, do the same there too.