We know now how to do the relationships and how to create joins, and what they are from our prior discussion. Now let's go inside of Crystal, and see how we can do the mapping here. It does not matter whether I use a Blank Report, Wizard, or any of the mailing labels, or cross-tabs. They'll all work the same. When I select the report, the first thing I'm doing is choosing my database, and my tables. Now here's where I need to know the relationship. For instance, I'm going to go ahead and I'm going to choose customers, and I'm going to choose products. I want to see which customers buy which products. I'll simply go ahead and say OK. This is the mapping screen. Notice now that there are no lines connecting these two tables together. There is no relationships. I need to create them, now here's where I have to understand the data. Crystal will actually allow me to take any field, drag it to another field, and if the data type is not compatible, it'll tell me. However, if I take an item and I drag it to another field, and the data type is the same, it'll actually put a link in. But we know that the product name, and the Country field, has nothing to do with each other. So as a result, I'm going to delete that out. Crystal demands that you understand that your data. I'm going to go back to the Data Tab, and I'm going to add two more tables, orders and order detail, and now I'll say OK. Do you see how all the lines came up now? They were in there in the database itself. It is actually following the same process that it did in our Access database. It's saying that the customer can place an order, it's name appears in the order header, which is called orders. The details in the bottom section, called details, that ties to the products. All the relationships came through nicely. However, if one of these lines gets corrupted, remember, sometimes we have to verify our data, because things go wrong. My tables now come in, but I do not see a line connecting them altogether? This will not work in a report. It's our responsibility to make sure when we're using the database expert that we see that each of our tables is related via a series of lines. I do not see those lines here. Since I know my data, I am now going to look for the appropriate field to actually work with in these two tables. I notice a product ID, and a product ID. Because we know now that our primary is usually the same name as the table, I will start with the product ID, go right down to the product ID in my order details, and I have just mapped those tables together. I can now use all four of these tables in Crystal Reports. Now you will notice some markers on the sides of each of these fields. These are called Indexes. We're going to address these Indexes and how they effect our data a little later on.
| Course: | Crystal Reports: Advanced |
| Author: | Lauri Sowa-Matson |
| SKU: | 34268 |
| ISBN: | 978-1-61866-016-9 |
| Release Date: | 2011-09-30 |
| Duration: | 7.5 hrs / 100 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |