<?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 Avoiding circular loops caused by synthetic keys in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195750#M56131</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In general, to remove synthetic keys, replace all the fields in that synthetic key with a concatenated field, i.e. for your Year, Month and Office fields add a new field (Year &amp;amp; '|' &amp;amp; Month &amp;amp; '|' &amp;amp; Office as KeyField). You can even make this an Autonumber value. If you want the individual fields, create a new table containing the individual fields and the concatenated key field, but do not hold the individual fields in the other tables (or make them unique).&lt;/P&gt;&lt;P&gt;Note the use of '|' as a separating character - it does not matter what you use as long as it does not occur in your data. Without the separator, you may not have unique values; i.e. joining "01" to "001" without a separator gives "01001", as does joining "010" and "01".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 23 Sep 2009 16:06:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-09-23T16:06:19Z</dc:date>
    <item>
      <title>Avoiding circular loops caused by synthetic keys</title>
      <link>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195748#M56129</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello all.&lt;/P&gt;&lt;P&gt;This is my first post on this forum.&lt;/P&gt;&lt;P&gt;In order to set up a dashboard, I am loading data from various files such as invoices, offers, and so on.&lt;/P&gt;&lt;P&gt;Each sheet of the dashboard focuses on one type of data (again, invoices, offers and so on) and I have three selection criterias : Year, Month and Office. The idea is that on the first sheet of the dashboard, I select Year, Month and office and the table are refreshed accordingly on all sheets.&lt;/P&gt;&lt;P&gt;In the script, I add flelds Year, Month and Office with AS statements based on invoices dates, offers dates, ... as follows:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;LOAD&lt;BR /&gt;InvoiceNumber,&lt;BR /&gt;Office,&lt;BR /&gt;...,&lt;BR /&gt;Left(InvoiceDate,4) as Year,&lt;BR /&gt;Mid(InvoiceDate,5,2) as Month&lt;BR /&gt;FROM C:\Invoices.TXT ....&lt;/P&gt;&lt;P&gt;So I end up with all tables linked by a synthetic key containing Office, Year, Month.&lt;/P&gt;&lt;P&gt;As some tables are linked by other fields (such as OfferNumber which is part of Invoices and Offers), I end up with a circular loop problem and the script will not load (by the way, when executing the script on Qv 8.5, I get the circular reference error meesage, while with Qv 9 i only get a script error with no further details).&lt;/P&gt;&lt;P&gt;To avoid this, I can :&lt;/P&gt;&lt;P&gt;1°) Qualify the tables or rename the Year, Month and office field for each loaded file: the problem is that I will have to use a Year, Month and Office selector on each sheet (Invoices.Year, Offers.Year,...) and then select manually the Year, Month and Office on each sheet.&lt;/P&gt;&lt;P&gt;2°) Loosen the tables : no synthetic key is created, but this could lead to collateral damages.&lt;/P&gt;&lt;P&gt;I think the 1°) would be the best way to do it, but how can I automatically set all the sheets selectors for Month, Year and Office at the same time ?&lt;/P&gt;&lt;P&gt;Thanks beforehand.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 15:27:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195748#M56129</guid>
      <dc:creator />
      <dc:date>2009-09-23T15:27:21Z</dc:date>
    </item>
    <item>
      <title>Avoiding circular loops caused by synthetic keys</title>
      <link>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195749#M56130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vincent,&lt;/P&gt;&lt;P&gt;In my experience, never loosen the tables.&lt;/P&gt;&lt;P&gt;One way to reduce the synthetic keys with dates is to only hold the date itself in the tables and create a calendar table that breaks the date down into years/months/quarter:&lt;/P&gt;&lt;P&gt;tab1:&lt;/P&gt;&lt;P&gt;load date,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;from source1;&lt;/P&gt;&lt;P&gt;tab2:&lt;/P&gt;&lt;P&gt;load date,&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;from source2;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tCalendar:&lt;/P&gt;&lt;P&gt;load distinct date&lt;/P&gt;&lt;P&gt;resident tab1;&lt;/P&gt;&lt;P&gt;load distinct date&lt;/P&gt;&lt;P&gt;resident tab2;&lt;/P&gt;&lt;P&gt;calendar:&lt;/P&gt;&lt;P&gt;load date,&lt;/P&gt;&lt;P&gt;month(date) as month,&lt;/P&gt;&lt;P&gt;....&lt;/P&gt;&lt;P&gt;resident tCalendar;&lt;/P&gt;&lt;P&gt;drop table tCalendar;&lt;/P&gt;&lt;P&gt;The looping is another problem that you can only solve by looking at the data structure. For example, would it make sense to create a link between the invoices and offers tables on just the offer number so that when invoices are selected by date, only the corresponding offers are selected?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Gordon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 15:55:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195749#M56130</guid>
      <dc:creator />
      <dc:date>2009-09-23T15:55:27Z</dc:date>
    </item>
    <item>
      <title>Avoiding circular loops caused by synthetic keys</title>
      <link>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195750#M56131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In general, to remove synthetic keys, replace all the fields in that synthetic key with a concatenated field, i.e. for your Year, Month and Office fields add a new field (Year &amp;amp; '|' &amp;amp; Month &amp;amp; '|' &amp;amp; Office as KeyField). You can even make this an Autonumber value. If you want the individual fields, create a new table containing the individual fields and the concatenated key field, but do not hold the individual fields in the other tables (or make them unique).&lt;/P&gt;&lt;P&gt;Note the use of '|' as a separating character - it does not matter what you use as long as it does not occur in your data. Without the separator, you may not have unique values; i.e. joining "01" to "001" without a separator gives "01001", as does joining "010" and "01".&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 16:06:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195750#M56131</guid>
      <dc:creator />
      <dc:date>2009-09-23T16:06:19Z</dc:date>
    </item>
    <item>
      <title>Avoiding circular loops caused by synthetic keys</title>
      <link>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195751#M56132</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You guys are great.&lt;/P&gt;&lt;P&gt;I used a mix of both answers to solve my problem.&lt;/P&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Vincent&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Sep 2009 20:34:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Avoiding-circular-loops-caused-by-synthetic-keys/m-p/195751#M56132</guid>
      <dc:creator />
      <dc:date>2009-09-23T20:34:23Z</dc:date>
    </item>
  </channel>
</rss>

