<?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: Variable in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810423#M472082</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;doesnt work &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Feb 2015 23:13:30 GMT</pubDate>
    <dc:creator>rdsuperlike</dc:creator>
    <dc:date>2015-02-02T23:13:30Z</dc:date>
    <item>
      <title>Variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810421#M472080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a standard version date that I want to use in all the tabs in the load statements.&lt;/P&gt;&lt;P&gt;I have created below table in the beginning in main and stored it in variable vVersionDate.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;VERSIONDATE:&lt;/P&gt;&lt;P&gt;Load&lt;/P&gt;&lt;P&gt;VERSION_DATE ;&lt;/P&gt;&lt;P&gt;SQL&lt;/P&gt;&lt;P&gt;select distinct END_DT as VERSION_DATE from TIME_V where DAY_DATE = TRUNC(SYSDATE);&lt;/P&gt;&lt;P&gt;Let vVersionDate = peek('VERSION_DATE',0,VERSIONDATE);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But I am not able to make it work in all the tabs&lt;/P&gt;&lt;P&gt;I tried using below in the load statement in one of the tables. It doesnt work.&lt;/P&gt;&lt;P&gt;date($(vVersionDate)) as VERSION_DT,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I get below error&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.qlik.com/legacyfs/online/76914_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;can anyone help me here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 22:56:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810421#M472080</guid>
      <dc:creator>rdsuperlike</dc:creator>
      <dc:date>2015-02-02T22:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810422#M472081</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try the following: (VERSIONDATE in quotes)&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Let vVersionDate = peek('VERSION_DATE',0,&lt;STRONG&gt;'VERSIONDATE'&lt;/STRONG&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 23:05:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810422#M472081</guid>
      <dc:creator>nagaiank</dc:creator>
      <dc:date>2015-02-02T23:05:51Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810423#M472082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;doesnt work &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/sad.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 23:13:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810423#M472082</guid>
      <dc:creator>rdsuperlike</dc:creator>
      <dc:date>2015-02-02T23:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810424#M472083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is most likely a formatting problem. Your date is coming back from the database as a fully formatted timestamp. You can try a few options and see which one works:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Try to simply convert the incoming date into a number:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;Let vVersionDate = num(peek('VERSION_DATE',0,VERSIONDATE) );&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;2. If that doesn't work, then try to convert the full timestamp string into a date field, and then convert it into a number:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;Let vVersionDate = &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;num(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; date#(&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; peek('VERSION_DATE',0,VERSIONDATE),&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'M/D/YYYY hh:mm:ss TT'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Oleg Troyansky&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Check out my book &lt;STRONG&gt;QlikView Your Business&lt;/STRONG&gt; - now available to pre-order on Amazon!&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 23:14:25 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810424#M472083</guid>
      <dc:creator>Oleg_Troyansky</dc:creator>
      <dc:date>2015-02-02T23:14:25Z</dc:date>
    </item>
    <item>
      <title>Re: Variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810425#M472084</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The peek() seems to be working already, maybe only once in a while.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, if vVersionDate contains 2/7/2015 12:00:00 AM, then simply using the variable value as a parameter to the date() function will produce an illegal script expression, like &lt;SPAN style="font-family: 'courier new', courier;"&gt;date(2/7/2015 12:00:00 AM) as VERSION_DT&lt;/SPAN&gt;. QlikView cannot correctly interprete the parameter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, use quotes to turn the value into a string which QlikView will be able to handle. Like&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;DIE_DETAIL:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;date(&lt;SPAN style="color: #ff6600;"&gt;&lt;STRONG&gt;'$(vVersionDate)'&lt;/STRONG&gt;&lt;/SPAN&gt;) AS VERSION_DT,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Feb 2015 23:20:37 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-in-script/m-p/810425#M472084</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2015-02-02T23:20:37Z</dc:date>
    </item>
  </channel>
</rss>

