Hello
I have come across something odd and inconsistent with the column expression node.
I am aware this might be a user bug and not a KNIME bug
I have created a example workflow, for those who wish too, to download.
Objective: get a list of strings of varying length. make each string 10 characters long by either chopping the 11th character to the nth, or filling the start of the string with X(s).
Nodes:
Table creator holds the list of strings
Column Expression Node 6: removes spaces
Column Expression Node 9: adds a column called value AND counts the length of string.
Question 1: why must I reduce the length of string by 1 to get the correct length? (In some languages I would expect to add 1 to the length because the first count is 0, but I have never had to reduce it by 1 before)
Column Expression Node 10: removes 11th character to the nth OR fills the start of the string with X(s)
Column Expression Node 11: counts the length of string.
See Question 1
Question 2 If you look at the output table of node 11 you will find lengths of either 9 or 10 even though there are 10 characters in each string. How? Why?
example row 6: value = AjaxAmster len = 9 (there are 10 characters in AjaxAmster)
example row 108: value = FCBarcelon, len = 9 (there are 10 characters in FCBarcelon)
example row 5: value = XXXXASRoma, len = 10 (there are 10 characters in XXXXASRoma)
Just one more thing…
This was cobbled together to show an example of what I have found, I know the code within the column expression nodes are not ideal.
Frank Columbo