Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Shaglok
Contributor III
Contributor III

Very easy question (usage of ELSE during app load)

Hello.

I am new to Qlik and have a very easy question. In my data I have a column with this values:

Default

Chinese

Spanish

Online

Warehouse

Store

During the load of the app, I need to change all but "Chinese" and "Spanish" into "English". I have 4 REPLACES at this moment that are doing the job, but I know that this is not the optimal.

REPLACE(REPLACE(REPLACE(REPLACE(column1, 'Default', 'English'), 'Online','English'),'Warehouse','English'),'Store','English') as language

How can I optimize this with ELSE to get it ready if we need to add more values?

Thanks!!

Labels (1)
3 Replies
brunobertels
Master
Master

Hi 

have a look to the applymap function 

 

https://www.youtube.com/watch?v=H0SBt4U343g 

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Here's how you can do it with an if(). 

if(Match(column1, 'Chinese', 'Spanish'), column1, 'English') as column1

-Rob

Edit note: Typo corrected.

barnabyd
Partner - Creator III
Partner - Creator III

G'day @Shaglok,

The applymap() function is great for more complex scenarios but Rob's solution is better for this one, however he has a typo. It should read ...

if( Match(column1, 'Chinese', 'Spanish') > 0, column1, 'English') as column1

Although it's not strictly necessary, I always include "> 0" as the Match() function returns an integer and not a boolean value.

Cheers, Barnaby.

Barnaby Dunn
BI Consultant