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

Renaming a string in columns

Hi, please help me. I have a column as follows:

APN
inet
static
cvpn

I need to rename it from 'inet' to 'resident', from 'static' to 'corporate' and from 'cvpn' to 'test'. How can I do this please? Thank you very much.

1 Solution

Accepted Solutions
rahulpawarb
Specialist III
Specialist III

Hello Peter,

Open script editor and replace APN field with below given expression:

if(APN = 'inet', 'resident', if(APN = 'static', 'corporate', if(APN = 'cvpn', 'test', APN))) AS APN

Regards!

Rahul

View solution in original post

3 Replies
tcullinane
Creator II
Creator II

If this is a Field and not a calculated dimension then in your load script create a mapping table before you load the field.

Something like

APN_Map:

mapping

Load * inline [

mapfrom, mapto

inet, resident

static, corporate

cvpn, test

];

Then when you are loading the APN field use

applymap('APN_Map',APN) as APN

surendraj
Specialist
Specialist

t1:

LOAD * INLINE [

   

    APN

    inet

    static

    cvpn

];

NoConcatenate

load *,

if(WildMatch(APN,'inet'),'resident' ,

  if(WildMatch(APN,'static'),'corporate',

    if(WildMatch(APN, 'cvpn'),'test'))) as APN1

Resident t1;

drop Table t1;

rahulpawarb
Specialist III
Specialist III

Hello Peter,

Open script editor and replace APN field with below given expression:

if(APN = 'inet', 'resident', if(APN = 'static', 'corporate', if(APN = 'cvpn', 'test', APN))) AS APN

Regards!

Rahul