In this movie we're going to cover Basic Grouping and Sorting. If you haven't already done so go ahead and open up Report1. This is our basic report that points at the Employee Table of our Test Database. Go ahead and click on the Design view. When we created this report we defined one group. This group was the EmployeeID. One of the main functions of a group is that it will determine the order in which you see your data on the Preview tab. So if we hit Preview for example we'll notice the EmployeeID starts from the least and goes down to the greatest. That is our default ascending order. Go ahead and click on your Design tab again. Now, from here let's say we didn't want that. Go ahead and right-click on the Group Header 1 section, you get this menu. Go ahead and choose the Change Group option. As we can see this is our group as we defined it. From here we can Change the Group, let's say to Last Name in Ascending order, and press OK. Let's go ahead and click on our Preview. Notice how our data now appears in this order. Now, we can't see our Group Fields in the Preview tab because we've suppressed them to create more a tight controlled list-like report, but it is still there effecting the order in which you see things. Go ahead and click on the Design tab. From here go ahead and choose Change Group again. Now you can reverse this and say Descending order and watch what happens. Zavorotny is now the first one in your list. Go ahead, right-click on the Group Header section and choose Change Group. This time we're going to do something a little bit different. We're going to say specified order. This pops up a new tab and a new drop-down box. This allows you to actually cherry pick who you want to see first, second, third, fourth as many times as you're willing to do this manually. Go ahead and click the drop-down box. Here's a list of all my Employee Last Names I can choose from. Let's say I want to keep an eye on Dunlap. He's a troublemaker and really don't think he's going to last long with this company. Go ahead and hit the drop-down box again and say his partner in crime, McCormick, also worth keeping an eye on. This also creates an Others tab, so go ahead and click on the Others tab. Now you said you wanted to see Dunlap and McCormick at the top, but you didn't tell Crystal what you wanted to do with the rest. So here are your options. You can Discard all others, now by discard it means not shown on the report, not deleted from your database in case you're wondering, and you can also put them all together with the name Others, or anything of your choice. Or you can also choose to leave them in their own groups. The group in this case would be their last name. Let's go ahead and see what happens when we say Leave in own groups. Go ahead and press OK and Preview. Notice the first two at the top, McKay Dunlap and John McCormick are at the top and then it defaults to our sort order that we determined earlier. Now this is a good point. There is a slight difference between grouping and sorting. Grouping of course will take precedence, that will be the first thing it looks at, but also, as you notice in this case, the order's slightly different. Go ahead and click on the A-Z with circular arrows icon. It's located in your Toolbar. This is the Record Sort Expert. Notice how the first thing it looks up is Group Header 1 Employee Last Name /S, S standing for Specified order, the order we actually manually specified. The second group is the Employee Last Name. So what happens here is the very first two names that we specified appear in this list and the rest are then sorted by Employee Last Name. Go ahead and hit Cancel. Now, in order to sort your data you don't need to use only Groups to get the job done. Go ahead and click on your Design tab, go ahead and right-click on the Group Header, and this time the option we're going to choose is Delete Group. Notice how our group sections went away. And if we click on Preview we now have a Sort by Last Name. So the question is, how do we sort without groups? Well, we've already done so. Click on Record Sort Expert. Notice how we no longer have a Group to sort by in this window but we have Employee Last Name. From here we can choose any order of fields to order by, like Employee last name, middle name, then first name. As this is a simple list report it wouldn't do us much good, but we can remove it and say, well, we really should sort by EmployeeID and choose either Ascending or Descending. As you can see, the EmployeeIDs now are sorted in original order. The bottom line for this lesson is that you can sort or group as you see fit. You don't necessarily need Group or Groups to help you sort, even though they can take care of that function for you. You can also sort the raw data in the order in which you choose.
| Course: | Crystal Reports XI: Beginner |
| Author: | Kurt Dunlap |
| SKU: | 33966 |
| ISBN: | 1-935320-29-7 |
| Release Date: | 2009-02-10 |
| Duration: | 6.5 hrs / 95 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |