<?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 Re: Repeat the same SQL queries for multiple ODBC connections in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290484#M624653</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or maybe even simpler with a FOR EACH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR EACH vConnectionString in '&lt;EM&gt;String1&lt;/EM&gt;', '&lt;EM&gt;String2&lt;/EM&gt;', '&lt;EM&gt;String3&lt;/EM&gt;'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; CONNECT TO [$(vConnectionString)];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LOAD * FROM Table; // Will perform an AUTOCONCATENATE if tables are identical&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; DISCONNECT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Nov 2016 12:39:21 GMT</pubDate>
    <dc:creator>Peter_Cammaert</dc:creator>
    <dc:date>2016-11-22T12:39:21Z</dc:date>
    <item>
      <title>Repeat the same SQL queries for multiple ODBC connections</title>
      <link>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290480#M624649</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to find an efficient way to repeat the same LOAD statements and SQL queries for multiple ODBC connections. My current script looks like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIB CONNECT TO 'DB1';&lt;/P&gt;&lt;P&gt;LOAD ... ;&lt;/P&gt;&lt;P&gt;SQL ...;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LIB CONNECT TO 'DB2';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LOAD ... ;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;SQL ...;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LIB CONNECT TO 'DB3';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LOAD ... ;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;SQL ...;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;LIB CONNECT TO 'DB4';&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LOAD ... ;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;SQL ...;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;Is there a better way to do this? Because the SQL queries are quite long, can we avoid repeating the same&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;"&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;LOAD ... ;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;SQL ...;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;"&lt;SPAN style="font-size: 13.3333px;"&gt;?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 10:34:16 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290480#M624649</guid>
      <dc:creator />
      <dc:date>2016-11-22T10:34:16Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat the same SQL queries for multiple ODBC connections</title>
      <link>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290481#M624650</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can you just pop them in an include script and call that each time?&lt;/P&gt;&lt;P&gt;That is what I would do but there might be a better way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 10:40:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290481#M624650</guid>
      <dc:creator>adamdavi3s</dc:creator>
      <dc:date>2016-11-22T10:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat the same SQL queries for multiple ODBC connections</title>
      <link>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290482#M624651</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can set 2 variables for load and sql&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SET vLoad = Load FIELD1, FIELD2;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;SET vSQL = SQL SELECT &lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FIELD1, FIELD2&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;FROM TABLE1&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;where ..........;&lt;/EM&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;"&gt;&lt;EM&gt;LIB CONNECT TO 'DB1';&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;EM&gt;$(vLoad);&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;EM&gt;$(vSQL);&lt;/EM&gt;&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;&lt;SPAN style="font-weight: inherit; font-style: inherit; font-size: 13.3333px; font-family: inherit;"&gt;&lt;EM&gt;LIB CONNECT TO 'DB2';&lt;/EM&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;EM&gt;$(vLoad);&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;EM&gt;$(vSQL);&lt;/EM&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;&lt;/P&gt;&lt;P style="font-size: 13.3333px;"&gt;or maybe also in a for loop on your DB1...2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 10:43:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290482#M624651</guid>
      <dc:creator>maxgro</dc:creator>
      <dc:date>2016-11-22T10:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat the same SQL queries for multiple ODBC connections</title>
      <link>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290483#M624652</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe a loop to keep on changing the connection like below?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt;&amp;gt; List your connections here or load from excel file&lt;BR /&gt;DBConnList:&lt;BR /&gt;LOAD * INLINE [&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DBName&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DB1&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DB2&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DB3&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DB4&lt;BR /&gt;];&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LET vRowCount = NoOfRows('DBConnList');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for a = 1 to $(vRowCount)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;let vValueToRead = FieldValue( 'datafiles', $(a));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LIB CONNECT TO $(vValueToRead)&lt;/P&gt;&lt;P&gt;LOAD ... ;&lt;/P&gt;&lt;P&gt;SQL ...;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;NEXT &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 10:45:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290483#M624652</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-11-22T10:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat the same SQL queries for multiple ODBC connections</title>
      <link>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290484#M624653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Or maybe even simpler with a FOR EACH&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;FOR EACH vConnectionString in '&lt;EM&gt;String1&lt;/EM&gt;', '&lt;EM&gt;String2&lt;/EM&gt;', '&lt;EM&gt;String3&lt;/EM&gt;'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; CONNECT TO [$(vConnectionString)];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; Table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; LOAD * FROM Table; // Will perform an AUTOCONCATENATE if tables are identical&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; DISCONNECT;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;NEXT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Nov 2016 12:39:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290484#M624653</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-11-22T12:39:21Z</dc:date>
    </item>
    <item>
      <title>Re: Repeat the same SQL queries for multiple ODBC connections</title>
      <link>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290485#M624654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you all for your ideas.&lt;/P&gt;&lt;P&gt;All answers are awesome!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Nov 2016 01:51:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Repeat-the-same-SQL-queries-for-multiple-ODBC-connections/m-p/1290485#M624654</guid>
      <dc:creator />
      <dc:date>2016-11-23T01:51:27Z</dc:date>
    </item>
  </channel>
</rss>

