Join Robin Hunt for an in-depth discussion in this video Working with conditions on the experts, part of Crystal Reports 2013: Experts and Customizing Reports.
- [Voiceover] One of the best features of Crystal Reports is working with the Experts. The Experts make working with the reports a lot more simplified. Let's review some of the Experts and understand how the conditions work. If you have a basic understanding of Crystal Reports, you're probably already using the Database Expert. This is where we access our databases, add more tables, and work with our links. The Group Expert. The Group Expert allows us to add the grouping. Let's start there. Most people would be likely to group by the customer name, but let's group by the customer ID.
That way we know each customer gets their own unique group, because the customer ID is unique to each customer. Customer ID, however, is not very meaningful. So let's adjust the options to show the customer name. We're grouped by customer ID in ascending order, and then we'll go to the Options tab. We'll choose Customize Group Name Field, and we'll choose from the existing fields. Customer Name is perfect for this example. You can also use a formula as a group name, so if you wanted to combine customer name and customer ID in a formula, you could do that.
You also have the option to keep groups together. Keep Group Together is a great option, but sometimes creates unwanted white space. You have New Page After. New Page After forces a new page after each group. If you have larger groups, Repeat Group Header on Each Page allows the group header to be repeated on each page. Let's click OK, and OK again. So even though you see the customer name, you're technically grouped by the customer ID. Let's go to the Design tab.
Last Year's Sales would be great for a summary. We'll right click, go to Insert, and choose Summary. We'll add it to all group levels. This gives us a grand total, plus a total by customer. For the formatting of the report, I'm going to move that "Last Year's Sales" to the Group Header 1. I'd also like to have City, Region, and Country, in the group header. Let's take a look at the report. Because we have a group and a summary, the Group Sort Expert is now available.
We'll cover this in more detail a little bit later. You've likely worked with the Record Sort Expert as well. This allows us to sort groups and other fields ascending or descending. You have the Select Expert, which allows us to filter information. Let's take a look at the Section Expert. Because we have most of our information in the group header, we can suppress the details section. I'll choose Details. Each section has its own set of tabs.
Also you can set conditions. For this example, we do want to just do a suppress, but maybe if we wanted to suppress on a condition, we would click the condition button. We also don't need the extra space from the Group Footer 1. We'll go to Group Footer 1, and we'll suppress it as well. We can click OK. You have other options like your Formula Workshop, your OLAP design wizard; OLAP stands for online analytical processing, so if you're pulling data from a data warehouse or a data mart, you're likely using OLAP options already.
We also have the Template Expert. The Template Expert allows us to pick from different predefined templates. Just a note, you may want to save a copy of your report before you apply the template. Once the template is applied, you can't undo. I'll choose Cancel. Also on the Experts toolbar, you have Format and Insert Hyperlink. Let's take a look at the Highlighting Expert. The Highlighting Expert allows us to highlight things based on conditions. It's always a good idea to select the field you're starting with.
I'll click the Highlighting Expert, and I'll do a New condition. Notice that it's the value of this field, but I could choose any field. For this example, this field is perfect, because we want to highlight the summary information. We want to say that it is less than or equal to 25,000. We want to make the default color maroon. This will make those numbers stand out a little bit to let us see who's in our less than 25,000 category.
Let's click OK. Now you can easily spot check your report to see who meets that category using the Highlighting Expert. Controlling the outcomes of the report database based on conditions that you set makes the reports more flexible, and actually more meaningful in the long run. From the Sort Expert to the Group Expert, Crystal Reports is made easier if you use the Experts.
- Working with conditions on the exports
- Setting defaults for fields
- Browsing data
- Building specified groups
- Turning on Top/Bottom N groups
- Grouping by formulas
- Repeating group headers
- Converting text