<?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 Date format changing between variable declaration and usage in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583659#M682801</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;I'm using variables within my load script to specify a max and min date range to load data for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am declaring the following in the variables:&lt;/P&gt;&lt;P&gt;let vFirstDate = date(YearStart(addYears(today(), -2)), 'YYYY-MM-DD');&lt;/P&gt;&lt;P&gt;let vLastDate = date(today()-1, 'YYYY-MM-DD');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When running through debug I can see that vFirstDate is set to 2012-01-01 and vLastDate is 2014-03-16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All good so far.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The next step of the script is to load some data in from the DB, and use these min/max values against a specific date. The line in my script is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDT.servicedate between $(vFirstDate) and $(vLastDate)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the debugger interprets that line however, I get the following SQL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDT.servicedate between 2012-01-01 and 16/03/2014&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This then fails, as the field on the DB is expected YYYY-MM-DD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 17 Mar 2014 15:25:49 GMT</pubDate>
    <dc:creator />
    <dc:date>2014-03-17T15:25:49Z</dc:date>
    <item>
      <title>Date format changing between variable declaration and usage</title>
      <link>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583659#M682801</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;I'm using variables within my load script to specify a max and min date range to load data for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am declaring the following in the variables:&lt;/P&gt;&lt;P&gt;let vFirstDate = date(YearStart(addYears(today(), -2)), 'YYYY-MM-DD');&lt;/P&gt;&lt;P&gt;let vLastDate = date(today()-1, 'YYYY-MM-DD');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When running through debug I can see that vFirstDate is set to 2012-01-01 and vLastDate is 2014-03-16&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All good so far.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The next step of the script is to load some data in from the DB, and use these min/max values against a specific date. The line in my script is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDT.servicedate between $(vFirstDate) and $(vLastDate)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the debugger interprets that line however, I get the following SQL:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BDT.servicedate between 2012-01-01 and 16/03/2014&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This then fails, as the field on the DB is expected YYYY-MM-DD.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas?&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2014 15:25:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583659#M682801</guid>
      <dc:creator />
      <dc:date>2014-03-17T15:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: Date format changing between variable declaration and usage</title>
      <link>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583660#M682802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I normally, for a 'belt and braces' approach, add a CHR(39) to the start and end of the variable, so the line looks like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;between '2012-01-01' and '2014-03-16'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as I find that otherwise it tends to fall over / return no results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2014 15:51:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583660#M682802</guid>
      <dc:creator>ThornOfCrowns</dc:creator>
      <dc:date>2014-03-17T15:51:07Z</dc:date>
    </item>
    <item>
      <title>Re: Date format changing between variable declaration and usage</title>
      <link>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583661#M682803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Rory,&lt;/P&gt;&lt;P&gt;Can you try&amp;nbsp; &lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;BDT.servicedate between&amp;nbsp; &lt;STRONG&gt;'$(vFirstDate)'&lt;/STRONG&gt; and &lt;STRONG&gt;'$(vLastDate)' &lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2014 15:54:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583661#M682803</guid>
      <dc:creator />
      <dc:date>2014-03-17T15:54:48Z</dc:date>
    </item>
    <item>
      <title>Re: Date format changing between variable declaration and usage</title>
      <link>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583662#M682804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Thanks for the suggestions... turns out it was a spelling error in my script. Total noob mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does highlight that it would be nice for the script editor to have some intelligence to let you know if you're trying to use a variable that has not previously been declared, but still a silly mistake on my part.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rory.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Mar 2014 15:58:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Date-format-changing-between-variable-declaration-and-usage/m-p/583662#M682804</guid>
      <dc:creator />
      <dc:date>2014-03-17T15:58:26Z</dc:date>
    </item>
  </channel>
</rss>

