<?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 issues in load script in QlikView</title>
    <link>https://community.qlik.com/t5/QlikView/If-statement-issues-in-load-script/m-p/265180#M99670</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Erich&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for the reply. I thought so but I will consider your code and try and use that in the future. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Jan 2012 11:32:19 GMT</pubDate>
    <dc:creator />
    <dc:date>2012-01-12T11:32:19Z</dc:date>
    <item>
      <title>If statement issues in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-issues-in-load-script/m-p/265178#M99668</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 having a few issues with an if statement in my load script. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a table from source with usernames where the username is blank. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am applying an if statement evaluating any null values to have the value of 'Unknown' otherwise if the username is not null then give me the username. When I load the data in a chart table I am still getting empty values where I should be getting 'Unknown'. This causes anything else associated with the username being blank to be blank too. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The if statement I have used in my script is: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;if(isnull(UserName) or UserName = '', 'Unknown', Username) as Username&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;I have also used a nested statement to see if I can overcome this issue which is:&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;&lt;STRONG style="font-family: courier new,courier;"&gt;if(isnull(UserName), 'Unknown',&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif;"&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(UserName = '', 'Unknown', UserName)) as UserName&lt;/STRONG&gt;&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;After using the nested if statement I am still getting blanks in a straight table and a chart table. &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;Can anyone know what I am doing wrong or how to overcome this? &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;Thanks&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;&lt;BR /&gt;&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;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 08:53:56 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-issues-in-load-script/m-p/265178#M99668</guid>
      <dc:creator />
      <dc:date>2012-01-11T08:53:56Z</dc:date>
    </item>
    <item>
      <title>If statement issues in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-issues-in-load-script/m-p/265179#M99669</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;You can simplify this with the following:&lt;/P&gt;&lt;P&gt;if( len(trim(UserName))=0, 'Unknown', UserName) as Username&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you problem maybe related to your data model. &lt;/P&gt;&lt;P&gt;Let us suppose that there is a table users and a table departments. If there is one department that is not associated with any user, some results will have departments but not users and that may be happening to you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps for now, &lt;/P&gt;&lt;P&gt;Regards, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Erich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 11 Jan 2012 18:54:20 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-issues-in-load-script/m-p/265179#M99669</guid>
      <dc:creator>erichshiino</dc:creator>
      <dc:date>2012-01-11T18:54:20Z</dc:date>
    </item>
    <item>
      <title>If statement issues in load script</title>
      <link>https://community.qlik.com/t5/QlikView/If-statement-issues-in-load-script/m-p/265180#M99670</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Erich&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Many thanks for the reply. I thought so but I will consider your code and try and use that in the future. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Jan 2012 11:32:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/QlikView/If-statement-issues-in-load-script/m-p/265180#M99670</guid>
      <dc:creator />
      <dc:date>2012-01-12T11:32:19Z</dc:date>
    </item>
  </channel>
</rss>

