String manipulation with flow variable

Dear KNIME Community,

I would like to build a component that allows me select specific columns to then manipulate. In the image below the first manipulation is successful in shorting zip codes in to 5 digits only, using a flow variable. Then when I try to do the same operation but instead using the capitalize function it fills the entire row with the title of the column selected rather than editing the strings in the column. See supporting images belong.

Any help is appreciated.




image

Hi @mmays -

Can you upload a workflow containing your component and some dummy data? That would help others to better help you troubleshoot.

What if you return the variable without a function? Do you get expected results? That is how I would start debugging
br

I would switch over to a Column Expression and use upperCase(column(variable("column-selection")))

It is counter intuitive but $${Scolumn-selection}$$ is just a static value, the dynamic values needs to be forced using the column() function, something that the String Manipulation node does not have.

1 Like

Column Selection.knwf (2.4 MB)

Here is the workflow with dummy data. Now both columns are outputting the title for all rows. @ArjenEX I will try your suggestion now. Thanks

It should be fine as described :slight_smile: The other syntax would be substr(column(variable("ZIP")), 0 , 5)

2 Likes

That’s great! I have one more request, is there a way to have the flow variable tied to the output column in the event that I use a different document with a different column name for the city?

Sure: go to the flow variable section of the node, under the expression, set the outputName field to the column-selection flow variable. That way it will always update the column that you nominated.

Whenever the flow variable is applied, KNIME will warn you about this in the bottom section of the node.

2 Likes

I appreciate all your help!

1 Like

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