Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Join this live chat April 6, 10AM EST - QlikView to Qlik Sense REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Saro_2306
Contributor
Contributor

If Statement

Hi Friends,

I have a query in writing if statement.  I have list of country names and need to group them with certain criteria and countries those which not satisfies criteria should me mentioned as 'Others'. Any one can please advise how to write script for this.?

 

if(Country=Kuwait' or Country='Abu Dhabi' or Country='Qatar' or Country='Bahrain' or Country='Iraq' or Country='Dubai ' , 'Gulf Countries', if(Country='Jordan' orCountry='Saudi Arabia' , 'Middle East Countries', ______) as Region

Labels (2)
1 Solution

Accepted Solutions
Vegar
Partner
Partner

If you have a lot of values then it could be a better approach to use a mapping table and ApplyMap() to solve your need. Take a look at the script below.

mapRegion:
LOAD * inline [
A,         B
Kuwait,    Gulf Countries
Abu Dhabi,    Gulf Countries
Qatar,        Gulf Countries
Bahrain,      Gulf Countries
Iraq,         Gulf Countries
Jordan,       Middle East Countries
Saudi Arabia, Middle East Countries
Norway,       Scandinavian Countries
Sweden,       Scandinavian Countries
];

LOAD *,
applymap('mapRegion', Country, 'No region') as Region
FROM SOURCE;

Plees ekskuse my Swenglish and or Norweglish spelling misstakes

View solution in original post

1 Reply
Vegar
Partner
Partner

If you have a lot of values then it could be a better approach to use a mapping table and ApplyMap() to solve your need. Take a look at the script below.

mapRegion:
LOAD * inline [
A,         B
Kuwait,    Gulf Countries
Abu Dhabi,    Gulf Countries
Qatar,        Gulf Countries
Bahrain,      Gulf Countries
Iraq,         Gulf Countries
Jordan,       Middle East Countries
Saudi Arabia, Middle East Countries
Norway,       Scandinavian Countries
Sweden,       Scandinavian Countries
];

LOAD *,
applymap('mapRegion', Country, 'No region') as Region
FROM SOURCE;

Plees ekskuse my Swenglish and or Norweglish spelling misstakes

View solution in original post