How to checks if a column exists and do 2 different actions if yess or not

Hi,

If have a project where i receive data in tables and a column is weather in kg or tons. I already changed the columns names so it is weather Poids_kg or Poids_tonnes, then, i need to change tons to kg but i can’t find how to use 2 different paths : one to divide data if it’s in tons (and change name to Poids_kg) and another to do nothing if it’s already in kg. I’ve tried differents switches but nothing worked.

I’m new to Knime and everything’s pretty hard to urderstand :confused:

Hi @Elise_1 Welcome to the KNIME community! :slight_smile:

Just to confirm, are your values in the input table in one or two columns? Have you created the columns with names “Poids_kg” or “Poids_tonnes”?

Would it be possible for you to share some example data (fake data if the real data is sensitive)?

2 Likes

The data is directly take from email attachements from clients and formated. But clients don’t always send csv with the same column order or type (i can have different type of informations).

That is the data i have at this point of my workflow (after remaming columns by type)

1 Like

I have made a quick workflow to demonstrate using a case switch to detect the column name and then perform a conversion and rename of a column. I’m not sure if this exactly covers what you need to do, but hopefully it helps!

Here is the workflow on the hub:

You can download it or drag and drop it into your platform to view it :slight_smile:

Let me know if you have any other questions!

6 Likes

It’s perfect, thanks !!!

1 Like

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