<?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 Subfield with leading and/or trailing separator creates difficult to remove character in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Subfield-with-leading-and-or-trailing-separator-creates/m-p/2104573#M90237</link>
    <description>&lt;DIV&gt;Has anyone come across the SubField() function creating a difficult to remove character when the string you give it contains leading and/or trailing separator characters?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;The below example produces what appears to be an empty row, but copying the contents of the cell into notepad++ suggests its a NBSP, and using ORD() suggests its a Chr(0).&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I have tried PURGECHR(), KEEPCHR(), and TRIM() but nothing seems to remove it. The only success I have had is making an if statement around [String] to remove the leading and trailing ';' values - which works, but isn't ideal because the actual data can have the ';' value appearing in 4 different patterns.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Script:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;LOAD&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; SubField(String, ';') AS [Strings]&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;INLINE [&lt;BR /&gt;&lt;BR /&gt;String&lt;BR /&gt;&lt;BR /&gt;;abc;def;ghi;&lt;BR /&gt;&lt;BR /&gt;];&lt;/PRE&gt;
&lt;DIV&gt;Result:&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Substring bug screenshot.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114066i54897911192B26EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Substring bug screenshot.png" alt="Substring bug screenshot.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;</description>
    <pubDate>Thu, 10 Aug 2023 14:03:39 GMT</pubDate>
    <dc:creator>Tom_Mitchell</dc:creator>
    <dc:date>2023-08-10T14:03:39Z</dc:date>
    <item>
      <title>Subfield with leading and/or trailing separator creates difficult to remove character</title>
      <link>https://community.qlik.com/t5/App-Development/Subfield-with-leading-and-or-trailing-separator-creates/m-p/2104573#M90237</link>
      <description>&lt;DIV&gt;Has anyone come across the SubField() function creating a difficult to remove character when the string you give it contains leading and/or trailing separator characters?&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;The below example produces what appears to be an empty row, but copying the contents of the cell into notepad++ suggests its a NBSP, and using ORD() suggests its a Chr(0).&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;I have tried PURGECHR(), KEEPCHR(), and TRIM() but nothing seems to remove it. The only success I have had is making an if statement around [String] to remove the leading and trailing ';' values - which works, but isn't ideal because the actual data can have the ';' value appearing in 4 different patterns.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Script:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;PRE&gt;LOAD&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; SubField(String, ';') AS [Strings]&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;INLINE [&lt;BR /&gt;&lt;BR /&gt;String&lt;BR /&gt;&lt;BR /&gt;;abc;def;ghi;&lt;BR /&gt;&lt;BR /&gt;];&lt;/PRE&gt;
&lt;DIV&gt;Result:&lt;/DIV&gt;
&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Substring bug screenshot.png" style="width: 400px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/114066i54897911192B26EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Substring bug screenshot.png" alt="Substring bug screenshot.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 10 Aug 2023 14:03:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Subfield-with-leading-and-or-trailing-separator-creates/m-p/2104573#M90237</guid>
      <dc:creator>Tom_Mitchell</dc:creator>
      <dc:date>2023-08-10T14:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Subfield with leading and/or trailing separator creates difficult to remove character</title>
      <link>https://community.qlik.com/t5/App-Development/Subfield-with-leading-and-or-trailing-separator-creates/m-p/2104578#M90238</link>
      <description>&lt;P&gt;Perhaps just use a preceding load to check if the length of the outcome string is greater than zero?&lt;/P&gt;
&lt;P&gt;Load Strings&lt;BR /&gt;Where Len(Strings)&amp;gt;0;&lt;BR /&gt;LOAD&lt;/P&gt;
&lt;P&gt;SubField(String, ';') AS [Strings]&lt;/P&gt;
&lt;P&gt;INLINE [&lt;/P&gt;
&lt;P&gt;String&lt;/P&gt;
&lt;P&gt;;abc;def;ghi;&lt;/P&gt;
&lt;P&gt;];&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Should also be fairly easy to check if the leftmost string is the separator and if so, use Mid(String,2,9999) instead of the full string.&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 14:18:40 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Subfield-with-leading-and-or-trailing-separator-creates/m-p/2104578#M90238</guid>
      <dc:creator>Or</dc:creator>
      <dc:date>2023-08-10T14:18:40Z</dc:date>
    </item>
    <item>
      <title>Re: Subfield with leading and/or trailing separator creates difficult to remove character</title>
      <link>https://community.qlik.com/t5/App-Development/Subfield-with-leading-and-or-trailing-separator-creates/m-p/2104606#M90240</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6142"&gt;@Or&lt;/a&gt;&amp;nbsp; you are right, the preceding load with where clause does remove it. I did try, and obviously failed somehow.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then PurgeChar() and KeepChar() don't remove the problem, because the blank value doesn't exist until the SubField() has done its job.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;LEN() appears to be the only way to remove unwanted value. Wonder if the SubField function could be improved to not generate an empty value, or at least mention it in the Help page for SubField.&lt;/P&gt;
&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/6142"&gt;@Or&lt;/a&gt;&amp;nbsp; for the answer &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Aug 2023 15:11:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Subfield-with-leading-and-or-trailing-separator-creates/m-p/2104606#M90240</guid>
      <dc:creator>Tom_Mitchell</dc:creator>
      <dc:date>2023-08-10T15:11:49Z</dc:date>
    </item>
  </channel>
</rss>

