<?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 IsNull() widespread mistake, or genuine function? in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192259#M385103</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been refactoring codes, and &lt;SPAN style="font-size: 10pt;"&gt;some developer use IsNull() in such manner: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 10pt;"&gt;*To code "create a flag field, if DocType is null, then 1 otherwise 0"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;If(&lt;STRONG&gt;IsNull(DocType)&lt;/STRONG&gt;, 1, 0) as flg_DocTypeIsNull, ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my opinion, this is incorrect and we should code: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If(&lt;/SPAN&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;IsNull(DocType)=-1&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;, 1, 0) as flg_DocTypeIsNull, ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I right, or is IsNull() really function, giving true or false? As long as I see the log, the former is resulting nothing. &lt;/P&gt;&lt;P&gt;I would apprecaite for your wisdom. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Oct 2016 07:57:01 GMT</pubDate>
    <dc:creator>atsushi_saijo</dc:creator>
    <dc:date>2016-10-12T07:57:01Z</dc:date>
    <item>
      <title>IsNull() widespread mistake, or genuine function?</title>
      <link>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192259#M385103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been refactoring codes, and &lt;SPAN style="font-size: 10pt;"&gt;some developer use IsNull() in such manner: &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;EM style="font-size: 10pt;"&gt;*To code "create a flag field, if DocType is null, then 1 otherwise 0"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;If(&lt;STRONG&gt;IsNull(DocType)&lt;/STRONG&gt;, 1, 0) as flg_DocTypeIsNull, ....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my opinion, this is incorrect and we should code: &lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;If(&lt;/SPAN&gt;&lt;STRONG style="font-size: 13.3333px;"&gt;IsNull(DocType)=-1&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.3333px;"&gt;, 1, 0) as flg_DocTypeIsNull, ....&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I right, or is IsNull() really function, giving true or false? As long as I see the log, the former is resulting nothing. &lt;/P&gt;&lt;P&gt;I would apprecaite for your wisdom. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2016 07:57:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192259#M385103</guid>
      <dc:creator>atsushi_saijo</dc:creator>
      <dc:date>2016-10-12T07:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: IsNull() widespread mistake, or genuine function?</title>
      <link>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192260#M385104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Correct &lt;SPAN style="font-size: 13.33px;"&gt;If(&lt;/SPAN&gt;&lt;STRONG style="font-size: 13.33px;"&gt;IsNull(DocType)=-1&lt;/STRONG&gt;&lt;SPAN style="font-size: 13.33px;"&gt;, 1, 0)&lt;/SPAN&gt; will give -ve values instead +ve values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2016 08:33:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192260#M385104</guid>
      <dc:creator>vardhancse</dc:creator>
      <dc:date>2016-10-12T08:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: IsNull() widespread mistake, or genuine function?</title>
      <link>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192261#M385105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;IsNull() does give True and false. If you try this without if statement &lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;IsNull(DocType)&lt;/STRONG&gt;, you will see -1 (for true) and 0 (for false). So when -1, assign a value 1, and when 0, assign a value 0 is done by this&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;&lt;STRONG&gt;If(&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;STRONG style="font-size: 13px; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; color: #3d3d3d;"&gt;IsNull(DocType)&lt;/STRONG&gt;&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 13px;"&gt;&lt;STRONG&gt;, 1, 0) as flg_DocTypeIsNull&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Oct 2016 08:53:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192261#M385105</guid>
      <dc:creator>sunny_talwar</dc:creator>
      <dc:date>2016-10-12T08:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: IsNull() widespread mistake, or genuine function?</title>
      <link>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192262#M385106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No this is perfectly correct. Every expression somehow results in a (numerical) value. If evaluated in a logical context (using relational operators), true() is equal to numerical value -1, and false() is equal to 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now QlikView Load Script borrows some techniques from C-based languages in that you do not have to specify some expressions in an explicit way all the time. Some parts - if not present - are assumed. For example, these are all valid (identical) logical expressions:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (IsNull(DocType) = true(), 1, 0) // Explicit version. Too many characters?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (IsNull(DocType) = -1, 1, 0) // IsNull will return -1 (= true) or 0 (= false)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (IsNull(DocType), 1, 0) // IsNull(DocType) = true() is assumed&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually, true will be more like "non-zero", so that the following will also work (although your intuition may complain):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (1, 'true', 'false') // returns true&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (0, 'true', 'false') // returns false&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (A+5, 1, 0) // depends on the result being 0 or non-zero&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Of course, this also means that the following messes with everything said.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;IF (1 = true(), 'true', 'false') // What do you get?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The start of the expression forces eveything to go numerical, and 1 is not equal to -1.&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>Wed, 12 Oct 2016 08:55:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IsNull-widespread-mistake-or-genuine-function/m-p/1192262#M385106</guid>
      <dc:creator>Peter_Cammaert</dc:creator>
      <dc:date>2016-10-12T08:55:51Z</dc:date>
    </item>
  </channel>
</rss>

