<?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: short way to write select statement to avoid loading empty columns in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/short-way-to-write-select-statement-to-avoid-loading-empty/m-p/2089586#M89307</link>
    <description>&lt;P&gt;If you want to avoid the loading of empty fields you will need to check them before you start the load. This could be done by querying the system-tables of the data-base - which might be not always very simple as it could mean to combine multiple queries to get the needed information and/or requiring special access rights and may not be feasible by dynamic views.&lt;/P&gt;
&lt;P&gt;Beside this you could remove the empty fields also after the load by querying the Qlik system-fields, something like:&lt;/P&gt;
&lt;P&gt;for i&amp;nbsp; = nooffields('table') to 1 step -1&lt;BR /&gt;&amp;nbsp; &amp;nbsp;let vName = fieldname($(i), 'table');&lt;BR /&gt;&amp;nbsp; &amp;nbsp;let vContent = fieldvaluecount('$(vName)');&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if $(vContent) = 0 then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;drop fields [$(vName)];&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end if&lt;BR /&gt;next&lt;/P&gt;
&lt;P&gt;You may need here an there some adjustments to the syntax and/or to your logic (excluding some fields, also looping against the nooftables() with a similar logic, ...) but the approach in general will work.&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jun 2023 14:09:52 GMT</pubDate>
    <dc:creator>marcus_sommer</dc:creator>
    <dc:date>2023-06-30T14:09:52Z</dc:date>
    <item>
      <title>short way to write select statement to avoid loading empty columns</title>
      <link>https://community.qlik.com/t5/App-Development/short-way-to-write-select-statement-to-avoid-loading-empty/m-p/2089233#M89280</link>
      <description>&lt;P&gt;Hi, I often have to load from large databases that contains many columns with no data (null) and many times without knowing exactly what data are available.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to avoid having to load the data first, then checking each column, by dragging it into a table, to see if it is empty. It is very tedious.&lt;/P&gt;
&lt;P&gt;Is there a short way to write a Select satement (say for SQL like databases) that will avoid loading empty column, without explicitly checking each column using 'len(column)&amp;gt;0.' Again There could be hundreds of columns.&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jun 2023 15:42:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/short-way-to-write-select-statement-to-avoid-loading-empty/m-p/2089233#M89280</guid>
      <dc:creator>ynottableau</dc:creator>
      <dc:date>2023-06-29T15:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: short way to write select statement to avoid loading empty columns</title>
      <link>https://community.qlik.com/t5/App-Development/short-way-to-write-select-statement-to-avoid-loading-empty/m-p/2089247#M89281</link>
      <description>&lt;P&gt;We could use IS NOT Null and &lt;SPAN class="crayon-k "&gt;Coalesce &lt;/SPAN&gt;function in sql statement to work with null values&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;IS NOT&amp;nbsp; NUll:-&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;IS NOT NULL&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;condition is used to return the rows that contain non-NULL values in a column&lt;/SPAN&gt;&lt;/P&gt;
&lt;DIV id="urvanov-syntax-highlighter-649da9ffe0f41608601968-1" class="crayon-line"&gt;&lt;SPAN class="crayon-k"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="crayon-i"&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt; &lt;SPAN class="crayon-i"&gt;LastName&lt;/SPAN&gt; &lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;MiddleName&lt;/SPAN&gt; &lt;SPAN class="crayon-k"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="crayon-i"&gt;Person&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;.&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;Person&lt;/SPAN&gt; &lt;SPAN class="crayon-k"&gt;WHERE&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV id="urvanov-syntax-highlighter-649da9ffe0f41608601968-2" class="crayon-line"&gt;&lt;SPAN class="crayon-i"&gt;MiddleName&lt;/SPAN&gt; &lt;SPAN class="crayon-k"&gt;IS&lt;/SPAN&gt; &lt;SPAN class="crayon-k "&gt;NOT&lt;/SPAN&gt; &lt;SPAN class="crayon-k "&gt;NULL&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="crayon-line"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="crayon-line"&gt;&lt;SPAN class="crayon-k "&gt;Coalesce function :-&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="crayon-line"&gt;&lt;SPAN class="crayon-k "&gt;&lt;SPAN&gt;The&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;COALESCE()&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;SPAN&gt;function takes unlimited parameters and returns the first non-null expression in a list.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV class="crayon-line"&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV class="crayon-line"&gt;
&lt;DIV id="urvanov-syntax-highlighter-649da9ffe0f47823446798-1" class="crayon-line"&gt;&lt;SPAN class="crayon-k"&gt;SELECT&lt;/SPAN&gt; &lt;SPAN class="crayon-i"&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;LastName&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;Suffix&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;Title&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV id="urvanov-syntax-highlighter-649da9ffe0f47823446798-2" class="crayon-line"&gt;&lt;SPAN class="crayon-k"&gt;COALESCE&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;(&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;Title&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;Suffix&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;,&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;FirstName&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;)&lt;/SPAN&gt; &lt;SPAN class="crayon-k"&gt;AS&lt;/SPAN&gt; &lt;SPAN class="crayon-i"&gt;NewValue&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV id="urvanov-syntax-highlighter-649da9ffe0f47823446798-3" class="crayon-line"&gt;&lt;SPAN class="crayon-k"&gt;FROM&lt;/SPAN&gt; &lt;SPAN class="crayon-i"&gt;Person&lt;/SPAN&gt;&lt;SPAN class="crayon-sy"&gt;.&lt;/SPAN&gt;&lt;SPAN class="crayon-i"&gt;Person&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 29 Jun 2023 16:19:29 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/short-way-to-write-select-statement-to-avoid-loading-empty/m-p/2089247#M89281</guid>
      <dc:creator>udit_k</dc:creator>
      <dc:date>2023-06-29T16:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: short way to write select statement to avoid loading empty columns</title>
      <link>https://community.qlik.com/t5/App-Development/short-way-to-write-select-statement-to-avoid-loading-empty/m-p/2089586#M89307</link>
      <description>&lt;P&gt;If you want to avoid the loading of empty fields you will need to check them before you start the load. This could be done by querying the system-tables of the data-base - which might be not always very simple as it could mean to combine multiple queries to get the needed information and/or requiring special access rights and may not be feasible by dynamic views.&lt;/P&gt;
&lt;P&gt;Beside this you could remove the empty fields also after the load by querying the Qlik system-fields, something like:&lt;/P&gt;
&lt;P&gt;for i&amp;nbsp; = nooffields('table') to 1 step -1&lt;BR /&gt;&amp;nbsp; &amp;nbsp;let vName = fieldname($(i), 'table');&lt;BR /&gt;&amp;nbsp; &amp;nbsp;let vContent = fieldvaluecount('$(vName)');&lt;BR /&gt;&amp;nbsp; &amp;nbsp;if $(vContent) = 0 then&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;drop fields [$(vName)];&lt;BR /&gt;&amp;nbsp; &amp;nbsp;end if&lt;BR /&gt;next&lt;/P&gt;
&lt;P&gt;You may need here an there some adjustments to the syntax and/or to your logic (excluding some fields, also looping against the nooftables() with a similar logic, ...) but the approach in general will work.&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jun 2023 14:09:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/short-way-to-write-select-statement-to-avoid-loading-empty/m-p/2089586#M89307</guid>
      <dc:creator>marcus_sommer</dc:creator>
      <dc:date>2023-06-30T14:09:52Z</dc:date>
    </item>
  </channel>
</rss>

