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

renaming values if multiple values should have same values

hi i like to rename filed values 

ex :

dalls to 001

houston  to 002

and austin and elpaso has 003 how to get values  by variable or expressions

dalls  001

houston 002

austin 003

elpaso 003

 

....................

 

 

 

1 Solution

Accepted Solutions
7 Replies
jobsonkjoseph
Creator III
Creator III

Hi,

What is the output of renamed field you are expecting, your question is not clear.

Also, renaming of which axes are you referring in chart.

sanjeeva_279
Contributor
Contributor
Author

Thanks for quick reply i need to know how to rename the field values as mentioned.

dalls to 001

houston to 002

and austin and elpaso has 003 how to get values by variable or expressions

dalls 001

houston 002

austin 003

elpaso 003
jyothish8807
Master II
Master II

Hi Sanjeeva,

 

May be like this, i am  not completely clear on your requirement.

Load

Yourfiled,

replace(replace(replace(replace(Yourfield,'dalls','001'),'houston','002'),'austin','003'),'elpaso','003') as NewField

from <>;

 

 

Best Regards,
KC
jobsonkjoseph
Creator III
Creator III

Hi Sanjeeva,

Mindagaus reply would help you. Try to use applymap(). Below is the sample script, pls modify according to your requirement, if it helps.

 

map:
Mapping LOAD * INLINE [
    Month1, Month
    1, Jan
    2, Feb
    3, Mar
    4, Apr
    5, May
    6, June
    7, July
    8, Aug
    9, Sep
    10, Oct
    11, Nov
    12, Dec
];

 

table:
LOAD 
     applymap('map',Month) as Month,
    
FROM
[..\Downloads\data.xlsx]
(ooxml, embedded labels, table is data);

Anonymous
Not applicable

Hi,
Use Mapping you will get the solution as your requirements
refer below code

main:
Mapping
LOAD * Inline
[
region,id
dalls,001
houstan,002
austin,003
elpaso,003
];

temp:
LOAD * Inline
[
name,region
A,dalls
B,houstan
C,austin
D,elapso
];

main:
LOAD region,
ApplyMap('main',region,if(WildMatch(region,'elapso'),'003'))as code
Resident temp;
DROP Table temp;


Thanks








sanjeeva_279
Contributor
Contributor
Author

thanks all for the quick help.
i tried as nested if and the code is below ,i wanted solution as variable

=if(sport='Backpacking Boots', 'Backpacking Boots',if( sport='Athletic' or sport='Baseball','sportsnew','others'))