Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to load column as number as well as text

Hi I have data like

x
01234

01234

09872

CK78

GH78

I want to load x with no leading zeros like 1234 and text as same. Both should be of number and integer type.

5 Replies
antoniotiman
Master III
Master III

try like this

Load

if (Num(x) > 0, Num(x),x) as x

from ....;

Not applicable
Author

you can try following code

replace(ltrim(Replace(X,'0',' ')),' ','0') as X_New

hope this will help you.

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this script

LOAD

If(IsNum(x),Num(x), x) AS zx

INLINE [

x

01234

01234

09872

CK78

GH78];

Regards,

Jagan.

ashfaq_haseeb
Champion III
Champion III

Hi,

Try below

LOAD *,

replace(ltrim(replace(x, '0', ' ')), ' ', 0) as New_Number;

load * Inline

[

x

01234

01234

09872

CK78

GH78

];

Regards

ASHFAQ

MarcoWedel

Hi,

one solution:

Alt(Num(x), x)

QlikCommunity_Thread_130555_Pic1.JPG.jpg

table1:

LOAD x,

    Alt(Num(x), x) as Alt_x

Inline [

x

01234

01234

09872

CK78

GH78

];

hope this helps

regards

Marco