Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
everest226
Creator III
Creator III

change the name of the value in script

I have a field name   GINT  which has  following value   TIm, TWA, TIC,   now i want to convert that value name into  bellow name .

field GINT is comming from  AP TP table

TIm  =    TIm- ta IL CA

TWA=   TIM- Wa AA

TIC=      TA-Ws-CC

 

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

try this:
aux_change:
mapping
load * inline [
key,value
TIm,'TIm- ta IL CA'
TWA,'TIM- Wa AA'
TIC ,'TA-Ws-CC'
];

MAP Field GINT_New Using aux_change;

Table:
load
GINT,
GINT_New
FROM AP TP ;

View solution in original post

5 Replies
Marcos_rv
Creator II
Creator II

try this:
aux_change:
mapping
load * inline [
key,value
TIm,'TIm- ta IL CA'
TWA,'TIM- Wa AA'
TIC ,'TA-Ws-CC'
];

Table:
load
..
..
applymap('aux_change' , GINT ,GINT ) AS GINT
FROM AP TP ;

Saludos!!!
everest226
Creator III
Creator III
Author

Thanks, what i want to keep that old field with old name and and create new field with that new mapping name.  so i can use both field in required place 

eduardo_dimperio
Specialist II
Specialist II

You could use a IF instead a mapping,

If(GINT ='TIm','TIm- ta IL CA',If(GINT ='TWA','TIm- ta IL CA','TA-Ws-CC')) AS New_GINT

 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

try this:
aux_change:
mapping
load * inline [
key,value
TIm,'TIm- ta IL CA'
TWA,'TIM- Wa AA'
TIC ,'TA-Ws-CC'
];

MAP Field GINT_New Using aux_change;

Table:
load
GINT,
GINT_New
FROM AP TP ;

Marcos_rv
Creator II
Creator II

try this:
aux_change:
mapping
load * inline [
key,value
TIm,'TIm- ta IL CA'
TWA,'TIM- Wa AA'
TIC ,'TA-Ws-CC'
];

Table:
load
..
..
GINT,
applymap('aux_change' , GINT ,GINT ) AS GINT_NEW
FROM AP TP ;

but Rwunderlich solution is so so so so so so so so nice!!!