Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Adding Where to Select Field Post Reply Post New Topic
Author Message
mjefferson
Newbie
Newbie


Joined: 03 Apr 2012
Online Status: Offline
Posts: 5
Quote mjefferson Replybullet Topic: Adding Where to Select Field
    Posted: 14 Jun 2012 at 3:20am
In SQL, I would do this on the join - could also be a subquery. 
 
My company has a table of customer IDs that has a composite primary key.  Because of many mergers, a customer might have up to 5 IDs.  It want to select CUSTOMER_ID from that table only where ID_TYPE = 3. 
 
In Crystal, is there a way to do this with a simple formula that can then be used as a field in the report?  I will have to do this a lot and would like to avoid using SQL commands or subreports every time, if possible.
 
 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 14 Jun 2012 at 3:32am
Why can't you just use something like
 
{customer.ID_TYPE} = 3
 
in your selection criteria?
 
If you need to outer join to this table, you would change it to something like
 
(IsNull({customer.CUSTOMER_ID}) or {customer.ID_TYPE} = 3)
 
Note where I put the parentheses - if you have other selection criteria, this is required in order for it to work correctly.
 
-Dell
IP IP Logged
mjefferson
Newbie
Newbie


Joined: 03 Apr 2012
Online Status: Offline
Posts: 5
Quote mjefferson Replybullet Posted: 14 Jun 2012 at 3:42am
Not all customers will have IDs with ID_TYPE = 3.  Some will have an ID with ID_TYPE = 2, and they still need to be on the report, but the ID field should be null.

Edited by mjefferson - 14 Jun 2012 at 3:42am
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.