<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>Dave's Adventures in Business Intelligence &#187; Join Techniques</title>
	<atom:link href="http://www.dagira.com/category/design/join-techniques/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.dagira.com</link>
	<description>...you are in a twisty maze of passageways, all different...</description>
	<lastBuildDate>Wed, 01 Feb 2012 17:26:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<!-- podcast_generator="podPress/8.8" -->
		<copyright>&#xA9; </copyright>
		<managingEditor>blogmaster@dagira.com ()</managingEditor>
		<webMaster>blogmaster@dagira.com()</webMaster>
		<category></category>
		<ttl>1440</ttl>
		<itunes:keywords></itunes:keywords>
		<itunes:subtitle></itunes:subtitle>
		<itunes:summary>...you are in a twisty maze of passageways, all different...</itunes:summary>
		<itunes:author></itunes:author>
		<itunes:category text="Society &amp; Culture"/>
		<itunes:owner>
			<itunes:name></itunes:name>
			<itunes:email>blogmaster@dagira.com</itunes:email>
		</itunes:owner>
		<itunes:block>No</itunes:block>
		<itunes:explicit>no</itunes:explicit>
		<itunes:image href="http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<image>
			<url>http://www.dagira.com/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
			<title>Dave's Adventures in Business Intelligence</title>
			<link>http://www.dagira.com</link>
			<width>144</width>
			<height>144</height>
		</image>
		<item>
		<title>Handling Conditions on Outer Joins</title>
		<link>http://www.dagira.com/2010/08/17/handling-conditions-on-outer-joins/</link>
		<comments>http://www.dagira.com/2010/08/17/handling-conditions-on-outer-joins/#comments</comments>
		<pubDate>Tue, 17 Aug 2010 21:25:44 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Join Techniques]]></category>
		<category><![CDATA[Universe Design]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=310</guid>
		<description><![CDATA[I don&#8217;t like outer joins in my reporting universes. Never have. Sure, if I am creating a universe against an application system I might consider using outer joins because of the normalized nature of the data. But if I am reporting against a warehouse schema of some kind, I really prefer to use inner joins. [...]]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t like outer joins in my reporting universes. Never have. Sure, if I am creating a universe against an application system I might consider using outer joins because of the normalized nature of the data. But if I am reporting against a warehouse schema of some kind, I really prefer to use inner joins. That way I avoid any potential performance issues caused by outer joins, but more importantly I avoid questions about report data. That being said, outer joins do have a specific purpose, and if I need to use them in my universe I certainly can.</p>
<p>One of the biggest challenges with outer joins (other than potential performance issues) is explaining to a user why their query results changed because they added a condition to their query. Remember that users don&#8217;t (typically) look at the SQL, so they won&#8217;t know that I have created an outer join. It can be confusing. Fortunately I have options as to how my outer joins are executed, so once I determine their usage requirements I can change the way my universe behaves.</p>
<h3>Defining the Problem</h3>
<p>For this post I will am going to use a very simple universe with only three tables, shown here.</p>
<p><img src="/tips/outer_join_filters/ssg_universe.png" width="496" height="218" border="0" alt="Summit Sporting Goods Universe screen shot" title="Summit Sporting Goods screen shot" /></p>
<p>This universe joins a customer to an order, and an order to order lines. In my database I have one customer that does not yet have any orders. If I run a query against the current universe structure, this new customer will not show up. My requirement is to show all customers, whether they have orders or not. This must be true even if I put a condition on the order table. That&#8217;s where it gets tricky. <img src='http://www.dagira.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  <span id="more-310"></span></p>
<h3>ANSI_92 Parameter Setting</h3>
<p>In order to make this work, I have to make sure that my universe parameter setting for <code>ANSI_92</code> is set properly. From the <strong>File</strong> menu I will select <strong>Parameters</strong>, and on the tabbed dialog box that appears I will click on the <strong>Parameters</strong> tab. I need to set the <code>ANSI_92</code> parameter to &#8220;Yes&#8221; in order for this technique to work. Without this setting, my joins will be created using Oracle-specific syntax and that isn&#8217;t what I want here.</p>
<p><img src="/tips/outer_join_filters/parameters.png" width="517" height="366" border="0" alt="Universe parameters screen shot" title="Setting ANSI_92 parameter in a BusinessObjects universe" /></p>
<p>Once I have verified this setting I can close the parameter screen. Next I need to define my outer join.</p>
<h3>Defining an Outer Join</h3>
<p>The outer join definition is done the same way with all databases, but it&#8217;s not always done in the same direction. In some databases I have to check the primary table and in others I need to check the secondary or optional table. Rather than trying to remember which database does what, I will pick a side and check to make sure that the tiny &#8220;o&#8221; appears on the expected side of my join. For example, I want to reconfigure my existing inner join between customers and orders and make it an outer join as shown here.</p>
<p><img src="/tips/outer_join_filters/outer_join_checkbox.png" width="512" height="483" border="0" alt="Outer join checkbox screen shot" title="Marking an outer join in a BusinessObjects universe" /></p>
<p>The structure window looks a bit different now.</p>
<p><img src="/tips/outer_join_filters/outer_join_active.png" width="496" height="218" border="0" alt="Outer join screen shot" title="Outer join definition in a BusinessObjects universe" /></p>
<p>As mentioned earlier, the tiny &#8220;o&#8221; on the right side of the join denotes the optional side. If the &#8220;o&#8221; is on the wrong side, I will open the join properties window and select the other checkbox. </p>
<p>That&#8217;s how I create an outer join in my universe. Let me show how it works first, then I will show how I can break it.</p>
<h3>Outer Join Queries</h3>
<p>I have exported my outer join universe and created a very simple query. I have included the customer ID, name, and their order total. There is one customer (appropriately named &#8220;New Customer&#8221;) that has no orders and their order amount shows up blank because of the outer join setting.</p>
<p><img src="/tips/outer_join_filters/outer_join_results.png" width="491" height="265" border="0" alt="Query results from Web Intelligence using an outer join" title="Query results from Web Intelligence using an outer join" /></p>
<p>So far everything is working as I expected.</p>
<h3>Breaking an Outer Join</h3>
<p>An outer join is designed to allow rows that don&#8217;t completely match to still show up on my report. What happens if I apply a condition to the outer relationship? For example, I might want to add a condition to limit orders to a particular date range.</p>
<p><img src="/tips/outer_join_filters/query_conditions.png" width="452" height="266" border="0" alt="Query panel screen shot" title="Web Intelligence query panel with condition on outer join" /></p>
<p>Here are the results after running this query.</p>
<p><img src="/tips/outer_join_filters/condition_results.png" width="491" height="217" border="0" alt="Query results from conditions" title="Query results after placing a condition on an outer join object" /></p>
<p>What went wrong? (Answered on next page&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2010/08/17/handling-conditions-on-outer-joins/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Everything About Shortcut Joins</title>
		<link>http://www.dagira.com/2010/05/27/everything-about-shortcut-joins/</link>
		<comments>http://www.dagira.com/2010/05/27/everything-about-shortcut-joins/#comments</comments>
		<pubDate>Thu, 27 May 2010 11:30:44 +0000</pubDate>
		<dc:creator>Dave Rathbun</dc:creator>
				<category><![CDATA[Join Techniques]]></category>
		<category><![CDATA[Universe Design]]></category>

		<guid isPermaLink="false">http://www.dagira.com/?p=273</guid>
		<description><![CDATA[There have been a number of posts recently in the Semantic Layer forum on BOB about shortcut joins. When will they be used? How many can be used? Why won’t this particular shortcut get used? Do I have to add shortcuts to contexts? Lots of questions.
I am going to try to clear up a couple [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a number of posts recently in the Semantic Layer forum on BOB about shortcut joins. When will they be used? How many can be used? Why won’t this particular shortcut get used? Do I have to add shortcuts to contexts? Lots of questions.</p>
<p>I am going to try to clear up a couple of those questions now. First here is a summary of everything I need to know about shortcuts:</p>
<ul>
<li>Shortcut joins do not provide an alternate path.</li>
<li>Shortcut joins do provide a shorter path.</li>
</ul>
<p>By the end of this post I hope that the reader will understand the difference between those two statements. There are two rules for how and when a shortcut will be applied:</p>
<ul>
<li>A shortcut join will only be used if it eliminates tables from the query.</li>
<li>A shortcut join is applied after the SQL has been generated (meaning after a context selection has been made, if required).</li>
</ul>
<p>I will talk about these two items as well. But first, how do I create a shortcut join in my universe? <span id="more-273"></span></p>
<h3>Creating a Shortcut Join</h3>
<p>Creating a shortcut join is quite simple. All I have to do is double-click the particular join and mark the shortcut attribute.</p>
<p><img src="/tips/shortcut_joins/setting_shortcut.jpg" width="512" height="483" border="0" alt="screenshot of setting up a shortcut join" title="Setting up a shortcut join in a Business Objects universe" /></p>
<p>A shortcut join will appear in my universe structure as a dotted rather than a solid line, as shown here.</p>
<p><img src="/tips/shortcut_joins/shortcut_structure.jpg" width="409" height="223" border="0" alt="screenshot of a shortcut join" title="A Shortcut join in a Business Objects universe" /></p>
<p>The process used to create a shortcut join is quite simple. But was it appropriate to convert the join as shown above into a shortcut? Will it be used?</p>
<h3>Shortcut Path</h3>
<p>The sample shown above is from the Prestige Motors database. There is a direct relationship from the Country table to the Region table, and also from the Region table to the Client table. However there is also a direct relationship from the Country table to the Client table, as the COUNTRY_ID column has been denormalized into the Client record. (If you have never seen this database, a client is a customer.) The question at this point becomes, “Is this a shorter path or an alternate path?”</p>
<p>How do I tell the difference?</p>
<p>I believe the answer is simple. If I get the same result from both join paths then it’s a shortcut. If I get a different answer then it’s an alternate path.</p>
<h3>Alternate Path</h3>
<p>In the Prestige Motors database the COUNTRY_ID exists in the Showroom table as well as the Client and Region tables. I could create joins like this:</p>
<p><img src="/tips/shortcut_joins/showroom_join.jpg" width="601" height="367" border="0" alt="screenshot of the showroom join in the motors universe" title="Showroom joins from the Prestige Motors universe" /></p>
<p>In this case I have a join from Country to Client. I also have a join from Country to Showroom. Because of the relationship with the Sales table I now have a loop in my structure. By changing one of the two Country joins to a shortcut I can avoid the loop, like this:</p>
<p><img src="/tips/shortcut_joins/showroom_shortcut.jpg" width="601" height="367" border="0" alt="screenshot of the shortcut join to the showroom table" title="A Shortcut join from Country to Showroom" /></p>
<p>What has happened here? I have eliminated the loop from my structure and solved that problem, right? Perhaps, but it is the wrong solution. In this case, the shortcut is an alternate path rather than a shorter path. I can tell because (as I mentioned earlier) I will not get the same results from the two queries.</p>
<p>Suppose I want to combine Country, Showroom, and Sales. The longer path looks like this:</p>
<p><img src="/tips/shortcut_joins/join_path_1.jpg" width="601" height="367" border="0" alt="screenshot of the longer join path" title="Standard join path from Country to Showroom via the Sales table in the Prestige Motors universe" /></p>
<p>When I execute a query using this set of joins, I will get a list of showrooms that have had sales to customers, and I will get the country where the customer is located. Next I will run a query against this shorter path:</p>
<p><img src="/tips/shortcut_joins/join_path_2.jpg" width="601" height="367" border="0" alt="screenshot of the shorter join path" title="Shortcut join path from Country to Showroom in the Prestige Motors universe" /></p>
<p>When I execute a query using this path, I will get a completely different result set. I will get a list of showrooms, their sales, and the country where they are located. The customer tables never come into play, so I get a completely different result set. This is my indication that I do not have a proper shortcut join definition.</p>
<p>And interestingly enough, Web Intelligence will never use the shortcut for the query outlined above! It is smart enough to realize that the shortcut is not properly defined as it does not truly present a shorter path. It is an alternate path, and that’s not a valid application of a shortcut.</p>
<p>As a brief aside: How should this particular loop be resolved? Obviously a shortcut is not the answer.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.dagira.com/2010/05/27/everything-about-shortcut-joins/feed/</wfw:commentRss>
		<slash:comments>31</slash:comments>
		</item>
	</channel>
</rss>

