<?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: Date format error / Sql in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-format-error-Sql/m-p/1293988#M842401</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Oleg, it worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 21 Apr 2017 12:30:32 GMT</pubDate>
    <dc:creator />
    <dc:date>2017-04-21T12:30:32Z</dc:date>
    <item>
      <title>Date format error / Sql</title>
      <link>https://community.qlik.com/t5/QlikView/Date-format-error-Sql/m-p/1293986#M842399</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to load incrementing data, with the following statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From my initial QVD I extract the max date like so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;Tickets:&lt;/SPAN&gt;&lt;BR /&gt;LOAD:&lt;BR /&gt;....&lt;/P&gt;&lt;P&gt;.&lt;SPAN style="font-size: 13.3333px;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;From test.qvd (qvd);&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Find last Create Date&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;Last_Create_Date:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;LOAD max(date(CreateStamp)) as MaxDate&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;Resident Tickets;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;//Store Max Create Date into Variable&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;LET Last_Create_Date = peek('MaxDate',0,'Last_Create_Date');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;// Delete &lt;SPAN style="font-size: 13.3333px;"&gt;Tickets &lt;/SPAN&gt;Table&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;DROP Table &lt;SPAN style="font-size: 13.3333px;"&gt;Tickets&lt;/SPAN&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, in my Next load statement I am trying to load &lt;SPAN style="color: #3366ff;"&gt;WHERE to_date(createdate) &amp;gt; $(Last_Create_Date)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, its not working, it seems that the Sql is not understanding the format I am sending, because if I change it to &lt;SPAN style="color: #3366ff; font-size: 13.3333px;"&gt;WHERE to_date(createdate) &amp;gt; '2017-01-01' &lt;SPAN style="color: #000000;"&gt;It works.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;One thing that I noticed, is that if I load the variable into a text field as such &lt;SPAN style="color: #0000ff;"&gt;=Last_Create_Date&lt;/SPAN&gt;, I get the proper date, however, if I load it with $ expansion as &lt;SPAN style="color: #0000ff;"&gt;=$(Last_Create_Date)&lt;/SPAN&gt; I get 0.000192107580... Could it be that this is what Sql is also receiving?&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/Date-format-error-Sql/m-p/1293986#M842399</guid>
      <dc:creator />
      <dc:date>2020-11-25T16:16:04Z</dc:date>
    </item>
    <item>
      <title>Re: Date format error / Sql</title>
      <link>https://community.qlik.com/t5/QlikView/Date-format-error-Sql/m-p/1293987#M842400</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is an interesting catch... when you use a $-sign expansion with a date, it evaluates the expression:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(4/20/2017) = 4/20/2017 = 9.915716410510659e-5 (a very small number)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The solution is rather simple - enclose the $-sign expansion in single quotes:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3366ff; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;WHERE to_date(createdate) &amp;gt; '$(Last_Create_Date)'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is just one of many cool scripting techniques that Rob Wunderlich is teaching at the &lt;A href="http://masterssummit.com/"&gt;Masters Summit for Qlik&lt;/A&gt;. Check out if our agenda is right for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Oleg Troyansky&lt;/P&gt;&lt;P&gt;Upgrade your Qlik skills with my book &lt;A href="https://www.amazon.com/gp/product/1118949552/ref=as_li_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=9325&amp;amp;creativeASIN=1118949552&amp;amp;linkCode=as2&amp;amp;tag=natursyner0f-20&amp;amp;linkId=098202df27917ab9836332cf063c51f5"&gt;QlikView Your Business: An Expert Guide to Business Discovery with QlikView and Qlik Sense&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 20 Apr 2017 21:30:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-format-error-Sql/m-p/1293987#M842400</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2017-04-20T21:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: Date format error / Sql</title>
      <link>https://community.qlik.com/t5/QlikView/Date-format-error-Sql/m-p/1293988#M842401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Oleg, it worked.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 21 Apr 2017 12:30:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-format-error-Sql/m-p/1293988#M842401</guid>
      <dc:creator />
      <dc:date>2017-04-21T12:30:32Z</dc:date>
    </item>
  </channel>
</rss>

