Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
durgabhavani
Creator III
Creator III

Help to value to country code?

Hi All,

I have a mapping file with below country codes.

 

Ctry_CdeCountry
AUAustrialia
INIndia
BMBermuda
CNChina
BANBangladesh
NZNew Zealand
AMArmenia
PAKPakistan
TUTurkey
BLBelgium
HKHong Kong
USUnited States
UKUnited Kingdom

I have another field Txt country like below.

 

Text_Ctry
AU,IN,BM
CN,BAN,BL
PAK,NZ
AM,TU,UK
US,IN,XX
UK,HK,YY
HN,UK,IN
US,RM,CN

I want to assign the text value 'No Mapping' to country codes which are not in my mapping file (that means some new country codes will come in future and they needs to be assign text value "No Mapping". Here example XX,YY,HN,RM have no country codes in country mapping  file). Please find the expected output below.

I am able to map the country codes to country names with below code, but not able to assign the text value No Mapping.

Mapping
CTY_TEMP:
LOAD Ctry_Cde,
Country
FROM
[Test Data.xlsx]
(
ooxml, embedded labels, table is Sheet1);

LOAD Text_Ctry,
MapSubString('CTY_TEMP',Text_Ctry) AS Text_Ctry1
FROM
[Test Data.xlsx]
(
ooxml, embedded labels, table is Sheet2);

Current Output with above code:

   

Text_Ctry_Final
Austrialia,India,Bermuda
China,Bangladesh,Belgium
Pakistan,New Zealand
Armenia,Turkey,United Kingdom
United States,India,XX
United Kingdom,Hong Kong,YY
HN,United Kingdom,India
United States,RM,China

Expected Output

 

Text_Ctry_Final
Austrialia,India,Bermuda
China,Bangladesh,Belgium
Pakistan,New Zealand
Armenia,Turkey,United Kingdom
United States,India,No Mapping
United Kingdom,Hong Kong,No Mapping
No Mapping,United Kingdom,India
United States,No Mapping,China

Please advice. 

11 Replies
durgabhavani
Creator III
Creator III
Author

I am able to resolve it with your code. thank you very much...

durgabhavani
Creator III
Creator III
Author

I mark it as helpful. Correct answer is not populating.