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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
CN
Contributor II
Contributor II

Add Field to Existing Data Table in Load Script

I have a data table in my load script that contains a field, [City]. I want to add a NEW  field to the table, [Region].

[Region] does not currently exist and will need hard-coding to group the cities listed in the [City] field into specific regions in the new [Region] field.

EXAMPLE:

[Region] = ('Americas North', 'Eurasia', 'Australasia', 'LATAM', 'China')

[City] = ('Milwaukee', 'New York', 'Brisbane', 'London', etc...)

 

In the example, above, I would group 'Milwaukee' and 'New York' under "Americas North" in the Region field. That way my cities are grouped by region. This way I'm able to show metrics for a region, not limited to a city, or having to manually filter on all applicable cities.

 

Any script syntax help appreciated.

1 Solution

Accepted Solutions
skamath1
Creator III
Creator III

A quick option would add an inline table with the following script.

You can add additional lines to each city and its region.  Make sure the city field name is associated correctly to your existing field.

Regions:

LOAD * Inline
[City, Region
Milwaukee,Americas North
New York,Americas North
Brisbane,Australasia
London,Eurasia
];

View solution in original post

1 Reply
skamath1
Creator III
Creator III

A quick option would add an inline table with the following script.

You can add additional lines to each city and its region.  Make sure the city field name is associated correctly to your existing field.

Regions:

LOAD * Inline
[City, Region
Milwaukee,Americas North
New York,Americas North
Brisbane,Australasia
London,Eurasia
];