<?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: Using the First function in a Loop in Qlik Automate</title>
    <link>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2046769#M1453</link>
    <description>&lt;P&gt;It says&amp;nbsp;&lt;SPAN&gt;Connector reply error: SQL_ERROR, that is not an internal QlikView Error.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You have to use the correct syntax for your source database. That might not be&amp;nbsp;&lt;EM&gt;limit&lt;/EM&gt; or &lt;EM&gt;top &lt;/EM&gt;as I suggested. Did you check the link I provided?&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;So what database are you using?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 08 Mar 2023 12:30:49 GMT</pubDate>
    <dc:creator>E_Røse</dc:creator>
    <dc:date>2023-03-08T12:30:49Z</dc:date>
    <item>
      <title>Using the First function in a Loop</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044310#M1419</link>
      <description>&lt;P&gt;Please help&lt;/P&gt;
&lt;P&gt;I&amp;nbsp; am testing&amp;nbsp; a program that will upload multiple tables. To limit the test I introduce the function First 100 in the loop like:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;//Bepaal huidige saldo&lt;BR /&gt;Let MyMessage = '# Trek ' &amp;amp; '$(vTable)' &amp;amp; ' - ' &amp;amp; '$(vCountere)' &amp;amp; ' of ' &amp;amp; '$(vCountmax)';&lt;BR /&gt;Trace $(MyMessage);&lt;/P&gt;
&lt;P&gt;Noconcatenate&lt;BR /&gt;First 100&lt;BR /&gt;$(vTable)$(vRigting):&lt;BR /&gt;Load *&lt;BR /&gt;;Sql select * &lt;BR /&gt;From $(vTable);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[So this part of the code only extracts all fields from a selected table.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But this procedure is part of a loop, that will extract data from multiple tables.&lt;/P&gt;
&lt;P&gt;The first table's extraction is all clear.&amp;nbsp; But with the next table the following error is given.&lt;/P&gt;
&lt;P&gt;[QVX_UNEXPECTED_END_OF_DATA: The operation was canceled]&lt;/P&gt;
&lt;P&gt;If I remove the First 100 function, I do not experience the problem.(?)&lt;/P&gt;
&lt;P&gt;Why is First 100 function giving me an error on the second table.&amp;nbsp; I can start this loop at any table in my list, and the second table's extraction gives this error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 08:42:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044310#M1419</guid>
      <dc:creator>Marius_</dc:creator>
      <dc:date>2023-03-02T08:42:36Z</dc:date>
    </item>
    <item>
      <title>Re: Using the First function in a Loop</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044356#M1420</link>
      <description>&lt;P&gt;Not exactly what you asked, but it would be better to add your limit to within your sql query, using LIMIT 100 or TOP (100) depending on which SQL dialect you use.&lt;/P&gt;
&lt;P&gt;Please like and mark my answer as a solution, if it resolved your issue.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 10:27:54 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044356#M1420</guid>
      <dc:creator>E_Røse</dc:creator>
      <dc:date>2023-03-02T10:27:54Z</dc:date>
    </item>
    <item>
      <title>Re: Using the First function in a Loop</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044414#M1421</link>
      <description>&lt;P&gt;Hi Elin. Thanks for your response&lt;/P&gt;
&lt;P&gt;I upload 2 tables back to back&amp;nbsp; (With a loop)&lt;/P&gt;
&lt;P&gt;I want to limit the tables to 100 rows&lt;/P&gt;
&lt;P&gt;My Code use "First 100".&lt;/P&gt;
&lt;P&gt;My first query executes and is complete.&lt;/P&gt;
&lt;P&gt;The second query returns an error message - See above.&lt;/P&gt;
&lt;P&gt;If I REMOVE the "First 100" statements, the the whole code executes completely.&lt;/P&gt;
&lt;P&gt;Thus&lt;/P&gt;
&lt;P&gt;The&amp;nbsp; first "First 100" statement is causing an error with the second "First 100" code causing the load script to fail.&lt;/P&gt;
&lt;P&gt;I am not sure why?&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 11:37:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044414#M1421</guid>
      <dc:creator>Marius_</dc:creator>
      <dc:date>2023-03-02T11:37:12Z</dc:date>
    </item>
    <item>
      <title>Re: Using the First function in a Loop</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044427#M1422</link>
      <description>&lt;P&gt;I am not sure why either, but if you are loading the data from a database, you would want to add the limit to the SQL query. Otherwise the entire table will be imported first, and the you will keep only the first 100 rows.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Typically you could write&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Let MyMessage = '# Trek ' &amp;amp; '$(vTable)' &amp;amp; ' - ' &amp;amp; '$(vCountere)' &amp;amp; ' of ' &amp;amp; '$(vCountmax)';
Trace $(MyMessage);

Noconcatenate

$(vTable)$(vRigting):
Load *
;Sql select *
From $(vTable) LIMIT 100;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;or&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Let MyMessage = '# Trek ' &amp;amp; '$(vTable)' &amp;amp; ' - ' &amp;amp; '$(vCountere)' &amp;amp; ' of ' &amp;amp; '$(vCountmax)';
Trace $(MyMessage);

Noconcatenate
$(vTable)$(vRigting):
Load *
;Sql select TOP 100 *
From $(vTable);&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.w3schools.com/sql/sql_top.asp" target="_self"&gt;depending on your database.&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Please like and mark my answer as a solution, if it resolved your issue.&lt;/P&gt;</description>
      <pubDate>Thu, 02 Mar 2023 12:09:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2044427#M1422</guid>
      <dc:creator>E_Røse</dc:creator>
      <dc:date>2023-03-02T12:09:11Z</dc:date>
    </item>
    <item>
      <title>Re: Using the First function in a Loop</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2046758#M1452</link>
      <description>&lt;P&gt;Hi Elin&lt;/P&gt;
&lt;P&gt;Thanks for your suggestions, but the SQL code in my load script is not to happy in either suggestion:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[LIMIT 100]&lt;/P&gt;
&lt;P&gt;Custom connector error&lt;/P&gt;
&lt;P&gt;Connector reply error: SQL_ERROR&lt;BR /&gt;Message: "LIMIT" is invalid here (due to grammar).&lt;BR /&gt;contains an invalid character or it is a keyword.&lt;BR /&gt;(It might be possible to escape it using "!"). Or&lt;BR /&gt;a space is missing or there is one space too many&lt;/P&gt;
&lt;P&gt;Sql select *&lt;/P&gt;
&lt;P&gt;From [table] LIMIT 100&lt;/P&gt;
&lt;P&gt;OR&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[TOP 100]&lt;/P&gt;
&lt;P&gt;Custom connector error&lt;/P&gt;
&lt;P&gt;Connector reply error: SQL_ERROR&lt;BR /&gt;Message: "FROM" is invalid here (due to grammar).&lt;BR /&gt;contains an invalid character or it is a keyword.&lt;BR /&gt;(It might be possible to escape it using "!"). Or&lt;BR /&gt;a space is missing or there is one space too many&lt;/P&gt;
&lt;P&gt;Sql select top 100 *&lt;/P&gt;
&lt;P&gt;I&amp;nbsp; think it is an internal Qlikview code error&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 12:17:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2046758#M1452</guid>
      <dc:creator>Marius_</dc:creator>
      <dc:date>2023-03-08T12:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Using the First function in a Loop</title>
      <link>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2046769#M1453</link>
      <description>&lt;P&gt;It says&amp;nbsp;&lt;SPAN&gt;Connector reply error: SQL_ERROR, that is not an internal QlikView Error.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You have to use the correct syntax for your source database. That might not be&amp;nbsp;&lt;EM&gt;limit&lt;/EM&gt; or &lt;EM&gt;top &lt;/EM&gt;as I suggested. Did you check the link I provided?&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;So what database are you using?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Mar 2023 12:30:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Qlik-Automate/Using-the-First-function-in-a-Loop/m-p/2046769#M1453</guid>
      <dc:creator>E_Røse</dc:creator>
      <dc:date>2023-03-08T12:30:49Z</dc:date>
    </item>
  </channel>
</rss>

