<?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 2 Database connections and a where clause using both in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107795#M761545</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope someone can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking to use data from two different database connections and utilise one set of data I pull in the where clause of the second set of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that you can’t have two connections open at the same time but I can pull one data source and then the other and then join the tables.&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;However in my second data set I need to apply a where clause from my first data set. &lt;/SPAN&gt;&amp;nbsp; This would be because otherwise the second data pull would be incredibly large as Table 2 contains every possible date occurrence and each different date the ID could be aligned to a different person. (I have a separate table for people which I have not included below)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to do something like the below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Database Connection 1&lt;/P&gt;&lt;P&gt;Table 1:&lt;/P&gt;&lt;P&gt;DataField&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right join(Table 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Database Connection 2&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;Product&lt;/P&gt;&lt;P&gt;Date of Product&lt;/P&gt;&lt;P&gt;Where (Datefield = Date of Product)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
    <dc:creator>alwayslearning</dc:creator>
    <dc:date>2020-11-25T16:16:04Z</dc:date>
    <item>
      <title>2 Database connections and a where clause using both</title>
      <link>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107795#M761545</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope someone can help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking to use data from two different database connections and utilise one set of data I pull in the where clause of the second set of data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I understand that you can’t have two connections open at the same time but I can pull one data source and then the other and then join the tables.&amp;nbsp; &lt;SPAN style="text-decoration: underline;"&gt;However in my second data set I need to apply a where clause from my first data set. &lt;/SPAN&gt;&amp;nbsp; This would be because otherwise the second data pull would be incredibly large as Table 2 contains every possible date occurrence and each different date the ID could be aligned to a different person. (I have a separate table for people which I have not included below)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to do something like the below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Database Connection 1&lt;/P&gt;&lt;P&gt;Table 1:&lt;/P&gt;&lt;P&gt;DataField&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;right join(Table 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Database Connection 2&lt;/P&gt;&lt;P&gt;Table 2:&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;Product&lt;/P&gt;&lt;P&gt;Date of Product&lt;/P&gt;&lt;P&gt;Where (Datefield = Date of Product)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2020 16:16:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107795#M761545</guid>
      <dc:creator>alwayslearning</dc:creator>
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: 2 Database connections and a where clause using both</title>
      <link>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107796#M761546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try like this.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/qlik-blogpost/3539"&gt;Merging Data from Multiple Sources&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f5faf0;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ODBC CONNECT TO&lt;/SPAN&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #800000;"&gt;&amp;lt;Database 1&amp;gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f5faf0;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SQL SELECT&lt;/SPAN&gt; * &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0000ff;"&gt;FROM&lt;/SPAN&gt; Customers;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f5faf0;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ODBC CONNECT TO&lt;/SPAN&gt; &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #800000;"&gt;&amp;lt;Database 2&amp;gt;&lt;/SPAN&gt;;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d; background-color: #f5faf0;"&gt;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0000ff;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Concatenate SQL SELECT&lt;/SPAN&gt; * &lt;SPAN style="font-weight: inherit; font-style: inherit; font-family: inherit; color: #0000ff;"&gt;FROM&lt;/SPAN&gt; Customers;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2018 08:56:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107796#M761546</guid>
      <dc:creator>qlikviewwizard</dc:creator>
      <dc:date>2018-08-06T08:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: 2 Database connections and a where clause using both</title>
      <link>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107797#M761547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First, consider loading the full second table and then joining in QlikView, if possible. Even if the table is large, this shouldn't be too big a problem. However, I understand that this may not be feasible, in which case...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure if it's feasible for large data volumes (it may be even slower than loading the full data depending on your data sources), but you could loop-load the second connection for each line in the first connection. The code I've included may not be entirely accurate, but you should be able to adapt it from &lt;A href="https://community.qlik.com/qlik-blogpost/3274"&gt;Loops in the Script&lt;/A&gt; if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Database Connection 1&lt;/P&gt;&lt;P&gt;Table1:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;DateField&lt;/P&gt;&lt;P&gt;ID;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;For&lt;/SPAN&gt; &lt;EM&gt;vRowNum&lt;/EM&gt;= 1 &lt;SPAN style="color: #0000ff;"&gt;to NoOfRows&lt;/SPAN&gt;('Table1')&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Let&lt;/SPAN&gt; &lt;EM&gt;vWhereClause&lt;/EM&gt; = &lt;SPAN style="color: #0000ff;"&gt;Peek&lt;/SPAN&gt;('DateField',&lt;EM&gt;vRowNum&lt;/EM&gt;-1,'Table1');&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;ID&lt;/P&gt;&lt;P&gt;Product&lt;/P&gt;&lt;P&gt;Date of Product&lt;/P&gt;&lt;P&gt;Where $(&lt;EM&gt;vWhereClause)&lt;/EM&gt;= Date of Product;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;Next&lt;/SPAN&gt; &lt;EM&gt;vRowNum&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2018 09:12:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107797#M761547</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2018-08-06T09:12:30Z</dc:date>
    </item>
    <item>
      <title>Re: 2 Database connections and a where clause using both</title>
      <link>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107798#M761548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try using Exists function:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Database Connection 1&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Table 1:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;DataField&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;ID&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;right join(Table 1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Database Connection 2&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Table 2:&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;ID&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Product&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Date of Product&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Where Exists(Datefield, Date of Product)&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Thanks,&lt;/P&gt;&lt;P style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;Pooja&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 06 Aug 2018 09:34:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/2-Database-connections-and-a-where-clause-using-both/m-p/107798#M761548</guid>
      <dc:creator>pooja_prabhu_n</dc:creator>
      <dc:date>2018-08-06T09:34:39Z</dc:date>
    </item>
  </channel>
</rss>

