<?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 IF statement, compare a variable against a field value in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285363#M1201270</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Jean-Jacques,&lt;/P&gt;&lt;P&gt;Thank you for your suggestion. Unfortunate I am not sure I can use this at this moment because is it giving me a new field which I cannot test either. I think your solution provides a new field which can be shown on a sheet. However I really need to test the condition in the script because the script must be ended when the condition is true.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Korrelzeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 31 Oct 2010 10:14:38 GMT</pubDate>
    <dc:creator />
    <dc:date>2010-10-31T10:14:38Z</dc:date>
    <item>
      <title>IF statement, compare a variable against a field value</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285359#M1201266</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I am trying to get an IF statement working where a variable is compared against a field value. My code is:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;SET MyLocalVariable = 'test';&lt;BR /&gt;&lt;BR /&gt;MyTable:&lt;BR /&gt;LOAD Field1,&lt;BR /&gt; Field2,&lt;BR /&gt; Field3&lt;BR /&gt;FROM&lt;BR /&gt;MyTable.qvd] (qvd);&lt;BR /&gt;&lt;BR /&gt;IF MyLocalVariable &amp;lt;&amp;gt; Field1 THEN&lt;BR /&gt; // Some more code&lt;BR /&gt; //...&lt;BR /&gt; Exit script;&lt;BR /&gt;END IF&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Unfortunate this isn't working. In the IF statement &lt;CODE&gt;Field1&lt;/CODE&gt; seems to be NULL when checking in the debugger. I am sure that &lt;CODE&gt;Field1&lt;/CODE&gt; of the table is filled with a string value. No Unqualify is set.&lt;/P&gt;&lt;P&gt;How can I make this statement work, e.g. compare a variable against a field value?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Korrelzeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Oct 2010 09:59:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285359#M1201266</guid>
      <dc:creator />
      <dc:date>2010-10-30T09:59:59Z</dc:date>
    </item>
    <item>
      <title>IF statement, compare a variable against a field value</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285360#M1201267</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try something like this&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;BLOCKQUOTE style="overflow-x: scroll;"&gt;&lt;CODE&gt;&lt;/CODE&gt;&lt;PRE style="margin: 0px;"&gt;&lt;CODE&gt;&lt;BR /&gt;SET MyLocalVariable = 'test';&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;MyTable:&lt;BR /&gt;LOAD Field1,&lt;BR /&gt; If(Field1=$(MyLocalVariable) , 1 , 0 ) as Flag&lt;BR /&gt; Field2,&lt;BR /&gt; Field3&lt;BR /&gt;FROM&lt;BR /&gt;MyTable.qvd] (qvd);&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt; &lt;P&gt;where you create a new field Flag = 1 if Field1='test'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;jjj&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Oct 2010 10:32:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285360#M1201267</guid>
      <dc:creator />
      <dc:date>2010-10-30T10:32:32Z</dc:date>
    </item>
    <item>
      <title>IF statement, compare a variable against a field value</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285361#M1201268</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You must use peek or fieldvalue function to get the value from a table and match it against a variable. if the table has more than one value, then you much use a for loop if you want to compare all the values.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 30 Oct 2010 11:53:28 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285361#M1201268</guid>
      <dc:creator />
      <dc:date>2010-10-30T11:53:28Z</dc:date>
    </item>
    <item>
      <title>IF statement, compare a variable against a field value</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285362#M1201269</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi syed.maqsood,&lt;/P&gt;&lt;P&gt;Thank you, that did the trick.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Korrelzeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Oct 2010 09:53:03 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285362#M1201269</guid>
      <dc:creator />
      <dc:date>2010-10-31T09:53:03Z</dc:date>
    </item>
    <item>
      <title>IF statement, compare a variable against a field value</title>
      <link>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285363#M1201270</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi Jean-Jacques,&lt;/P&gt;&lt;P&gt;Thank you for your suggestion. Unfortunate I am not sure I can use this at this moment because is it giving me a new field which I cannot test either. I think your solution provides a new field which can be shown on a sheet. However I really need to test the condition in the script because the script must be ended when the condition is true.&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Korrelzeep&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 31 Oct 2010 10:14:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-statement-compare-a-variable-against-a-field-value/m-p/285363#M1201270</guid>
      <dc:creator />
      <dc:date>2010-10-31T10:14:38Z</dc:date>
    </item>
  </channel>
</rss>

