Add "%" Symbol behind each number for multiple columns

Dear all,
Please I would love to add the percentage symbol in front of all the values for multiple columns. I know “String Manipulation(Multiple Column)”, but I have been trying to do it to no avail
Thanks
Financial Sample.xlsx (31.6 KB)

Hello @chefor99 ,
image
[…]


[…]
image

The tittle said behind and the statement says in front. Just flip the addends.
Regards

@gonhaddock Thank you for this. But what is there are 50 columns? So I have to use 50 Java Snippet nodes? Or is there a way I can do this for multiple columns?

I would use it into a loop for a repetitive task; feeding it with the variable column header.
Then, for complex tasks involving excel, i would move to R nodes

@gonhaddock I’m still not very experience user in KNIME, if you could show me for say 5 columns, I’ll appreciate it

Hi @chefor99 , in the String Manipulation (Multi Column) node
you can add the following expression:
$$CURRENTCOLUMN$$+"%"

or

“%” + $$CURRENTCOLUMN$$

depending on if it is In Front or Behind that you have decided on.

You then choose whether you wish to Append or Replace columns, and in the Include list at the top right, include the columns you wish to act on. I’ve attached that as a very basic flow.
Is this actually what you require? Once they’ve got the % sign appended you are aware that they are no longer numeric, and so you cannot do further mathematical functions on them?
Is there something else you were wanting it to do?

KNIME_concatenate_percentage.knwf (48.8 KB)

4 Likes

Yes @takbb ,
Looping around Java Snippet may result messy.
Thanks

KNIME_messy.knwf (33.2 KB)

@chefor99
One other thing, to select your columns, if they all start with the word “Percentage”, a good way to select them would be to choose “Wildcard/Regex Selection” and then enter a simple wildcard Percentage* in the pattern. Then it will auto-include all those columns and nothing else.

3 Likes

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