<?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: Len function returning values greater than 0 for null fields in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414663#M94982</link>
    <description>&lt;P&gt;You original script is actually working,&lt;/P&gt;
&lt;P&gt;but the table chart is showing you&lt;U&gt;&lt;STRONG&gt; unique combinations of all&lt;/STRONG&gt; &lt;/U&gt;"Not Missing" flags in the dataset &lt;U&gt;&lt;STRONG&gt;and NOT EACH DATA ROW&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can verify this by adding a &lt;STRONG&gt;recno()&lt;/STRONG&gt; while loading the data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Load&lt;/P&gt;
&lt;P&gt;Recno() as &lt;STRONG&gt;recordID&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;,&amp;nbsp;&lt;SPAN&gt;If(len(trim([realizedArrivalDateTime])) &amp;lt;&amp;gt; 0 OR len(trim([realizedDepartureDateTime])) &amp;lt;&amp;gt; 0, 'Not Missing', 'Missing') as [Arrival_Departure_Flag]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;,len(trim([realizedArrivalDateTime])) as [Arrival Length],&lt;BR /&gt;,len(trim([realizedDepartureDateTime])) as [Departure_Length]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From XyzSource;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;then add RecordID field to the table to verify each data row&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;alternatively you can also try below condition&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;if(len(KeepChar([realizedArrivalDateTime],'0123456789'))&amp;gt;1 or&amp;nbsp;len(KeepChar([realizedDepartureDateTime],'0123456789'))&amp;gt;1 , 'NotMissing','Missing') as&amp;nbsp;Arrival_Departure_Flag&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 05 Feb 2024 08:25:12 GMT</pubDate>
    <dc:creator>vinieme12</dc:creator>
    <dc:date>2024-02-05T08:25:12Z</dc:date>
    <item>
      <title>Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414352#M94951</link>
      <description>&lt;P&gt;I am attempting to create a field in Qlik to flag null values for 2 fields. The name of the fields that contain the nulls are called 'RealizedArrivalDateTime' and 'RealizedDepartureDateTime'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;the line of code in the Data Load Editor is as follows&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If(len(trim([realizedArrivalDateTime])) &amp;lt;&amp;gt; 0 OR len(trim([realizedDepartureDateTime])) &amp;lt;&amp;gt; 0, 'Not Missing', 'Missing') as [Arrival_Departure_Flag],&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;After loading this new field, i noticed every record was being tagged as 'Not Missing' even where value in realizedarrival and realizeddeparture was null.&amp;nbsp; As a test i added this code into the Data Load Editor&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;len(trim([realizedArrivalDateTime])) as [Arrival Length],&lt;BR /&gt;len(trim([realizedDepartureDateTime])) as [Departure_Length]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When i loaded these fields and built a small table to check, here were my results:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CheeseMan84_0-1706996564671.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/158970iBDD6EC53DBF83CBB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CheeseMan84_0-1706996564671.png" alt="CheeseMan84_0-1706996564671.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyone have any idea why these nulls have varying lengths greater than 0? Any other ideas as to how to key in on these values?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2024 21:44:43 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414352#M94951</guid>
      <dc:creator>CheeseMan84</dc:creator>
      <dc:date>2024-02-03T21:44:43Z</dc:date>
    </item>
    <item>
      <title>Re: Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414356#M94952</link>
      <description>&lt;P&gt;Hi try this the other way round:so all&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If(len(trim([realizedArrivalDateTime])) &amp;gt; 0 OR len(trim([realizedDepartureDateTime])) &amp;gt; 0, 'Missing', 'Not Missing') as [Arrival_Departure_Flag],&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Also if tis does not work can you supply an example of the datetime field as there is other options for the if statement.&lt;/P&gt;</description>
      <pubDate>Sat, 03 Feb 2024 23:45:10 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414356#M94952</guid>
      <dc:creator>NellyAcko</dc:creator>
      <dc:date>2024-02-03T23:45:10Z</dc:date>
    </item>
    <item>
      <title>Re: Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414473#M94963</link>
      <description>&lt;P&gt;Unfortunately that statement did not work, because the null values are returning len values &amp;gt;0, every field shows as not missing. Below are some examples of the date time field i am using&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CheeseMan84_0-1707055193236.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159012i615C01A4788BA2E4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CheeseMan84_0-1707055193236.png" alt="CheeseMan84_0-1707055193236.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2024 14:00:01 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414473#M94963</guid>
      <dc:creator>CheeseMan84</dc:creator>
      <dc:date>2024-02-04T14:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414474#M94964</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/115053"&gt;@NellyAcko&lt;/a&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2024 14:00:57 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414474#M94964</guid>
      <dc:creator>CheeseMan84</dc:creator>
      <dc:date>2024-02-04T14:00:57Z</dc:date>
    </item>
    <item>
      <title>Re: Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414477#M94965</link>
      <description>&lt;P&gt;Can you try like suppose your date field expected leng 24 digits&lt;/P&gt;
