Operation Manual

Understanding Databases
Linking tables
25
Crystal Reports User’s Guide 497
In this situation, the program sees that it can pass down the condition
before the And operator but not the condition after. Since the only records
that will meet the second condition will have to meet the first as well, the
program passes down the first condition, retrieves the data set that
satisfies the condition, and then applies the second condition only to the
retrieved data. The rule for AND situations is that the program passes
down whatever conditions it can.
Note: If all of the conditions in an AND situation can be satisfied on the
server or in the database DLL, the program passes them all down.
OR situations
{customer.REGION} = "CA" or
{customer.CUSTOMER ID}[3 to 5] = "777")
In this situation, the program also sees that it can pass down the
condition before the Or operator but not the condition after. Since there
are records that can satisfy the second condition without satisfying the
first, passing the first condition down does not make any sense because
it will retrieve an incomplete data set. In other words, even if it retrieves
all the data that satisfies the first condition, it will still have to retrieve all
the data in the table(s) before it can apply the second condition in Report
Designer. Thus, instead of duplicating parts of the data retrieval, the
program passes nothing down. It retrieves all the data and then runs both
tests in Report Designer. The rule for OR situations is that the program
either passes down all the tests, or none of the tests.
Note: If all the tests in an OR situation can be performed on the server or
in the database DLL, the program passes them all down.
Consideration 2
To make certain the program can use the index on Table A to enhance
performance, make certain:
There is a selection formula.
There are range limits in the selection formula on the key (indexed) field
in Table A.
Use Indexes is selected in the Options dialog box.
Consideration 3
If the fields you are using from Table A are not indexed, but there is an
indexed field that you can use in your record selection request, use that field.
For example, assume that you have three products (Product 1, Product 2,
and Product 3) and you want to identify all sales of Product 2 in the U.S.
There is no index on the Product field but there is an index on the Order Date