Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Left Outer Joins vs SubReports vs Views

Status
Not open for further replies.

kmarino

Technical User
Dec 30, 2002
17
US
Hello. I am using Crystal Reports Professional Edition 9.0

I am currently trying to link 3 views: An Employee view with two code description views. I want the Employees to appear on my report regardless of whether the codes on the Employee table have an entry on the respective description views. The views are linked first by Company Code, then by the respective code (ie. Employee view is linked with the Job Description view by Company Code, then Job Code and the Employee view is linked with the Hire Source Description view by Company Code and Hire Source Code). I tried using the Left Outer Joins, but I get an error message stating “Failed to open row set” then I get the message “Failed to open a rowset. Details:HY000:[MERANT][ODBC SQLBase driver][SQLBase]01410 DLU OOJ Only one outer join table allowed”

After doing some research, and getting nowhere, I decided to try using a subreport for the Job Description. I linked the Employee view with the Job Description table using the left outer join with the fields Company Code and Job Code. My report is now showing the employee I wish to see, however, I’ve taken a serious blow to speed with this method. There are only 350 employees in the Employee view but the report took 4 minutes to refresh itself to display 82 of the records (I also have selection criteria in this report). This is not a viable solutions for some of our clients with employee counts in the tens of thousands. Note: Both the primary report and subreport are sorted by Employee Name, Company Code, then Employee File#.

After spending a day at this website sifting through issues that others have posted, I’ve developed the following impressions, right or wrong:
1. Multiple left outer joins are possible sometimes depending upon the database and the drivers and the version of Crystal.
2. When multiple outer joins are not possible, subreports are developed.
3. When speed is an issue, views (newly created or modified) are preferred to the subreports.

Is this correct?

Background Information:
My company is considering using Crystal Reports in addition to SRS’s ReportSmith. I’m trying to redo the reports in Crystal that were originally written in ReportSmith. ReportSmith had a feature called “Translate”, whereby it somehow knows how to change the codes into their descriptions using a Decode function. This is actually what I was trying to get at when redoing this particular report.

 
Dear Kmarino,

Your suppositions are correct. Database linking (join functionality) is controlled by the database drivers.

Even if you can do left outer joins you may still require a subreport in some instances. Consider the following scenario:

I have two tables an Incident table and a Work Order table. Since a Work Order can be related to an Incident or opened independantly of an Incident if I want (1) All Incidents, (2) Any related (Incident) Work Orders, and (3)Work Orders not related to any incidents I would use a Left Outer Join on the Incident to Work Orders which would give me the first two items, however for item 3, all independant Work Orders I would still need to do a subreport.

One option you didn't mention was to base your report on a stored procedure.

HTH,

ro Rosemary Lieberman
rosemary@microflo.com, Microflo provides expert consulting on MagicTSD and Crystal Reports.
 
Thankyou rosemary for responding so quickly.

I guess I should also look at option #4-Stored Procedures.

Something to look forward to on the 2nd. Have a Happy New Year.

Kathleen
 
One thing I read recently in this forum which made sense of the trouble I had been having, is that Crystal treats qualified left outer joins as an equal join. If the criteria is not met , the whole query fails and no rows are returned.

I have found subreports to be the only way out in this situation.
 
I have found that with outer joins, if you have multiple tables linked together, as soon as you say left outer join between two tables then the rest of the tables in that "chain" HAVE to be left outer joins (regardless of whether that makes logical sense to do so or not).
ex.
TableA -1- TableB -2- TableC -3- TableD.
if link 1 is a left outer join then link 2 and 3 must also be left outer. If link 2 is left outer, then link 1 can remain equal but link 3 must be left outer. If link 3 is left outer, link 1 and link 2 can be equal joins.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top