trying to add a specific amont of characters to a cell

Hello I have a weird job, and I am kinda stuck on how to actually finish it, basically each cell needs to have a specific amount of characters according to a document my plan is to at the end after the Knime is clean and organized then add a bunch of characters according to the size it needs to be and then remove to make it fit example
the first column has 6 characters, I need to have 12 no matter what (so if in the future a document with 5 or 7 characters this still needs to work) so I will just add twelve 0 to the end of it how would I make a code in a string manager to only allow 12 characters in that cell removing all the extra 0 on the left?
thank you very much for your time

Hi @Bleck,

I hope i understand your problem correctly.
You can add characters in the string manipulation node with LPAD

->this adds characters to the string to the defined limit
e.g. LPAD(col1,5,‘0’) adds 0 to the string until the column has at least 5 characters - and does nothing if there are already 5 or more characters.

With substr(col,0,8) you can limit the column to a maximum of 8 characters.

Attached a example where the columns are limited to 8 characters and are filled up with ‘0’ should they contain less characters:



KNIME_project8.knwf (6.5 KB)


yes that fix all my problems, some column will need to have stuff on the left instead of right but that is easy enough to fix, thank you very much


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