<?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 String variable in script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338623#M705682</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;Put your variable under quotes:&lt;/P&gt;&lt;P&gt; if(INFO='$(Status)', '$(Status)', 'KO') AS INFO2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 05 Apr 2012 10:20:35 GMT</pubDate>
    <dc:creator>vijay_iitkgp</dc:creator>
    <dc:date>2012-04-05T10:20:35Z</dc:date>
    <item>
      <title>String variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338621#M705679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to define a string variable and use it in a script. It works fine if I create the variable in the Variable Viewer:&lt;/P&gt;&lt;P&gt;Variable name = Status&lt;/P&gt;&lt;P&gt;Value = 'OK'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INFO,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(INFO=$(Status), $(Status), 'KO') AS INFO2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;FROM file&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;.xlsx [...]&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But when I try to declare the variable in the script it fails:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;SET Status='OK'; //I also tried &lt;SPAN style="font-family: 'courier new', courier; font-size: 11px;"&gt;SET Status="OK";&lt;/SPAN&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;LOAD&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INFO,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(INFO=$(Status), $(Status), 'KO') AS INFO2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;FROM file&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;.xlsx [...]&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Error:&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;Field not found &amp;lt;OK&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier; font-size: 8pt;"&gt;if(Status=OK,OK,'') AS INFO2&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, sans-serif;"&gt;Quotes around 'OK' are removed so string OK is seen as a&lt;/SPAN&gt; field name instead of a string value. If you look at the variable in the Variable Viewer:&lt;/P&gt;&lt;P&gt;Variable name = Status&lt;/P&gt;&lt;P&gt;Value = OK &amp;lt;------- quotes are missing&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How to keep the quotes to make sure the variable is interpreted as a string and not a field name?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 10:05:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338621#M705679</guid>
      <dc:creator />
      <dc:date>2012-04-05T10:05:32Z</dc:date>
    </item>
    <item>
      <title>String variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338622#M705681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;try with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 8pt; font-family: 'courier new',courier;"&gt;LOAD&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 8pt; font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; INFO,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 8pt; font-family: 'courier new',courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(INFO='$(Status)', '$(Status)', 'KO') AS INFO2&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN style="font-family: 'courier new',courier; font-size: 8pt;"&gt;FROM file&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new',courier; font-size: 8pt;"&gt;.xlsx [...]&lt;/SPAN&gt;&lt;SPAN style="font-family: 'courier new',courier; font-size: 8pt;"&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new',courier; font-size: 8pt;"&gt;regards&lt;/SPAN&gt;&lt;STRONG style="font-size: 8pt; font-family: 'courier new',courier;"&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 10:17:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338622#M705681</guid>
      <dc:creator />
      <dc:date>2012-04-05T10:17:57Z</dc:date>
    </item>
    <item>
      <title>String variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338623#M705682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Hi,&lt;/P&gt;&lt;P&gt;Put your variable under quotes:&lt;/P&gt;&lt;P&gt; if(INFO='$(Status)', '$(Status)', 'KO') AS INFO2&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 10:20:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338623#M705682</guid>
      <dc:creator>vijay_iitkgp</dc:creator>
      <dc:date>2012-04-05T10:20:35Z</dc:date>
    </item>
    <item>
      <title>String variable in script</title>
      <link>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338624#M705684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works like a charm! (I indeed got misleaded by the syntax editor coloring)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you very much!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Apr 2012 10:22:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/String-variable-in-script/m-p/338624#M705684</guid>
      <dc:creator />
      <dc:date>2012-04-05T10:22:22Z</dc:date>
    </item>
  </channel>
</rss>

