<?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: IF() returning NULL for the ELSE in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713284#M1083856</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually had better luck with this in a test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF (&lt;STRONG&gt;ALT(&lt;/STRONG&gt;LEN(Trim(attribute_label))&lt;STRONG&gt;,0)&lt;/STRONG&gt; &amp;gt; 0, 'True', 'False') AS has_attribute;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;ad_id&lt;/P&gt;&lt;P&gt;,attribute_label&lt;/P&gt;&lt;P&gt;,etc......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jun 2014 15:00:51 GMT</pubDate>
    <dc:creator>joshabbott</dc:creator>
    <dc:date>2014-06-19T15:00:51Z</dc:date>
    <item>
      <title>IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713283#M1083855</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm perplexed as to why I can't seem to get an ELSE value from my IF() function.&amp;nbsp; I can't imagine it is just because I'm using a preceding load.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF (LEN(Trim(attribute_label)) &amp;gt; 0, 'True', 'False') AS has_attribute;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt; ad_id&lt;/P&gt;&lt;P&gt;,attribute_label&lt;/P&gt;&lt;P&gt;,etc......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I put the result in the table box I'll get the 'True' value in my has_attribute field but where I should have 'False' I get nothing but NULLs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I must be overlooking something obvious but I'm at wit's end with this seemingly simple task and also can't seem to figure out the proper search terms to find a solution on the forums.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 14:45:02 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713283#M1083855</guid>
      <dc:creator />
      <dc:date>2014-06-19T14:45:02Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713284#M1083856</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I actually had better luck with this in a test:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOAD *&lt;/P&gt;&lt;P&gt;&amp;nbsp; ,IF (&lt;STRONG&gt;ALT(&lt;/STRONG&gt;LEN(Trim(attribute_label))&lt;STRONG&gt;,0)&lt;/STRONG&gt; &amp;gt; 0, 'True', 'False') AS has_attribute;&lt;/P&gt;&lt;P&gt;SELECT&lt;/P&gt;&lt;P&gt;ad_id&lt;/P&gt;&lt;P&gt;,attribute_label&lt;/P&gt;&lt;P&gt;,etc......&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:00:51 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713284#M1083856</guid>
      <dc:creator>joshabbott</dc:creator>
      <dc:date>2014-06-19T15:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713285#M1083857</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your expression seems ok to me and should work as far as I see.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just to eliminate any weird text interpretation issues:&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;"&gt;&amp;nbsp; ,IF (LEN(Trim(attribute_label)) &amp;gt; 0,&lt;STRONG&gt; true(), false()&lt;/STRONG&gt; ) AS has_attribute;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:06:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713285#M1083857</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-06-19T15:06:33Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713286#M1083858</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Had high hopes for this as I did not know about the Alt() function but alas, I'm getting the same results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:12:32 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713286#M1083858</guid>
      <dc:creator />
      <dc:date>2014-06-19T15:12:32Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713287#M1083859</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree, swuehl, there's nothing terribly exotic about what I'm trying to do.&amp;nbsp; I had tried your suggestion in an earlier attempt.&amp;nbsp; I also tried to combine it with Josh's answer but again, same results except I get "-1" instead of "True".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm going to put together a sample app in hopes I can duplicate this odd behavior.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:17:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713287#M1083859</guid>
      <dc:creator />
      <dc:date>2014-06-19T15:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713288#M1083860</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;what is the origin of your data ? perhaps MySQL ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:21:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713288#M1083860</guid>
      <dc:creator>antoniotiman</dc:creator>
      <dc:date>2014-06-19T15:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713289#M1083861</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes.&amp;nbsp; In fact this is the first time I've had to make a substantial pull from MySQL.&amp;nbsp; I'm usually pulling from Postgres and the only other time I pulled from MySQL prior to this project was a single table.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:25:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713289#M1083861</guid>
      <dc:creator />
      <dc:date>2014-06-19T15:25:11Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713290#M1083862</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;Can you share screen shot of your table box&lt;/P&gt;&lt;P&gt;Or It is best if you share your application &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:27:31 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713290#M1083862</guid>
      <dc:creator>PrashantSangle</dc:creator>
      <dc:date>2014-06-19T15:27:31Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713291#M1083863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is a behavior of MySQL. It is 'Auto Trim'.&lt;/P&gt;&lt;P&gt;You can't use Preload.&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;ID,&lt;/P&gt;&lt;P&gt;attribute_label,&lt;/P&gt;&lt;P&gt;case&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when attribute_label = ' ' then ' '&amp;nbsp;&amp;nbsp; /* ' ' is 1 blank */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else attribute_label&lt;/P&gt;&lt;P&gt; end&lt;/P&gt;&lt;P&gt;as has_attribute,&lt;/P&gt;&lt;P&gt;.....&lt;/P&gt;&lt;P&gt;from .....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 15:33:21 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713291#M1083863</guid>
      <dc:creator>antoniotiman</dc:creator>
      <dc:date>2014-06-19T15:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713292#M1083864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry for the late reply but it still took quite some while to get this working correctly.&amp;nbsp; However, your advice took me down the right path and I am most grateful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I also had to push my data to a QVD, remove all existing tables, pull it back in and only then could I finally apply the "&lt;SPAN style="color: #3d3d3d; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif;"&gt; ,IF (LEN(Trim(attribute_label)) &amp;gt; 0, 'True', 'False') AS has_attribute; &lt;/SPAN&gt;" portion of the code and get the results I was looking for.&amp;nbsp; Your solution, or at least the way I applied it, resulted in every 'False' value being duplicated - one row showing 'False' and an additional one with the NULL marker.&amp;nbsp; Very odd and maddening.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you everyone for your help.&amp;nbsp; I'm going still going to post the QVW after I shrink it a bit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2014 22:42:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713292#M1083864</guid>
      <dc:creator />
      <dc:date>2014-06-19T22:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713293#M1083865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Antonio,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks for showing that issue with MySQL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I haven't used MySQL much with QV, and even after a short search, I haven't understood how this MySQL feature should break the preceding load in QV.&lt;/P&gt;&lt;P&gt;It seems it should only effect either storing data into the database or when comparing string values by the DBMS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Just for interest and without doubting that there obviously is an issue, could you add some more information or a link about Auto Trim feature and maybe your assumption why this causes the issue? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So maybe there is a better workaround in QV than creating the QVDs etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Stefan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2014 11:09:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713293#M1083865</guid>
      <dc:creator>swuehl</dc:creator>
      <dc:date>2014-06-20T11:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713294#M1083866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I second this notion.&amp;nbsp; I've found a few articles about 'Auto Trim' on these forums but still not quite sure what is going on much less how you fixed it.&amp;nbsp; An explanation would also make a nice addendum to this technical brief &lt;A href="https://community.qlik.com/docs/DOC-3155"&gt;NULL handling in QlikView&lt;/A&gt; which I was pouring over trying to figure out this odd behavior.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2014 13:08:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713294#M1083866</guid>
      <dc:creator />
      <dc:date>2014-06-20T13:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: IF() returning NULL for the ELSE</title>
      <link>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713295#M1083867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi swuehl,&lt;/P&gt;&lt;P&gt;I try to explain the behavior of MySQL.&lt;/P&gt;&lt;P&gt;With fields&amp;nbsp; char/varchar (not with text and blob)&lt;/P&gt;&lt;P&gt;if insert blank in field the data is stored as chr(0).&lt;/P&gt;&lt;P&gt;In QV this field is NOT NULL, NOT BLANK and len(Field)=0.&lt;/P&gt;&lt;P&gt;However&amp;nbsp; to resolve the issue I use in the script :&lt;/P&gt;&lt;P&gt;Table:&lt;/P&gt;&lt;P&gt;SQl Select&lt;/P&gt;&lt;P&gt;field1,field2,&lt;/P&gt;&lt;P&gt;case&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; when Fieldblank = ' ' then ' '&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* blank forced */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else Fieldblank&lt;/P&gt;&lt;P&gt;as Fieldblank,&lt;/P&gt;&lt;P&gt;field4,&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;from&lt;/P&gt;&lt;P&gt;In this case the Filedblank in QV is&amp;nbsp; ' ' (1 blank)&amp;nbsp; and len(Fieldblank)=1.&lt;/P&gt;&lt;P&gt;For this reason You can't use PRELOAD and LOAD but, after this script,&lt;/P&gt;&lt;P&gt;You can use Load ... Resident and You store correct QVD.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Antonio&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Jun 2014 14:11:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/IF-returning-NULL-for-the-ELSE/m-p/713295#M1083867</guid>
      <dc:creator>antoniotiman</dc:creator>
      <dc:date>2014-06-20T14:11:34Z</dc:date>
    </item>
  </channel>
</rss>

