<?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: Problem Loading Excels stored in two different Sharepoint sites in Connectivity &amp; Data Prep</title>
    <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Problem-Loading-Excels-stored-in-two-different-Sharepoint-sites/m-p/1761264#M5552</link>
    <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/92726"&gt;@Enriquemmesteo&lt;/a&gt;&amp;nbsp;Maybe the following Design Blog may be of some help as it is along these lines, but I am not sure:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Loops-in-the-Script/ba-p/1473543" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Loops-in-the-Script/ba-p/1473543&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
    <pubDate>Thu, 12 Nov 2020 17:06:34 GMT</pubDate>
    <dc:creator>Brett_Bleess</dc:creator>
    <dc:date>2020-11-12T17:06:34Z</dc:date>
    <item>
      <title>Problem Loading Excels stored in two different Sharepoint sites</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Problem-Loading-Excels-stored-in-two-different-Sharepoint-sites/m-p/1757199#M5514</link>
      <description>&lt;P&gt;Hello everybody,&lt;/P&gt;&lt;P&gt;this issue has me going crazy lately cause I can't make it work. Let's see if anybody can help me with this.&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Here are the &lt;STRONG&gt;requirements:&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I have to load data from excel files stored in two different Sharepoint sites. Let's call them "&lt;STRONG&gt;Site1&lt;/STRONG&gt;" and "&lt;STRONG&gt;Site2&lt;/STRONG&gt;".&lt;/LI&gt;&lt;LI&gt;I need to load one sheet from each file, which for "Site2" is always called "&lt;STRONG&gt;SheetA&lt;/STRONG&gt;" but for "Site2" it is called "&lt;STRONG&gt;SheetA&lt;/STRONG&gt;" sometimes and "&lt;STRONG&gt;SheetB&lt;/STRONG&gt;" others.&lt;/LI&gt;&lt;LI&gt;The structure of the data is essentially the same for all the files.&lt;/LI&gt;&lt;/UL&gt;&lt;OL&gt;&lt;LI&gt;I think to get it working for just one Site using variables, &lt;EM&gt;here is the script:&lt;/EM&gt;&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;let vQwcConnectionName = 'lib://Share_Point';&lt;BR /&gt;// Get Checklist ID list&lt;BR /&gt;Office365Connector_ListFiles:&lt;BR /&gt;LOAD&lt;BR /&gt;UniqueId as ListFiles_UniqueId&lt;BR /&gt;FROM [$(vQwcConnectionName)]&lt;BR /&gt;(URL IS [&lt;STRONG&gt;Site1_URL&lt;/STRONG&gt;, qvx);&lt;/P&gt;&lt;P&gt;Table_0:&lt;BR /&gt;Load&lt;BR /&gt;'dummy' as dummyfield&lt;BR /&gt;AutoGenerate (0);&lt;/P&gt;&lt;P&gt;// Load Files&lt;/P&gt;&lt;P&gt;Let ErrorMode = 0; //To make sure it keeps loading if it doesn't&amp;nbsp;&lt;/P&gt;&lt;P&gt;Set a = 1;&lt;/P&gt;&lt;P&gt;Let b = FieldValueCount('ListFiles_UniqueId');&lt;/P&gt;&lt;P&gt;Do while a &amp;lt;= FieldValueCount('ListFiles_UniqueId')&lt;/P&gt;&lt;P&gt;Let vFileID = FieldValue('ListFiles_UniqueId', a);&lt;/P&gt;&lt;P&gt;FOR EACH vSheet in '[Sheet1]','[Sheet2]';&lt;/P&gt;&lt;P&gt;EXCEL_FILES:&lt;BR /&gt;Load&lt;/P&gt;&lt;P&gt;fields&lt;BR /&gt;&lt;BR /&gt;FROM [&lt;A href="http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%2f" target="_blank"&gt;http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%2f&lt;/A&gt;&lt;STRONG&gt;Site1&lt;/STRONG&gt;%2f&amp;amp;fileId=$(vFileID)&amp;amp;appID=]&lt;BR /&gt;(ooxml, no labels, table is $(vSheet));&lt;BR /&gt;&lt;BR /&gt;NEXT vSheet&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End If;&lt;/P&gt;&lt;P&gt;Let a = a + 1;&lt;/P&gt;&lt;P&gt;loop&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//////END OF SCRIPT VERSION1////&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Now, this version works to load all the files from one of the Sharepoints, though I would like to optimize the load.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the Load From statement is for each Site:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;[&lt;A href="http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%2f" target="_blank"&gt;http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%2f&lt;/A&gt;&lt;STRONG&gt;Site1&lt;/STRONG&gt;%2f&amp;amp;fileId=$(vFileID)&amp;amp;appID=]&lt;BR /&gt;(ooxml, no labels, table is $(vSheet))&lt;/LI&gt;&lt;LI&gt;[&lt;A href="http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%2f" target="_blank"&gt;http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%2f&lt;/A&gt;&lt;STRONG&gt;Site2&lt;/STRONG&gt;%2f&amp;amp;fileId=$(vFileID)&amp;amp;appID=]&lt;BR /&gt;(ooxml, no labels, table is $(vSheet))&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;So there is no reason why I should't be able to change the script before using a variable called &lt;STRONG&gt;vSite.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Here is that script:&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;let vQwcConnectionName = 'lib://Share_Point';&lt;/P&gt;&lt;P&gt;// Get Site1 files ID list&lt;/P&gt;&lt;P&gt;Office365Connector_ListFiles:&lt;BR /&gt;LOAD&lt;BR /&gt;UniqueId as ListFiles_UniqueId&lt;BR /&gt;FROM [$(vQwcConnectionName)]&lt;BR /&gt;(URL IS [&lt;STRONG&gt;Site1_URL&lt;/STRONG&gt;], qvx);&lt;BR /&gt;//Get Site2 files ID&lt;BR /&gt;concatenate&lt;BR /&gt;LOAD&lt;BR /&gt;UniqueId as ListFiles_UniqueId,&lt;/P&gt;&lt;P&gt;FROM [$(vQwcConnectionName)]&lt;BR /&gt;(URL IS [&lt;STRONG&gt;Site2_UR&lt;/STRONG&gt;&lt;SPAN&gt;&lt;STRONG&gt;L&lt;/STRONG&gt;], qvx);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Table_0:&lt;BR /&gt;Load&lt;BR /&gt;'dummy' as dummyfield&lt;BR /&gt;AutoGenerate (0);&lt;BR /&gt;Let ErrorMode = 0;&lt;/P&gt;&lt;P&gt;Set a = 1;&lt;/P&gt;&lt;P&gt;Let b = FieldValueCount('ListFiles_UniqueId');&lt;/P&gt;&lt;P&gt;Do while a &amp;lt;= FieldValueCount('ListFiles_UniqueId')&lt;BR /&gt;//files from each site have it as prefix&lt;BR /&gt;Let &lt;STRONG&gt;vRoute&lt;/STRONG&gt; =if(left(FieldValue('ListFiles_Name', a),5)='Site1','&lt;STRONG&gt;Site1&lt;/STRONG&gt;%2f&amp;amp;fileId=',&lt;BR /&gt;if(left(FieldValue('ListFiles_Name', a),5)='Site2','&lt;STRONG&gt;Site2&lt;/STRONG&gt;%2f&amp;amp;fileId='));&lt;/P&gt;&lt;P&gt;Let &lt;STRONG&gt;vFileID&lt;/STRONG&gt; = FieldValue('ListFiles_UniqueId', a);&lt;BR /&gt;let &lt;STRONG&gt;vROOT&lt;/STRONG&gt; ='&lt;A href="http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%'&amp;amp;vRoutevFileID&amp;amp;'&amp;amp;appID=" target="_blank"&gt;http://localhost:5555/data?connectorID=Office365Connector&amp;amp;table=GetFile&amp;amp;subSite=%2fsites%'&amp;amp;vRoutevFileID&amp;amp;'&amp;amp;appID=&lt;/A&gt;';&lt;BR /&gt;FOR EACH &lt;STRONG&gt;vSheet&lt;/STRONG&gt; in '[Sheet1]','[Sheet2]';&lt;BR /&gt;EXCEL_FILES:&lt;BR /&gt;Load&lt;BR /&gt;fields&lt;BR /&gt;&lt;BR /&gt;FROM [$(vROOT)]&lt;BR /&gt;(ooxml, no labels, table is $(vSheet));&lt;BR /&gt;&lt;BR /&gt;NEXT vSheet&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;End If;&lt;/P&gt;&lt;P&gt;Let a = a + 1;&lt;/P&gt;&lt;P&gt;loop&lt;/P&gt;&lt;P&gt;This gives me INTERNAL SERVER ERROR&lt;/P&gt;</description>
      <pubDate>Tue, 28 Dec 2021 20:02:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Problem-Loading-Excels-stored-in-two-different-Sharepoint-sites/m-p/1757199#M5514</guid>
      <dc:creator>Enriquemmesteo</dc:creator>
      <dc:date>2021-12-28T20:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problem Loading Excels stored in two different Sharepoint sites</title>
      <link>https://community.qlik.com/t5/Connectivity-Data-Prep/Problem-Loading-Excels-stored-in-two-different-Sharepoint-sites/m-p/1761264#M5552</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/92726"&gt;@Enriquemmesteo&lt;/a&gt;&amp;nbsp;Maybe the following Design Blog may be of some help as it is along these lines, but I am not sure:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.qlik.com/t5/Qlik-Design-Blog/Loops-in-the-Script/ba-p/1473543" target="_blank"&gt;https://community.qlik.com/t5/Qlik-Design-Blog/Loops-in-the-Script/ba-p/1473543&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Brett&lt;/P&gt;</description>
      <pubDate>Thu, 12 Nov 2020 17:06:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Connectivity-Data-Prep/Problem-Loading-Excels-stored-in-two-different-Sharepoint-sites/m-p/1761264#M5552</guid>
      <dc:creator>Brett_Bleess</dc:creator>
      <dc:date>2020-11-12T17:06:34Z</dc:date>
    </item>
  </channel>
</rss>

