String Manipulation

Hello, I am trying to achieve a simple manipulation where I have a column named “Date” and I want to manipulate the strings which look like this “10.05.2023” to omit “.2023” and therefore to just read “10.05”
In “String Manipulation (multi column)” I use: replace($Date$, “.2023”, “”) but KNIME keeps failing as the column never changes.

Hi @Sustainability

Do you have the Date column in the Include Section at the top of the configuration?

I tried to replicate your error and it failed when I moved the Date column to Exclude

Regards
Heather

1 Like

Hello @HeatherPikairos, thanks for your quick response. Yes, of course it is on the “include section”. Did you manage to manipulate the string as described?

Best regards

The expression replace($Date$, ".2023", "") works fine for me:

2 Likes

Hi @Sustainability Yes I was able to manipulate the string as described. I did the same as @elsamuel and it worked for me too.

Could you send a screenshot of your String Manipulation node? Or if the data isn’t confidential, share the workflow with us?

Thanks
Heather

Hi @Sustainability ,

I know that is a old post, but if can put some tips here for future knime users, you can use substring function, regular expression at string manipulation nodes or string to date&time and after that, convert again into string, but make changes for the format/expression.

Example:

image

Substring

image

substr($$CURRENTCOLUMN$$,0,5)

Regular expression:

image

It brings only the information before “.year”.

And using string to date&time and convert to string again:

At here, I change the format for “MM.dd” to set my values.

All examples are here to download and see.

KNIME_project_date_manipulation.knwf (26.2 KB)

BR,

Denis

1 Like

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