<?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: Use a Variable as a Script line in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Use-a-Variable-as-a-Script-line/m-p/498832#M693020</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EXECUTE statement is not appropriate here. If you have a variable that contains a valid script statement, the way to run that statement in the script is to type a script line that references the variable like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(_vExecutable);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Jul 2013 06:42:33 GMT</pubDate>
    <dc:creator>rwunderlich</dc:creator>
    <dc:date>2013-07-19T06:42:33Z</dc:date>
    <item>
      <title>Use a Variable as a Script line</title>
      <link>https://community.qlik.com/t5/QlikView/Use-a-Variable-as-a-Script-line/m-p/498831#M693019</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 a newbie to QV (but not BI e.g. SSAS etc).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my LOAD script I would like to set the value of a variable that has its definition stored in&lt;/P&gt;&lt;P&gt;a database.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Scenario&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;We have a Business Dictionary in our DW (SQLServer 2012) and in it I will define a &lt;/P&gt;&lt;P&gt;variable called &lt;SPAN style="color: #ff0000;"&gt;_vExecutable&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="color: #333333; font-size: 10pt; font-family: arial,helvetica,sans-serif;"&gt;it will be defined with a script line of &lt;SPAN style="color: #339966;"&gt;let &lt;STRONG&gt;&lt;EM&gt;vCurrentYear&lt;/EM&gt;&lt;/STRONG&gt; = &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #339966;"&gt;Lookup &lt;SPAN style="font-size: 10pt;"&gt;('Year','Date_Key','$(zLastCompletePeriod)','CALENDAR');&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Of course,If I hardcoded this in the LOAD Script it would be as &lt;SPAN style="color: #ff0000;"&gt;let &lt;STRONG&gt;&lt;EM&gt;vCurrentYear&lt;/EM&gt;&lt;/STRONG&gt; = Lookup('Year','Date_Key','$(zLastCompletePeriod)','CALENDAR'); &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;But as stated we dont want to do this except where absolutely necessary&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;STRONG&gt;Requirement&lt;/STRONG&gt;:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I would like to substitute the LET statement with a Variable that defines &lt;SPAN style="color: #ff0000;"&gt;_vCurrentYear&lt;SPAN style="color: #333333;"&gt; , in a nutshell , execute variables as script lines &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can you see where Im heading with this &lt;IMG src="https://community.qlik.com/legacyfs/online/emoticons/happy.png" /&gt; ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We dont want to hard code environment variables in the LOAD script, we want to utilise our dictionary &lt;/P&gt;&lt;P&gt;as much as possible as this is the one stop repository for business definitions and calculations (formulas) &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Result&lt;/STRONG&gt;:&lt;/P&gt;&lt;P&gt;I did test this using EXECUTE &lt;SPAN style="color: #ff0000;"&gt;_vExecutable&amp;nbsp; &lt;/SPAN&gt;but get a "Script Line Error" , the error window does imply something did actually work as I see a value embedded in the 'Date_Key' field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any feedback gratefully received, thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;P&gt;(Brisbane, Qld)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 05:37:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-a-Variable-as-a-Script-line/m-p/498831#M693019</guid>
      <dc:creator>paul_scotchford</dc:creator>
      <dc:date>2013-07-19T05:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: Use a Variable as a Script line</title>
      <link>https://community.qlik.com/t5/QlikView/Use-a-Variable-as-a-Script-line/m-p/498832#M693020</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;EXECUTE statement is not appropriate here. If you have a variable that contains a valid script statement, the way to run that statement in the script is to type a script line that references the variable like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;$(_vExecutable);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jul 2013 06:42:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-a-Variable-as-a-Script-line/m-p/498832#M693020</guid>
      <dc:creator>rwunderlich</dc:creator>
      <dc:date>2013-07-19T06:42:33Z</dc:date>
    </item>
    <item>
      <title>Re: Use a Variable as a Script line</title>
      <link>https://community.qlik.com/t5/QlikView/Use-a-Variable-as-a-Script-line/m-p/498833#M693021</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rob, Many thanks , this is exactly what we need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Jul 2013 22:05:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Use-a-Variable-as-a-Script-line/m-p/498833#M693021</guid>
      <dc:creator>paul_scotchford</dc:creator>
      <dc:date>2013-07-21T22:05:45Z</dc:date>
    </item>
  </channel>
</rss>

