<?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: Advanced: Remove leading zeros in Qlik Sense the right way in App Development</title>
    <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033957#M85202</link>
    <description>&lt;P&gt;you really are talking about special cases which i think you need to analyze closely as there is a risk that not all special cases are defined and you will be left with a very convoluted expression.&amp;nbsp; you need to be able to negotiate a simpler requirement.&amp;nbsp; as i said +2 is a number which is 2.&amp;nbsp; converting 1,234,567 to a number that looks like 1,234,567 is a formatting of the number.&amp;nbsp; so you really are lumping a whole lot of concepts into one go.&lt;BR /&gt;&lt;BR /&gt;maybe what you need is a secondary flag that tells you when you should perform a conversion or not - simplifies your expression a lot&lt;/P&gt;</description>
    <pubDate>Fri, 03 Feb 2023 15:15:59 GMT</pubDate>
    <dc:creator>edwin</dc:creator>
    <dc:date>2023-02-03T15:15:59Z</dc:date>
    <item>
      <title>Advanced: Remove leading zeros in Qlik Sense the right way</title>
      <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033753#M85182</link>
      <description>&lt;P&gt;Hi everyone! I read many posts here to remove the leading zeros from SAP ids if it's a number but never found the correct answer.&lt;/P&gt;
&lt;P&gt;Many will fail in simple or more complex cases. The rule is that you must remove leading zeros in a code, if it's followed by digits [0-9] only. Else return the input code. The output must be a text only. The RegEx matching pattern could be something like ^0*(\d+)$|(.*). See&amp;nbsp;&lt;A href="https://regex101.com/" target="_blank" rel="noopener"&gt;https://regex101.com/&lt;/A&gt;&amp;nbsp;if you want to test other input codes.&lt;/P&gt;
&lt;P&gt;Examples:&lt;/P&gt;
&lt;P&gt;Load&lt;/P&gt;
&lt;P&gt;&amp;nbsp; input,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; expected_output,&lt;/P&gt;
&lt;P&gt;&amp;nbsp; YourFunction(input) as output&lt;/P&gt;
&lt;P&gt;Inline [&lt;/P&gt;
&lt;P&gt;&amp;nbsp; input|expected_output&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 000000124789|124789&lt;/P&gt;
&lt;P&gt;&amp;nbsp; abcdef|abcdef&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 0001LMPn|0001LMPn&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 01-23|01-23&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 0000000000|0&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 000004.1523|000004.1523&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 000 4751|000 4751&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 123,456,789|123,456,789&lt;/P&gt;
&lt;P&gt;&amp;nbsp; -01562|-01562&lt;/P&gt;
&lt;P&gt;&amp;nbsp; +2987001453|+2987001453&lt;/P&gt;
&lt;P&gt;] (delimiter is '|');&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What is "YourFunction" here so that output = expected_output for all inputs?&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: changed the delimiter in the inline load as&amp;nbsp;&lt;A id="link_18" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.qlik.com/t5/user/viewprofilepage/user-id/34575" target="_self" aria-label="View Profile of jbhappysocks" aria-describedby="userProfileCard-34575"&gt;&lt;SPAN class=""&gt;Jbhappysocks&lt;/SPAN&gt;&lt;/A&gt;&amp;nbsp;suggested.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 05 Feb 2023 18:23:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033753#M85182</guid>
      <dc:creator>JeromeNagarro</dc:creator>
      <dc:date>2023-02-05T18:23:30Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced: Remove leading zeros in Qlik Sense the right way</title>
      <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033913#M85197</link>
      <description>&lt;P&gt;since a field can contain both text and number,&amp;nbsp; you can try this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;Load if(num(input)=input, num(input), input) as input Inline [
input, expected_output
000000124789, 124789
abcdef, abcdef
0001LMPn, 0001LMPn
01-23, 01-23
0000000000, 0
000004.1523, 000004.1523,
000 4751, 000 4751,
123,456,789, 123,456,789
-01562, -01562
+2987001453, +2987001453
];&lt;/LI-CODE&gt;
&lt;P&gt;the +298....&amp;nbsp; is i think a special case as +2 = 2&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 13:51:47 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033913#M85197</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2023-02-03T13:51:47Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced: Remove leading zeros in Qlik Sense the right way</title>
      <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033940#M85200</link>
      <description>&lt;P&gt;Tested the suggested script and the output didn't match expected output so had to give it a try, this at least solves it for example input, but I have a feeling there might be more exceptions, or that someone will come up with a neater solution&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Load &lt;BR /&gt;input, &lt;BR /&gt;if(num(input)=input, num(input), input) as output, &lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;text( //"The output must be a text only"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if(left(input,1)=0, //"The rule is that you must remove leading zeros in a code"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if(isnum(num#(input)), //"if it's followed by digits [0-9] only" No text input&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;if(frac(input)&amp;gt;0,input, //"if it's followed by digits [0-9] only" No decimals&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;num(input,'0')) // removes initial 0&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;,input), //"Else return the input code"&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;input)) //"Else return the input code" &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;as output2,&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;expected_output&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Inline [&lt;BR /&gt;input| expected_output&lt;BR /&gt;000000124789| 124789&lt;BR /&gt;abcdef| abcdef&lt;BR /&gt;0001LMPn| 0001LMPn&lt;BR /&gt;01-23| 01-23&lt;BR /&gt;0000000000| 0&lt;BR /&gt;000004.1523| 000004.1523&lt;BR /&gt;000 4751| 000 4751&lt;BR /&gt;123,456,789| 123,456,789&lt;BR /&gt;-01562| -01562&lt;BR /&gt;+2987001453| +2987001453&lt;BR /&gt;] (delimiter is '|');&lt;/P&gt;
