Joined: 10 Jan 2011
Online Status: Offline
Posts: 3
Topic: CR XI: Display records even if join table is null Posted: 10 Jan 2011 at 1:42pm
Hey everyone! I'm trying to create a few reports that will tell me when a user does not have a record for a specific event. For example:
I have two tables, {Users} and {Comments} which are joined by the field "UserName". The Users table has user info such as first and last name, e-mail, etc.; the Comments table shows the date of when a User leaves a comment for another user. If a User has never left a comment, no record is created in this table.
When I create a report with just fields from the Users table, such as {Users.FullName}, I see a list of 100 users in the report. But once I add a field from the Comments table, such as {Comments.Date} only 80 names are shown, meaning only 80 user have commented and 20 have not (therefore no commenting records exist, but their User record does exist). Essentially, my Users table has 100 records and my Comments table has 80, so 20 users from the Users table do not have a record that matches the joined UserName field in Comments.
How can I create a report that will show me all 100 Users and has a NULL value for the 20 who do not have a record with the {Comments.Date} field? Once created, how can I search for only the 20 with NULL values?
Even more complex: if I want to search my report for comments posted within a certain time period, how do I create a report that will list all 100 users and have NULL values for those without a {Comments.Date} record within that time period but do have a Comments.Date record created outside that time period?
Joined: 21 Dec 2007
Online Status: Offline
Posts: 4374
Posted: 11 Jan 2011 at 5:02am
right click on the link, and select outer join...play with left or right to get the correct one...I am not sure which table Crystal considers the 'right' vs the 'left' in the link.
I would think that comparing a date parameter against the comment table would work, but I'm not 100% sure.
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