Quantcast
Channel: SCN : Unanswered Discussions - SAP Crystal Reports
Viewing all articles
Browse latest Browse all 4814

How to filter on an optional table?

$
0
0

Hi,

 

I am fairly new to Crystal Reports so please forgive Newb question.  I am using Crystal Reports 2011.

 

I am building a report that pulls data from two tables.  For the benefit of explaining what I am trying to do, I will use the following two tables as an example:

 

Table 1

SySIDCustName
1Steve
2Bob
3Brian
4John
5Lisa

 

Table 2

SySIDCustTownCustType
2SydneyBusi
3MelbourneResi
5SydneyBusi

 

In the report I am displaying all records from table 1 and if the record has data in table 2, I am displaying that too.  As a result I am linking the two tables with a LEFT OUTER JOIN on SySID.

 

When I run the report I get the following data (which is what I was expecting).

 

SySIDCustNameCustTownCustType
1Steve
2BobSydneyBusi
3BrianMelbourneResi
4John
5LisaSydneyBusi

 

However, I would also like to apply a SELECT to only return customers with a CustType of Busi when the customer has data in Table 2, so I applied a SELECT statement WHERE CustType = Busi.  When I previewed the report it only returns the following:

 

SySIDCustNameCustTownCustType
2BobSydneyBusi
5LisaSydneyBusi

 

I thought that the reason why it was no longer returning IDs 1 and 4 is because they don't have Busi in the CustType.  So I changed the SELECT statement to WHERE NOT CustType = Resi.  When I previewed the report I still only got the two items 2 & 5.

 

Is there any way that I can apply a SELECT filter to a report in the above example so that it returns items 1, 2, 4 & 5?

 

Thanks in advance


Simon


Viewing all articles
Browse latest Browse all 4814

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>