Home | SkillForge Blog | How to Filter Data in Crystal Reports

How to Filter Data in Crystal Reports

Crystal Reports

When you run a report in Crystal Reports, you have a lot of latitude as to what goes in, how to format and organize, and so on. But one consideration that doesn’t always come up is how to filter, or leave data out.
Turns out, it isn’t difficult. In fact, the technique is similar to one we find in several other programs which deal with data and databases.

Initial Report
After opening the report in question, the feature that does the filter work is the Select Expert–specifically, the Record part.

Filter 1
Among the logical operators available to filter is “Is Not Like” (sometimes seen in other programs as “< >” or “Not Equal To”). This is the one that says “DON’T show me…” whatever it is you want to exclude from a given field, like City.

Filter 2
But the next part is also easy–just a little different. If we want Crystal to show all cities in a shipping list other than Albuquerque (watch your spelling on this one! 🙂 ), we put it between asterisks, like so: *Albuquerque*.

Filter 3
So every record whose city name does NOT include Albuquerque (beginning with, ending with, or containing) will show.

Filter 4
It may seem a little odd, to want to exclude information in Crystal Reports; usually we’re trying six ways from Sunday to include information. But panning for gold meant sifting out what you didn’t want. And reducing a sauce involves removing liquid to make it denser and more flavorful.
As a related point, a Web search filter can involve a similar idea. We often use Google to look for things, but the Advanced search capability lets us say, in essence, “Look for this and this but NOT that.” Hardly ever occurs, but it’s always there if we need it. Ditto in Crystal.

For more information on this, take a look at our Crystal Reports classes.