Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to Delete leading zeros

Requirement is to delete fields starting with zeros and make it as NULL. Also keep NULL for alpha-numeric values.

  

Old FieldNew Field
00123Null
345345
045Null
0000563Null
65896589
34573457
asddNull
fgfdgNull
13 Replies
Anonymous
Not applicable
Author

perhaps like that?:

LOAD * where not wildmatch([Current Field],'0*');

LOAD * INLINE [

    Current Field

    00123

    345

    045

    0000563

    5644

];

MarcoWedel

‌If(not [Old Field] like '0*', [Old Field]) as [New Field]

regards

Marco

Siva_Sankar
Master II
Master II

Hi Kirubakaran,

Find the attached example.

following script checks if the column begins with zero and it checks whether it is alphanumeric, if yes then returns Null,else the values.

Load *,

if(left([Old Field],1)=0 or isnum([Old Field])=0 ,'Null',num([Old Field])) as [New Field];

LOAD [Old Field]

FROM

[https://community.qlik.com/thread/263073]

(html, codepage is 1252, embedded labels, table is @1);

Capture.JPG

-Siva

Anonymous
Not applicable
Author

Hi

Please find attached application.

Community.jpg

Hope it helps!!