Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: record found in table Post Reply Post New Topic
Author Message
sneveu
Newbie
Newbie


Joined: 30 Aug 2011
Location: United States
Online Status: Offline
Posts: 2
Quote sneveu Replybullet Topic: record found in table
     Posted: 31 Aug 2011 at 10:52am
I have 3 tables where I know there will be records in 2 of the tables. In the 3rd table, there will only be a record if the user has entered a note related to the order.  I need to check if a record exists for this order and if it does, I need to check a delete flag. In the Select Expert I have several selects from the 2 files and now I need to add the select for the 3rd file if it exists. How do I do this in the select expert?
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 31 Aug 2011 at 12:33pm
Left join to the third table.  This will get you all of the data from tables 1 and 2, regardless of whether there is data in table 3.
 
To determine whether a record exists in table 3, you can use something like:
 
not IsNull({table3.KeyField})
 
This will return True if there is data in table 3 and False if there is not.
 
If you need to have additional criteria on table 3, you'll need to edit the formula in the Select Expert and do something like this:
 
and
(IsNull({table3.keyfield}) or
 (condition 1 and condition2...))
 
Note the parentheses - because of the "or" the placement is important for getting the correct data.
 
-Dell
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum