Crystal Reports Optional Table Linking and the Importance of Order
page 4 of 5
by Jason Dove
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 20558/ 27

Using the Correct Order of Evaluation

 

The way to handle this situation correctly is to check whether or not the Order table has a link for a particular record before evaluating the Order Quantity.

 

The ISNULL function can be used to test the link, but it must be used before any criteria within the Order table is applied.

 

So, for our current report requirement:

 

5.  Open the Record Selection Formula Editor and replace the existing code with:

 

(
IsNull({Orders.Customer ID})
OR
{Orders.Order Amount} < 500
);

6.  Save the changes and refresh the report.

 

The report will now display the records as expected because if the Customer ID on the Order is null, then the report will not even look at Quantity Amount.

 

This concept can be expanded for more complex formula just by wrapping up second half of the "OR" in brackets.

 

(
IsNull({Orders.Customer ID})
OR
(
{Orders.Order Amount} < 500
AND
year({Orders.Order Date}) = 2010
)
);

 

This will return any customer with no Orders, or Orders under £500 placed during 2010.

 


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 



Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-19 1:14:04 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search