<?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 Synthetic Key Question in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333612#M29142</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have three tables that capture information on annuity contracts my company sells:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Customer&lt;/SPAN&gt; (include Customer ID field, and various other customer-related fields)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Sales&lt;/SPAN&gt; (has Customer ID, Subaccount ID, and various deposit transaction amounts, dates, etc.)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Account Values&lt;/SPAN&gt; (has Customer ID, Subaccount ID, and various daily/monthly account value amounts)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The Sales table and the Account Values tables each have millions of records in them, and the Customer table has around 1 million records.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my app, I'd like users to be able to select a specific subaccount (such as Vanguard S&amp;amp;P 500 Fund), and then be able to see total deposits into that subaccount, account values at various points in time, and finally, which customers have any money/activity in that subaccount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I don't do any aliasing, loading these tables as is creates a synthetic key between the Sales and Account Values tables, on Customer ID and Subaccount ID.&amp;nbsp; That's what I've chosen to allow, based on research I've done where people have mentioned that synthetic keys aren't necessarily "bad", as long as you expect them to happen.&amp;nbsp; However, I want to confirm that, and make sure I'm not creating an inefficient data model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I can create my own key - such as: autonumberhash128("Customer ID"&amp;amp;'-'&amp;amp;"Subaccount ID") as Customer_Subaccount_Key.&amp;nbsp; &lt;/P&gt;&lt;P&gt;However, I still need the Sales and Account Values tables to join to the Customer table, so it seems that I would still have synthetic keys somewhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Am I OK using a synthetic key here, or is there a better solution?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 27 Apr 2017 16:21:27 GMT</pubDate>
    <dc:creator>steverosebrook</dc:creator>
    <dc:date>2017-04-27T16:21:27Z</dc:date>
    <item>
      <title>Synthetic Key Question</title>
      <link>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333612#M29142</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have three tables that capture information on annuity contracts my company sells:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Customer&lt;/SPAN&gt; (include Customer ID field, and various other customer-related fields)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Sales&lt;/SPAN&gt; (has Customer ID, Subaccount ID, and various deposit transaction amounts, dates, etc.)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;Account Values&lt;/SPAN&gt; (has Customer ID, Subaccount ID, and various daily/monthly account value amounts)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;The Sales table and the Account Values tables each have millions of records in them, and the Customer table has around 1 million records.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my app, I'd like users to be able to select a specific subaccount (such as Vanguard S&amp;amp;P 500 Fund), and then be able to see total deposits into that subaccount, account values at various points in time, and finally, which customers have any money/activity in that subaccount.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I don't do any aliasing, loading these tables as is creates a synthetic key between the Sales and Account Values tables, on Customer ID and Subaccount ID.&amp;nbsp; That's what I've chosen to allow, based on research I've done where people have mentioned that synthetic keys aren't necessarily "bad", as long as you expect them to happen.&amp;nbsp; However, I want to confirm that, and make sure I'm not creating an inefficient data model.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I know I can create my own key - such as: autonumberhash128("Customer ID"&amp;amp;'-'&amp;amp;"Subaccount ID") as Customer_Subaccount_Key.&amp;nbsp; &lt;/P&gt;&lt;P&gt;However, I still need the Sales and Account Values tables to join to the Customer table, so it seems that I would still have synthetic keys somewhere.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Am I OK using a synthetic key here, or is there a better solution?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 16:21:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333612#M29142</guid>
      <dc:creator>steverosebrook</dc:creator>
      <dc:date>2017-04-27T16:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Key Question</title>
      <link>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333613#M29143</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Synthetic keys are sometimes ok, sometimes bad &amp;amp; sometimes disastrous.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I once heard an interesting discussion about s&lt;SPAN style="font-size: 13.3333px;"&gt;ynthetic keys &lt;/SPAN&gt;by 2 Qlik Masters.&amp;nbsp; One arguing they are a sign of sloppy data modelling and the other arguing they are sign of sloppy scripting.&amp;nbsp; They both agreed they are the sign of something sloppy though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would suggest getting rid of synthetic keys where possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 8pt;"&gt;[The only truly ok synthetic key in my opinion is the one created by the IntervalMatch() function.]&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 16:57:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333613#M29143</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-27T16:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Key Question</title>
      <link>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333614#M29144</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The "Sales" and "Account Values" table have 2 variables in common and Qlik automatically associates those 2 by forming a synthetic key. However, you can force those 2 tables to be associated ONLY on Customer ID.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let's assume you have already loaded the "Customer" and "Sales" table. Now when you load the "Account Values" table, &lt;/P&gt;&lt;P&gt;use the Qualify and Unqualify statements as shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;QUALIFY subaccount_id;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;account_values:&lt;/P&gt;&lt;P&gt;LOAD&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; customer_id,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; subaccount_id&lt;/P&gt;&lt;P&gt;FROM ...account_values... ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;UNQUALIFY *;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;What this does is, it forces the tables to be joined on customer_id by adding the table name as prefix to the subaccount_id. So the subaccount_id from "Account Values" table will be renamed as account_values.subaccount_id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 18:30:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333614#M29144</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-04-27T18:30:07Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Key Question</title>
      <link>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333615#M29145</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3064"&gt;Synthetic Keys&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 18:36:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333615#M29145</guid>
      <dc:creator>m_woolf</dc:creator>
      <dc:date>2017-04-27T18:36:18Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Key Question</title>
      <link>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333616#M29146</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ashwin - this is a good point.&amp;nbsp; In fact, in our first app, I actually did this very thing: I aliased the Sales table Subaccount field as "Subaccount (Sales)", and the Account Value Subaccount field as "Subaccount (Acct Val)".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, this forces the user to have to choose from among two different Subaccount fields, depending on whether they want to view Sales totals or Account Value totals.&amp;nbsp; This was confusing to users - especially when they would filter on the sales-based Subaccount field and try to look at a sheet with account values on it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In subsequent apps, I decided to just allow the synthetic key to happen, so users would only need to worry about one Subaccount field.&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, this generally seems to have worked fine: no issues with app loads or app performance.&amp;nbsp; So based on my personal experience, I see nothing wrong with the synthetic key approach.&amp;nbsp; I'm just wanting more feedback from other developers to see if there's any "gotchas" that may arise, or better solutions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Apr 2017 18:54:14 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333616#M29146</guid>
      <dc:creator>steverosebrook</dc:creator>
      <dc:date>2017-04-27T18:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Synthetic Key Question</title>
      <link>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333617#M29147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't think there is anything wrong with this synthetic key, as it appears to be legitimate from a data model perspective.&amp;nbsp; As long as you are getting decent performance, I would leave it as is. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you wanted to get rid of the synkey, a classic approach would be to concatenate Sales and Account into a single table and then only link to the Customer table.&amp;nbsp; However, then you may have to deal with propagating dimension values, extra work.&amp;nbsp; So if the Syn Key is working for you, I would move on to the next project. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Apr 2017 01:32:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Synthetic-Key-Question/m-p/1333617#M29147</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2017-04-28T01:32:16Z</dc:date>
    </item>
  </channel>
</rss>

