Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
CRW_REF.PDF
Скачиваний:
5
Добавлен:
13.02.2015
Размер:
13.99 Mб
Скачать

! Click the Preview Tab to view your report.

Your report should now look similar to the following:

Congratulations! You have just created a basic listing report. You will continue to refine this report during the rest of the tutorial.

Record Selection

Seagate Crystal Reports allows you to limit or restrict the records that are to be included in a report. In this section you will learn how to:

Entering your

selection criteria

select the records you want included in your report, and

save a report including your selection criteria.

For example, it may be useful to have a customer list that only lists customers from the USA. The sample data contains records from the United States and International customers. The program makes it easy to restrict lists like this using the Select Expert. See

Record and Group Selection, Page 249.

When you scroll through your report, you will see that the report contains information for customers from many different countries. In this step, you will limit the number of countries displayed to the USA.

To begin, click the Design Tab to return to design mode.

182

Seagate Crystal Reports User’s Guide

Click an empty area of your report to deselect any fields.

!Click the SELECT EXPERT button on the standard toolbar. The Choose Field dialog box appears.

This dialog box lists all the fields currently in the report in the Report Fields section and then lists all fields that are available from each table in the Database Fields section.

"Since you are going to base record selection on the country field, choose {customer.COUNTRY} from the Fields list box and click OK.

The Select Expert appears.

#Your job in this dialog box is to imagine that you are completing the following sentence:

Select all records where a customer’s COUNTRY is

You complete the sentence with the condition you want the program to use when selecting records for your report. Right now the condition is any value, clearly not a restrictive condition.

Tutorial - Customer List

183

$Click the arrow on the right drop-down box to see what other options you have.

%Since you want only those records where the Country is USA, select the equal to condition. A new list box appears on the right. The dialog box sentence now reads:

Select all records where a customer’s Country is equal to

All that you need to complete the sentence is the value USA.

&Click the arrow on the drop-down box. A list of all the country values appears. Select USA from the list.

Your sentence now reads:

Select all records where a customer’s Country is equal to USA

' Click OK to return to the Design Tab.

Click the Preview Tab to review the results of your work.

A message box appears asking if you would like to use saved data or refresh data.

If you click Use Saved Data, the program will only select records from those saved with the report. This method is recommended if you simply add a new record or group selection formula.

If you click Refresh Data, the program will select records from the entire database. This method is recommended if you change an existing record or group selection formula.

Because you did not change a record selection formula, click the Use Saved Data button.

Now when you scroll through the report, you will see that only customers from the USA appear.

! Save this version of the report without overwriting the original report by choosing the SAVE AS command from the File menu and giving the new report the name USA.RPT.

Congratulations! You have started formatting your report and added selection criteria to it. More than that, you have learned how to manipulate your data. By now, you have a good idea of the

184

Seagate Crystal Reports User’s Guide

Deleting a field

Balancing field spacing

powerful kinds of reports you can prepare. As you can see, it is an easy program to use.

Now that your report only contains records from the USA, displaying the Country field in the body of the report is not necessary. You will quickly delete this before continuing.

Select the Country field and the Country column heading using the Ctrl-click combination.

Press the Delete button on your keyboard. That is all it takes to delete fields from your report.

Your report should look similar to this:

Now that the Country field has been deleted, there is a large amount of white space between the City and Contact Name fields. You might be fine with the spacing as it stands, but it might be more readable if the columns were better balanced across the page.

Return to the Design Tab. Select the Contact Name field and its field heading by using the Ctrl-click combination.

Place your cursor over one of the two highlighted text objects and drag them to the left, closer to the City field.

! Click the Preview Tab and review your work again.

Tutorial - Customer List

185

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]