<?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: Who is interpreting the functions when loading data in a Script? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325263#M119820</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you are not using an explicit LOAD statement, all the info you are loading into QlikView comes as it is returned by your driver. Indeed, all that SQL SELECT statement is not executed by QlikView, but by your driver. What you can do and is strongly recommended is to use that LOAD statement to control data, and leave the SQL statements as simple as possible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt;Table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt;LOAD date, // the original field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week(Date) AS WeekField; // QlikView Week() function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt; &lt;/SPAN&gt;SQL&lt;/P&gt;&lt;P&gt;SELECT date&lt;/P&gt;&lt;P&gt;FROM myas400file;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Who interprets functions then? In the LOAD part, QlikView, in the SQL SELECT part your driver or your database manager. Think of a CAST() function. Will it work? Yes, if you use it in the SQL part, but it will not in the LOAD part, because CAST() is not a function in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small active_link" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: There is an interesting discussion on the LOAD / SELECT in &lt;A _jive_internal="true" href="https://community.qlik.com/thread/13682"&gt;this message&lt;/A&gt;. There are some others in the QlikCommunity in the same sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Oct 2011 16:13:22 GMT</pubDate>
    <dc:creator>Miguel_Angel_Baeyens</dc:creator>
    <dc:date>2011-10-10T16:13:22Z</dc:date>
    <item>
      <title>Who is interpreting the functions when loading data in a Script?</title>
      <link>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325262#M119819</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN lang="EN-GB" style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;"&gt;I will try to explain my question with an example:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;"&gt;If I create a text object with &lt;STRONG style="font-family: &amp;amp;quot; Arial&amp;amp;quot;"&gt;=Week('2011-01-05')&lt;/STRONG&gt; I get &lt;STRONG style="font-family: &amp;amp;quot; Arial&amp;amp;quot;"&gt;1&lt;/STRONG&gt; as result, which is correct according to ISO 8601 and to what is described in the QV Reference Manual (week number 1 is that containing the January 4th).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;"&gt;But now suppose that I’m loading a table from a file which is in another system (AS400 in this case):&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN lang="EN-GB" style="color: #333333; font-family: &amp;amp;quot;Arial&amp;amp;quot;,&amp;amp;quot;sans-serif&amp;amp;quot;; font-size: 10pt; mso-ansi-language: EN-GB;"&gt;SQL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;SELECT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;&lt;SPAN style="mso-tab-count: 1;"&gt; &lt;/SPAN&gt;bla, bla, bla,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;&lt;SPAN style="mso-tab-count: 1;"&gt; &lt;/SPAN&gt;Week(date) as Myweek;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;&lt;SPAN style="mso-tab-count: 1;"&gt; &lt;/SPAN&gt;bla, bla, bla&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;FROM myas400file&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;When I look at the table I realize that the week has not been calculated according to the QV description of the week() function (now, week number 1 is that containing January 1st), so I guess that the other system has executed the function in the SQL instruction (which is logical).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;How can I force that QV retrieves &lt;STRONG&gt;date&lt;/STRONG&gt; and uses its &lt;STRONG&gt;week()&lt;/STRONG&gt; function to calculate &lt;STRONG&gt;Myweek&lt;/STRONG&gt; within the same load iteration?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;Do I need to first load the table and then iterate over it to calculate Myweek using the QV function?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;If so, Can someone give me a hint on the code?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="MsoNormal" style="margin: 0cm 0cm 0pt;"&gt;&lt;SPAN style="color: #000000; font-size: 12pt; mso-ansi-language: EN-GB; font-family: Calibri;"&gt;Thanks. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: Times New Roman; font-size: 12pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 16:00:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325262#M119819</guid>
      <dc:creator />
      <dc:date>2011-10-10T16:00:30Z</dc:date>
    </item>
    <item>
      <title>Re: Who is interpreting the functions when loading data in a Script?</title>
      <link>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325263#M119820</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI Carlos,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you are not using an explicit LOAD statement, all the info you are loading into QlikView comes as it is returned by your driver. Indeed, all that SQL SELECT statement is not executed by QlikView, but by your driver. What you can do and is strongly recommended is to use that LOAD statement to control data, and leave the SQL statements as simple as possible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code"&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt;Table:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt;LOAD date, // the original field&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Week(Date) AS WeekField; // QlikView Week() function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB"&gt; &lt;/SPAN&gt;SQL&lt;/P&gt;&lt;P&gt;SELECT date&lt;/P&gt;&lt;P&gt;FROM myas400file;&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Who interprets functions then? In the LOAD part, QlikView, in the SQL SELECT part your driver or your database manager. Think of a CAST() function. Will it work? Yes, if you use it in the SQL part, but it will not in the LOAD part, because CAST() is not a function in QlikView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.qlik.com/people/mabaeyens" style="font-size: 12px; outline-style: none; padding-top: 1px; padding-bottom: 1px; padding-left: 17px; color: #007fc0; zoom: 1; background-position: no-repeat no-repeat;"&gt;Miguel Angel Baeyens&lt;/A&gt;&lt;/P&gt;&lt;P&gt;BI Consultant&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small active_link" href="http://www.grupocomex.com/" style="font-size: 12px; outline-style: none; color: #007fc0;"&gt;Comex Grupo Ibérica&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: There is an interesting discussion on the LOAD / SELECT in &lt;A _jive_internal="true" href="https://community.qlik.com/thread/13682"&gt;this message&lt;/A&gt;. There are some others in the QlikCommunity in the same sense.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 16:13:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325263#M119820</guid>
      <dc:creator>Miguel_Angel_Baeyens</dc:creator>
      <dc:date>2011-10-10T16:13:22Z</dc:date>
    </item>
    <item>
      <title>Who is interpreting the functions when loading data in a Script?</title>
      <link>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325264#M119821</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;you could use the QV functions in a preceding LOAD, like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *,&lt;/P&gt;&lt;P&gt;week(date) as myWeek;&lt;/P&gt;&lt;P&gt;&lt;SPAN lang="EN-GB" style="color: #333333;"&gt;SQL&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;SELECT&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt; bla, bla, bla,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;date,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt; bla, bla, bla&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt; &lt;SPAN style="color: #000000; font-family: Calibri; font-size: 12pt;"&gt;FROM myas400file&lt;/SPAN&gt;&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;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 16:16:23 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325264#M119821</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2011-10-10T16:16:23Z</dc:date>
    </item>
    <item>
      <title>Who is interpreting the functions when loading data in a Script?</title>
      <link>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325265#M119822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks to both.&lt;/P&gt;&lt;P&gt;Problem solved, appart from having understood what LOAD and SQL do.&lt;/P&gt;&lt;P&gt;I agree with you in regards of using always LOAD, regardless SQL itself doing the job.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Oct 2011 17:32:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Who-is-interpreting-the-functions-when-loading-data-in-a-Script/m-p/325265#M119822</guid>
      <dc:creator />
      <dc:date>2011-10-10T17:32:53Z</dc:date>
    </item>
  </channel>
</rss>

