8 Replies Latest reply: Aug 23, 2017 8:40 AM by Dileep Chalasani RSS

    How to Trim Leading Zero's from Numeric value of a Alpha Numeric datatype

    Dileep Chalasani

      Hello All,

       

      Need Help in Trimming Leading zero's from a Alpha Numeric data type.

      We bring data to Qlik Sense from SAP BW. In this Case Material which is a 18 digit alphanumeric character.

       

      My Data looks like:

      00000000000100345

      00000000000100692

      05241X-001

      05491X-001

       

      I would like to remove leading zeros from only numeric fields. The result set should be like

      100345

      100692

      05241X-001

      05491X-001

       

      I am currently using the below script for Customer data to remove leading zero's which is working, this will not work for Material because it will trim Zero's for 05241X-001 value also.

       

      Replace(LTrim(Replace(CUSTOMER,'0',' ')),' ','0') as Customer

       

      I searched other Qlik Threads for solution also but didn't find anything helpful.

       

      Any Suggestions will be appreciated.

       

      Thanks

      Dileep Chalasani.