<?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 question in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389077#M1167244</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Henric&lt;/P&gt;&lt;P&gt;Thanks, will keep in mind (Peek).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 10 Sep 2012 04:09:24 GMT</pubDate>
    <dc:creator>whiteline</dc:creator>
    <dc:date>2012-09-10T04:09:24Z</dc:date>
    <item>
      <title>Variable question</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389074#M1167241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a table TABLE1 with two columns, COLUMN1 and COLUMN2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;TABLE border="1" cellpadding="3" cellspacing="0" class="jiveBorder" height="94" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; WIDTH: 217px; HEIGHT: 96px; BORDER-TOP: #000000 1px solid; BORDER-RIGHT: #000000 1px solid;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;COLUMN1&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;TH align="center" style="background-color: #6690bc;" valign="middle"&gt;&lt;SPAN style="color: #ffffff;"&gt;&lt;STRONG&gt;COLUMN2&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/TH&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;RED&lt;/TD&gt;&lt;TD&gt;10&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;GREEN&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;BLUE&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;PURPLE&lt;/TD&gt;&lt;TD&gt;0&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am setting a variable in the script as below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let vStatus = Peek("COLUMN1",0,TABLE1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to use this variable in text box background color as a calculated color as below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if(vStatus&amp;gt;&amp;gt;0,Red(),Green())&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I always get green background for the text box. I tried hardcode value 10 in the let statement and that changes the color to Red. So somehow the Let statement with peek is not working. Need some advice and help!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Sep 2012 14:15:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389074#M1167241</guid>
      <dc:creator />
      <dc:date>2012-09-09T14:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Variable question</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389075#M1167242</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;&lt;SPAN style="text-decoration: line-through;"&gt;You cann't use peek outside LOAD statement&lt;/SPAN&gt;(below).&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;Use this function: &lt;/SPAN&gt;&lt;/P&gt;&lt;P class="syntax"&gt;&lt;SPAN class="Bold"&gt;&lt;STRONG&gt;FieldValue&lt;/STRONG&gt;(&lt;/SPAN&gt;&lt;SPAN class="Italic"&gt;fieldname , n &lt;/SPAN&gt;&lt;SPAN class="Bold"&gt;)&lt;/SPAN&gt; &lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;P&gt;Returns the field value found in position &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; of the 
field &lt;SPAN class="Italic"&gt;fieldname&lt;/SPAN&gt; (by load order). &lt;SPAN class="Italic"&gt;fieldname&lt;/SPAN&gt; must be given as a string value, e.g. the field 
name must be enclosed by single quotes. &lt;SPAN style="text-decoration: underline;"&gt;The first field value is returned for 
&lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt;=1&lt;/SPAN&gt;. If &lt;SPAN class="Italic"&gt;n&lt;/SPAN&gt; is larger than the 
number of field values, NULL is returned. &lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Sep 2012 18:01:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389075#M1167242</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-09T18:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: Variable question</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389076#M1167243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;can &lt;/STRONG&gt;&lt;/SPAN&gt;use peek outside a Load statement, but you need to specify the field name and the table name with single quotes: &lt;/P&gt;&lt;P&gt;Let vStatus = Peek('COLUMN1',0,'TABLE1');&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This Let statement will assign the text 'RED' to the variable vStatus, butI am not sure I understand how you want to use it... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to specify the color based on the value in field COLUMN2 - i.e. different colors in different lines of a table - then you should use the following color expression:&lt;/P&gt;&lt;P&gt;if(COLUMN2&amp;gt;0,Red(),Green())&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or if you consider the possiblity of COLUMN2 having several possible values:&lt;/P&gt;&lt;P&gt;if(count(distinct COLUMN2)=1,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; if(COLUMN2&amp;gt;0,Red(),Green()),&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lightgray() )&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;HIC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Sep 2012 20:03:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389076#M1167243</guid>
      <dc:creator>hic</dc:creator>
      <dc:date>2012-09-09T20:03:57Z</dc:date>
    </item>
    <item>
      <title>Re: Variable question</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389077#M1167244</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, Henric&lt;/P&gt;&lt;P&gt;Thanks, will keep in mind (Peek).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 04:09:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389077#M1167244</guid>
      <dc:creator>whiteline</dc:creator>
      <dc:date>2012-09-10T04:09:24Z</dc:date>
    </item>
    <item>
      <title>Re: Variable question</title>
      <link>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389078#M1167245</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;Please check the Qlikview Reference manual for help on Peek() function. And it's clearly mentioned that peek() can be used outside the LOAD statement but with the TABLE name reference. The peek function searches for the Tables in the Qlikview database(which are already loaded in the qvw file). Peek() function syntax is wrong in your situation.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As suggested by Henric you can make use of the column in the table for changing the color based on value in the field rather than making use of variable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Sri&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Sep 2012 04:14:35 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/Variable-question/m-p/389078#M1167245</guid>
      <dc:creator />
      <dc:date>2012-09-10T04:14:35Z</dc:date>
    </item>
  </channel>
</rss>

