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: 
Sra1bandi
Contributor III
Contributor III

Country selection

Hi,

I have two fields 

Load * Inline

[Countrycoede          Name

In                                      India

Us                                     America

AU                                   Australia

EU                                    Europe

UK                                  UnitedKingdom

Pk                                    Pak  ]

 

and i have 3rd table with country codes like below

CC Codes 

AU ,                      

In,Us,

Uk,Pk,Eu,

Pk,

IN,Pk,Us,Uk,Au

 

i need result like

CC code                          CounrtyName

AU ,                                     Australia

In, Us,                                India, America 

Uk, Pk, Eu,                       Unitedkingdom, Pak, Eeurope

Pk,                                       Pak

IN,Pk,Us,Uk,Au              India, Pak, America , UnitedKingdom, Austrealia

In                                         India

 

i am used primary key as Country code i am getting output only where there is single country code if there are multiple country codes in one value it's showing blank i need output like above mentioned.

my result 

CC code                          CounrtyName

AU ,                                     Australia

In, Us,                                -

Uk, Pk, Eu,                      -

Pk,                                       Pak

IN,Pk,Us,Uk,Au            -

In                                         India

 

Need output

 

CC code                          CounrtyName

AU ,                                     Australia

In, Us,                                India, America 

Uk, Pk, Eu,                       Unitedkingdom, Pak, Eeurope

Pk,                                       Pak

IN,Pk,Us,Uk,Au              India, Pak, America , UnitedKingdom, Austrealia

In                                         India

 

Regards 

Sra1

 

Labels (1)
2 Solutions

Accepted Solutions
rubenmarin

Hi, you can try with MapSubstring:

mapCountryName:
Mapping LOAD Upper(Countrycode), Name Inline [
    Countrycode,Name
    In,India
    Us,America
    AU,Australia
    EU,Europe
    UK,UnitedKingdom
    Pk,Pak
];

Result:
LOAD *, MapSubString('mapCountryName',Upper([CC Codes])) as CountryName Inline [
CC Codes 
AU ,                      
In,Us,
Uk,Pk,Eu,
Pk,
IN,Pk,Us,Uk,Au
] (delimiter is ';')

View solution in original post

sidhiq91
Specialist II
Specialist II

@Sra1bandi  Please see below. 

CountryCodes:
Mapping Load
Upper(Countrycode) as [CC Codes],Name Inline [
Countrycode,Name
In,India
Us,America
AU,Australia
EU,Europe
UK,UnitedKingdom
Pk,Pak
];

CCCodes:
NoConcatenate
Load *,
MapSubString('CountryCodes',Upper([CC Codes])) as Name
Inline [
CC Codes
AU
In,Us
UK,Pk,EU
Pk
In,Pk,Us,UK,AU
](delimiter is '|');

Exit Script;

View solution in original post

2 Replies
rubenmarin

Hi, you can try with MapSubstring:

mapCountryName:
Mapping LOAD Upper(Countrycode), Name Inline [
    Countrycode,Name
    In,India
    Us,America
    AU,Australia
    EU,Europe
    UK,UnitedKingdom
    Pk,Pak
];

Result:
LOAD *, MapSubString('mapCountryName',Upper([CC Codes])) as CountryName Inline [
CC Codes 
AU ,                      
In,Us,
Uk,Pk,Eu,
Pk,
IN,Pk,Us,Uk,Au
] (delimiter is ';')
sidhiq91
Specialist II
Specialist II

@Sra1bandi  Please see below. 

CountryCodes:
Mapping Load
Upper(Countrycode) as [CC Codes],Name Inline [
Countrycode,Name
In,India
Us,America
AU,Australia
EU,Europe
UK,UnitedKingdom
Pk,Pak
];

CCCodes:
NoConcatenate
Load *,
MapSubString('CountryCodes',Upper([CC Codes])) as Name
Inline [
CC Codes
AU
In,Us
UK,Pk,EU
Pk
In,Pk,Us,UK,AU
](delimiter is '|');

Exit Script;