&lt;P&gt;If(len(trim(field) )='24', 'not missing', ' missing')&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2024 14:37:07 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414477#M94965</guid>
      <dc:creator>anat</dc:creator>
      <dc:date>2024-02-04T14:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414499#M94966</link>
      <description>&lt;P&gt;OK so replicating your data you need to load the date fields and let QLIK know how this field is coded this is done one way as below:&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;1st of all the load lets QLIK read the date-time, once this is loaded you reload this data with your expression included which will now work as the fields are correctly identified as DateTime. Finally you drop the original load leaving you with&amp;nbsp;&amp;nbsp;the desired results.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;TEST: &lt;BR /&gt;LOAD&lt;BR /&gt;Timestamp#(realizedArrivalDeteTime, 'd/m/yyyy h:mm:ss tt') as realizedArrivalDeteTime,&lt;BR /&gt;Timestamp#(realizedDepartureDateTime, 'd/m/yyyy h:mm:ss tt') as realizedDepartureDateTime,&lt;BR /&gt;id_shift,&lt;BR /&gt;subOrderCode&lt;BR /&gt;FROM [lib://AttachedFiles/QLIK TEST DATES.txt]&lt;BR /&gt;(txt, utf8, embedded labels, delimiter is ',', msq);&lt;/P&gt;
&lt;P&gt;NoConcatenate&lt;BR /&gt;LOAD&lt;BR /&gt;Timestamp#(realizedArrivalDeteTime, 'd/m/yyyy h:mm:ss tt') as realizedArrivalDeteTime,&lt;BR /&gt;Timestamp#(realizedDepartureDateTime, 'd/m/yyyy h:mm:ss tt') as realizedDepartureDateTime,&lt;BR /&gt;id_shift,&lt;BR /&gt;subOrderCode,&lt;BR /&gt;if(len(trim([realizedArrivalDeteTime])) &amp;lt;&amp;gt; 0 OR len(trim([realizedDepartureDateTime])) &amp;lt;&amp;gt; 0, 'Not Missing', 'Missing') as [Arrival_Departure_Flag] &lt;BR /&gt;Resident TEST ;&lt;/P&gt;
&lt;P&gt;Drop table TEST;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="NellyAcko_0-1707064223461.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159019i598D55AB27E2B682/image-size/medium?v=v2&amp;amp;px=400" role="button" title="NellyAcko_0-1707064223461.png" alt="NellyAcko_0-1707064223461.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 04 Feb 2024 18:34:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414499#M94966</guid>
      <dc:creator>NellyAcko</dc:creator>
      <dc:date>2024-02-04T18:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414583#M94971</link>
      <description>&lt;P&gt;Receiving the following error:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CheeseMan84_0-1707108125583.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/159035iE7F79A3A7EBDD385/image-size/medium?v=v2&amp;amp;px=400" role="button" title="CheeseMan84_0-1707108125583.png" alt="CheeseMan84_0-1707108125583.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 04:42:13 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414583#M94971</guid>
      <dc:creator>CheeseMan84</dc:creator>
      <dc:date>2024-02-05T04:42:13Z</dc:date>
    </item>
    <item>
      <title>Re: Len function returning values greater than 0 for null fields</title>
      <link>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414663#M94982</link>
      <description>&lt;P&gt;You original script is actually working,&lt;/P&gt;
&lt;P&gt;but the table chart is showing you&lt;U&gt;&lt;STRONG&gt; unique combinations of all&lt;/STRONG&gt; &lt;/U&gt;"Not Missing" flags in the dataset &lt;U&gt;&lt;STRONG&gt;and NOT EACH DATA ROW&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you can verify this by adding a &lt;STRONG&gt;recno()&lt;/STRONG&gt; while loading the data&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Load&lt;/P&gt;
&lt;P&gt;Recno() as &lt;STRONG&gt;recordID&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;,&amp;nbsp;&lt;SPAN&gt;If(len(trim([realizedArrivalDateTime])) &amp;lt;&amp;gt; 0 OR len(trim([realizedDepartureDateTime])) &amp;lt;&amp;gt; 0, 'Not Missing', 'Missing') as [Arrival_Departure_Flag]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;,len(trim([realizedArrivalDateTime])) as [Arrival Length],&lt;BR /&gt;,len(trim([realizedDepartureDateTime])) as [Departure_Length]&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;From XyzSource;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;then add RecordID field to the table to verify each data row&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;alternatively you can also try below condition&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;SPAN&gt;if(len(KeepChar([realizedArrivalDateTime],'0123456789'))&amp;gt;1 or&amp;nbsp;len(KeepChar([realizedDepartureDateTime],'0123456789'))&amp;gt;1 , 'NotMissing','Missing') as&amp;nbsp;Arrival_Departure_Flag&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 05 Feb 2024 08:25:12 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Len-function-returning-values-greater-than-0-for-null-fields/m-p/2414663#M94982</guid>
      <dc:creator>vinieme12</dc:creator>
      <dc:date>2024-02-05T08:25:12Z</dc:date>
    </item>
  </channel>
</rss>

