Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

everest226
Contributor 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
MVP & Luminary
MVP & Luminary

Re: change the name of the value in script

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 ;

5 Replies
Marcos_rv
Contributor II

Re: change the name of the value in script

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!!!
Highlighted
everest226
Contributor III

Re: change the name of the value in script

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_dimperi
Valued Contributor II

Re: change the name of the value in script

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

 

MVP & Luminary
MVP & Luminary

Re: change the name of the value in script

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
Contributor II

Re: change the name of the value in script

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!!!