Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested IF or use variable?

I'm a newbie. Currently I am using nested IFs in a LOAD statement. Something like this:

LOAD Region,

IF (Region='UK','Europe',

IF (Region='Germany','Europe',

IF (Region='France','Europe, Region) AS WWRegion,

This works fine but I am loading several tables from several data sources and have to use this same structure and values in several LOAD statements. If I add another country to Europe, I need to go modify the script in several places. I am wanting to setup some sort of variable that is a table or set of values. Something like this:

SET EUCountries = {'UK','Germany','France'};

LOAD Region

IF (Region=EUCountries,'Europe',Region) AS WWRegion,

Is this something that can be done in a QlikView script? If so, what is the specific syntax?

Any help is appreciated. Thanks!

1 Solution

Accepted Solutions
Not applicable
Author

Use of mapping tables will be an easier and generalized approach.

1. Creata a mapping table with country as key and region as the mapped field

2. 'applymap' the region against the country whenever you load data from the respective QVD.

Initial SQL load need to require any conditional if in this case.

--Arun

View solution in original post

2 Replies
Not applicable
Author

Use of mapping tables will be an easier and generalized approach.

1. Creata a mapping table with country as key and region as the mapped field

2. 'applymap' the region against the country whenever you load data from the respective QVD.

Initial SQL load need to require any conditional if in this case.

--Arun

Not applicable
Author

Thanks Arun. I'll give this a try.

Regards.