&lt;P&gt;(Had to change to | to avoid&amp;nbsp;123,456,789 being split in the inline)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jbhappysocks_1-1675435283876.png" style="width: 753px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/99679i620C5DCD80ECCE46/image-dimensions/753x320?v=v2" width="753" height="320" role="button" title="jbhappysocks_1-1675435283876.png" alt="jbhappysocks_1-1675435283876.png" /&gt;&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;</description>
      <pubDate>Fri, 03 Feb 2023 14:43:34 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033940#M85200</guid>
      <dc:creator>jbhappysocks</dc:creator>
      <dc:date>2023-02-03T14:43:34Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced: Remove leading zeros in Qlik Sense the right way</title>
      <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033957#M85202</link>
      <description>&lt;P&gt;you really are talking about special cases which i think you need to analyze closely as there is a risk that not all special cases are defined and you will be left with a very convoluted expression.&amp;nbsp; you need to be able to negotiate a simpler requirement.&amp;nbsp; as i said +2 is a number which is 2.&amp;nbsp; converting 1,234,567 to a number that looks like 1,234,567 is a formatting of the number.&amp;nbsp; so you really are lumping a whole lot of concepts into one go.&lt;BR /&gt;&lt;BR /&gt;maybe what you need is a secondary flag that tells you when you should perform a conversion or not - simplifies your expression a lot&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 15:15:59 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033957#M85202</guid>
      <dc:creator>edwin</dc:creator>
      <dc:date>2023-02-03T15:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced: Remove leading zeros in Qlik Sense the right way</title>
      <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033995#M85208</link>
      <description>&lt;P&gt;Well, not that special really. We got two conditions presented:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Either input starts with 0 or it doesn't&lt;/LI&gt;
&lt;LI&gt;Either input with starting 0 is followed by only 0-9, or it isn't.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;And we got a pretty clear example of what output was expected for strange examples, like +2 or 123,456 etc. We can't start making up other outcomes as correct.&lt;/P&gt;
&lt;P&gt;Based on conditions and expected output this I created a pretty straight forward formula and output matches expected output. All good.&lt;/P&gt;
&lt;P&gt;But sure, as I also said, there might be other exceptions, so this solution is only true as long as the conditions are clear. But not is not really for me to say, I can only test with provided examples.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As I also said, I am sure someone can do better than I did and hopefully post here for all of us to learn from.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Working day is over in Sweden now, time to grab a beer. Have a great weekend!&lt;/P&gt;</description>
      <pubDate>Fri, 03 Feb 2023 16:13:04 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2033995#M85208</guid>
      <dc:creator>jbhappysocks</dc:creator>
      <dc:date>2023-02-03T16:13:04Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced: Remove leading zeros in Qlik Sense the right way</title>
      <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2034892#M85288</link>
      <description>&lt;P data-unlink="true"&gt;&lt;SPAN class=""&gt;As&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A id="link_18" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://community.qlik.com/t5/user/viewprofilepage/user-id/34575" target="_self" aria-label="View Profile of jbhappysocks" aria-describedby="userProfileCard-34575"&gt;Jbhappysocks&lt;/A&gt;&lt;/SPAN&gt;&amp;nbsp;said, this doesn't work in many cases presented above.&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 11:04:09 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2034892#M85288</guid>
      <dc:creator>JeromeNagarro</dc:creator>
      <dc:date>2023-02-07T11:04:09Z</dc:date>
    </item>
    <item>
      <title>Re: Advanced: Remove leading zeros in Qlik Sense the right way</title>
      <link>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2034899#M85289</link>
      <description>&lt;P&gt;Thank you for your answer!&lt;/P&gt;
&lt;P&gt;It looks great but it doesn't work with ThousandSep = ' ' (fr-FR locale settings) for the input '&lt;SPAN&gt;000 4751'. It returns '4751'. That's a shame because I can't wrap your answer in a neat function.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 07 Feb 2023 11:14:15 GMT</pubDate>
      <guid>https://community.qlik.com/t5/App-Development/Advanced-Remove-leading-zeros-in-Qlik-Sense-the-right-way/m-p/2034899#M85289</guid>
      <dc:creator>JeromeNagarro</dc:creator>
      <dc:date>2023-02-07T11:14:15Z</dc:date>
    </item>
  </channel>
</rss>

