Building location hierarchy in KNIME

My table looks like this :

|Global || Region || Country || State || City
Global Africa Liberia Lofa Agikolazizu
Global Americas USA Ohio Cincinnati

I want add a Location column and have the table look like this

| Location || Global || Region || Country || State || City
Global Global Global Global Global Global
Africa Global Africa none none none
Americas Global Americas none none none
Liberia Global Africa Liberia none none
USA Global Americas USA none none
Lofa Global Africa Liberia Lofa none
Ohio Global Africa Liberia Ohio none
Agikolazizu Global Africa Liberia Lofa Agikolazizu
Cincinnati Global Africa Liberia Lofa Cincinnati

I look forward to your assistance, thanks

I always start this kind of thing with a Regex Split node to divide into separate columns. Then it usually becomes easy to clean things up via Column Expression node.

Hi @theMaryamO , you should probably explain what’s the logic/rules to apply.

If you aim to put in the “Location” column the rightmost (i.e. most specific) non-null value in the row you could use a “Column Expressions” node like here 20220303_location – KNIME Hub

You can also use the Missing Values node to quickly replace all of your missing value “?” cells with “none”.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.