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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
CN
Contributor II
Contributor II

Load Script: Hard-code groups into a NEW field, [Region], using [City] field in same table

I have a table, called gm_PPM, with a field [City]. I would like to create a new field, [Region], to group the cities within.

EXAMPLE: IF ([City] = 'Milwaukee','Chicago','New York', 'North America')

I want six region titles listed in the new [Region] field: 'North America', 'South America', 'Africa', 'Eurasia', 'Australia', 'China'

How do I create a new field in the table, called "Region?"

How do I hard-code groups Regions based on the cities from the [City] field?

 

Please Help.

2 Replies
tincholiver
Creator III
Creator III

You will then have to make a grouping for each region you want:


If (City = 'City1' or City = 'City2' or City = 'City3', 'Region 1',
If (City = 'City1' or City = 'City2' or City = 'City3', 'Region 2',
If (City = 'City1' or City = 'City2' or City = 'City3', 'Region 3'))) as Region, 

and so on with all you need

settu_periasamy
Master III
Master III

If you want this in script level,

You can create a excel file with City and Region or Create a Inline Load with these two fields.

Then link with City.