<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Scripting / Cartesian products and conditions in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182248#M47978</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pierre,&lt;/P&gt;&lt;P&gt;if you don't mind posting your script (or, even better, the whole QVW), we'd be able to show you how to tweak it to get what you need.&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Dec 2009 23:25:39 GMT</pubDate>
    <dc:creator>Oleg_Troyansky</dc:creator>
    <dc:date>2009-12-09T23:25:39Z</dc:date>
    <item>
      <title>Scripting / Cartesian products and conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182247#M47977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please help me to solve this problem? I guess this should be quite easy to do with some experience, but I'm quite a beginner in QlikView development.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is my problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Source data&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are two source tables, with few fields&lt;/P&gt;&lt;P&gt;Table: TODAY&lt;/P&gt;&lt;P&gt;Fields: Customer, Country, Name&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: HISTORIC&lt;/P&gt;&lt;P&gt;Fields: Date, Customer, Country, Qtty&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In QV, I would like to get three tables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: DIMENSIONS&lt;/P&gt;&lt;P&gt;Fields: Id, Customer, Country&lt;/P&gt;&lt;P&gt;Comment: In this table, there should all possible couples (Customer/Country) from the source table TODAY and the source table HISTORIC and an appropriate Id&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: TODAY&lt;/P&gt;&lt;P&gt;Fields: Id, Name&lt;/P&gt;&lt;P&gt;Comment: It is the Id that can be find in DIMENSIONS, and the name from the source table TODAY&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Table: HISTORIC&lt;/P&gt;&lt;P&gt;Fields: Id, Date, Qtty&lt;/P&gt;&lt;P&gt;Comment: It should be the Cartesian product Id/Date, with all possible Id that can be found in DIMENSIONS and all Date that can be found in the source table HISTORIC. If there is no quantity for this couple, then the value for qtty should be '0' (otherwise, it is the value from the source table HISTORIC)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The creation of DIMENSIONS and TODAY is ok, but I really face problems with HISTORIC&lt;/P&gt;&lt;P&gt;I guess it should look like&lt;/P&gt;&lt;P&gt;- Create the Cartesian product Id/Date&lt;/P&gt;&lt;P&gt;- Add the field Qtty depending on the existence of the couple Id/Date in the source table HISTORIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="error loading image" class="jive-image error-loading-image" src="https://community.qlik.com/legacyfs/online/-725_sourceID:725" /&gt;&lt;/P&gt;&lt;P&gt;Your help would be very invaluable for me!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pierre&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2009 23:09:46 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182247#M47977</guid>
      <dc:creator />
      <dc:date>2009-12-09T23:09:46Z</dc:date>
    </item>
    <item>
      <title>Scripting / Cartesian products and conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182248#M47978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Pierre,&lt;/P&gt;&lt;P&gt;if you don't mind posting your script (or, even better, the whole QVW), we'd be able to show you how to tweak it to get what you need.&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Dec 2009 23:25:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182248#M47978</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2009-12-09T23:25:39Z</dc:date>
    </item>
    <item>
      <title>Scripting / Cartesian products and conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182249#M47979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;Yes you are right &lt;IMG alt="Stick out tongue" src="http://community.qlik.com/emoticons/emotion-4.gif" /&gt;&lt;/P&gt;&lt;P&gt;I have attached the basic .qvw file&lt;/P&gt;&lt;P&gt;I thank you a lot !&lt;/P&gt;&lt;P&gt;Pierre&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Dec 2009 00:10:58 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182249#M47979</guid>
      <dc:creator />
      <dc:date>2009-12-10T00:10:58Z</dc:date>
    </item>
    <item>
      <title>Scripting / Cartesian products and conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182250#M47980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;Basically, the problem is the following&lt;/P&gt;&lt;P&gt;There is a table &lt;STRONG&gt;A&lt;/STRONG&gt; with two fields : &lt;STRONG&gt;Id&lt;/STRONG&gt; and &lt;STRONG&gt;Quantity&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;Record 1 : Id1, 12&lt;/P&gt;&lt;P&gt;There is a table &lt;STRONG&gt;B&lt;/STRONG&gt; with one field : &lt;STRONG&gt;Id&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Record 1 : Id1&lt;/P&gt;&lt;P&gt;Record 2 : Id2&lt;/P&gt;&lt;P&gt;I would like to add a column in table &lt;STRONG&gt;B&lt;/STRONG&gt; with the quantity found in &lt;STRONG&gt;A&lt;/STRONG&gt;, or &lt;STRONG&gt;1&lt;/STRONG&gt; if there is no correspondence&lt;/P&gt;&lt;P&gt;Then, table B would be :&lt;/P&gt;&lt;P&gt;Record 1 : Id1, 12&lt;/P&gt;&lt;P&gt;Record 2 : Id2, 1&lt;/P&gt;&lt;P&gt;Do you have any idea ?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Dec 2009 22:15:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182250#M47980</guid>
      <dc:creator />
      <dc:date>2009-12-14T22:15:31Z</dc:date>
    </item>
    <item>
      <title>Scripting / Cartesian products and conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182251#M47981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's one way (untested):&lt;/P&gt;&lt;P style="padding-left:30px;"&gt;LEFT JOIN (B)&lt;BR /&gt;LOAD Id, Quantity as TempQuantity&lt;BR /&gt;RESIDENT A&lt;BR /&gt;;&lt;BR /&gt;DROP TABLE A&lt;BR /&gt;;&lt;BR /&gt;LEFT JOIN (B)&lt;BR /&gt;LOAD Id, if(len(TempQuantity),TempQuantity,1) as Quantity&lt;BR /&gt;RESIDENT B&lt;BR /&gt;;&lt;BR /&gt;DROP FIELD TempQuantity&lt;BR /&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Dec 2009 06:40:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182251#M47981</guid>
      <dc:creator>johnw</dc:creator>
      <dc:date>2009-12-15T06:40:28Z</dc:date>
    </item>
    <item>
      <title>Scripting / Cartesian products and conditions</title>
      <link>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182252#M47982</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;It perfectly works !&lt;/P&gt;&lt;P&gt;I thank you for having taken time to help me &lt;IMG alt="Smile" src="http://community.qlik.com/emoticons/emotion-1.gif" /&gt;&lt;/P&gt;&lt;P&gt;Pierre&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Dec 2009 15:18:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Scripting-Cartesian-products-and-conditions/m-p/182252#M47982</guid>
      <dc:creator />
      <dc:date>2009-12-15T15:18:34Z</dc:date>
    </item>
  </channel>
</rss>

