Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Redundant Data Post Reply Post New Topic
Author Message
jgarner
Senior Member
Senior Member


Joined: 23 Jan 2009
Location: United States
Online Status: Offline
Posts: 159
Quote jgarner Replybullet Topic: Redundant Data
     Posted: 08 Sep 2010 at 4:20am
Data Tables:
 
PO (Purchase orders)
POLINE (Individual lines of purchase items for PO)
PR (Purchase Requisition)
PRLINE (Individual lines of purchase items for PR)
 
A Purchase Requisition is created first, which lists the individual purchase items. This has a specific PR #.
 
Once the PR is created, a PO is then created from the PR, which is related by the PO_Number in the POLINE and PRLINE tables.
 
If I create a PO report and place both the PO_Number and PR_Number on the same report, it triples the purchased line items. I've tried changing the link options (Inner Join, Left Outer, Right Outer) but have not had success.
 
Any ideas? Thanks.
IP IP Logged
jgarner
Senior Member
Senior Member


Joined: 23 Jan 2009
Location: United States
Online Status: Offline
Posts: 159
Quote jgarner Replybullet Posted: 08 Sep 2010 at 4:39am
I've recreating the report to only include 2-tables:
 
POLINE and PRLINE
 
I've tried changing the link configuration to see if it would make a difference with no success.
 
If I place only the PO_Number on the report, it works.
If I also place the PR_Number on the report, it immediatly triples the detail row, although no fields are in the detail row.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Sep 2010 at 5:04am
Although the join type can have impact on the total number of rows that is not what you are experiencing.
the extra rows that appear is based on the 'enforce' issue in crystal. In most systems, when you make a join it is automatically enforced, meaning that the join will impact the returned rows with no further action. In Crystal, joining tables does NOT do this unless you specifically tell it to (enforce options). Otherwise the enforce happens when you use a field from a joined table. (Note: You can use the field in a select statement or in a formula, not just when you drag and drop it onto the canvas). So when you only had a field from PO being used it shows the one row (only one row per PO in the PO table exists). WHen you add the PR_Number field it is from another table that has 3 rows per PO and it enforces the join and makes the extra rows come into the report.
Does that help?
IP IP Logged
jgarner
Senior Member
Senior Member


Joined: 23 Jan 2009
Location: United States
Online Status: Offline
Posts: 159
Quote jgarner Replybullet Posted: 08 Sep 2010 at 5:14am
When I changed the link options from inner to outer, I did not change the enforce option, which was listed as 'Not Enforced'. I will try different Join Types with different Enforce Joins to see if this makes a difference.
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 08 Sep 2010 at 5:28am
you will still get the 3 rows when joining. I was just trying to explain why it pops up.
You can try and change the report option to make the data selection only find unique rows
FILE >Report Options
'Select Distinct Records' as True
IP IP Logged
jgarner
Senior Member
Senior Member


Joined: 23 Jan 2009
Location: United States
Online Status: Offline
Posts: 159
Quote jgarner Replybullet Posted: 08 Sep 2010 at 5:39am
Works great! Thanks.
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