Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Not Exist or Not in another table help Post Reply Post New Topic
Author Message
dakid24
Newbie
Newbie
Avatar

Joined: 17 May 2012
Online Status: Offline
Posts: 6
Quote dakid24 Replybullet Topic: Not Exist or Not in another table help
     Posted: 20 Sep 2012 at 2:46am
Hello,

I have a two tables (Bin & Item) where I want to list the Code from the Item table when it doesn't exist in the Bin Table. I can to this with ease in SQL but I'm not sure how to do this in Crystal. Can someone help me with this?

Thanks in advance
ME
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Sep 2012 at 3:37am
Try this:
 
1. Link from Item to Bin.
 
2.  Right-click on the link and change the join type to Left Outer.
 
3.  In the Select Expert, edit the selection formula to include something like the following:
 
IsNull({Bin.KeyField})
 
where KeyField is the field you link to from Item.
 
-Dell
IP IP Logged
dakid24
Newbie
Newbie
Avatar

Joined: 17 May 2012
Online Status: Offline
Posts: 6
Quote dakid24 Replybullet Posted: 20 Sep 2012 at 4:43am
I did that and I get no data on the report

Edited by dakid24 - 20 Sep 2012 at 4:44am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Sep 2012 at 4:47am
Did you link from Item to Bin or from Bin to Item - the link direction makes a difference!  It needs to be from Item to Bin.
 
If that is not the issue, please post the whole formula from the Select Expert so that I can see what's going on.
 
-Dell
IP IP Logged
dakid24
Newbie
Newbie
Avatar

Joined: 17 May 2012
Online Status: Offline
Posts: 6
Quote dakid24 Replybullet Posted: 20 Sep 2012 at 5:13am
I'm not sure why but I had to restart my PC. When I came back to the report, it worked. Awesome!! Thanks for the help. If its not a bother, can you explain why the IsNull formula works like this?

Thanks again!!
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 20 Sep 2012 at 5:23am
What a left-outer join does is gets you all of the data in the table you're linking from regardless of whether a corresponding record exists in the table you're linking to.  So, when you do a left-outer join from Item and there is no corresponding record in Bin, the field you link to in Bin will be null - e.g., it will have no value.
 
-Dell
IP IP Logged
dakid24
Newbie
Newbie
Avatar

Joined: 17 May 2012
Online Status: Offline
Posts: 6
Quote dakid24 Replybullet Posted: 20 Sep 2012 at 5:33am
Simple and elegant...

Awesome!!!

Thanks for your help.
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