AndreP
June 26, 2023, 7:30am
1
Hi!
I have a question again.
I need a workflow that executes search & replace multiple times on the same value.
Additonally with a list of search & replace terms.
So far I’ve only managed to get one value replaced per interation.
See my Example.
Thanks in advance!
have you tried nested replace within the same string manipulation node?
e.g.
replace(replace(…))
br
1 Like
AndreP
June 27, 2023, 10:52am
3
Daniel_Weikert:
nested replace
Hi,
thats works for a small fixed number og cases.
But how do I handle this when the list is always expanding? At some point I will have hundreds of terms there. The formula would then become endless.
Any other Idea?
I test JavaSnippet (simple) node now. Maybe that can be a solution.
BR
Andre
AndreP
June 27, 2023, 12:14pm
4
JavaSnippet has no possibilty to add the rule via flow variable. Therefore no option too.
But I handle it now via recrusive loop instead of the normal loop. Thats works now!
Hope thats helpful for anyone else with the same request.
2 Likes
Probably depends on the length of the list. (Regexreplace could be an option)
glad that you found a solution for you
br
2 Likes
Hello @AndreP
I couldn’t avoid to give it a try. I can visualized two possible solutions to your challenge:
The first one would be an upgrade of your solution; by using recursive loop. But you already worked out by yourself.
The alternative solution is the one that I consider more interesting, as it explores KNIME nodes functions and format properties. It is based in Tagging and Replace of Document format, avoiding loop iterations. I’ve prepared a workflow example for your use case.
Please share your thoughts about.
BR
2 Likes
AndreP
June 28, 2023, 9:11am
8
Hi, I tried it. Looks like a good solution! Works for me. Thanks!
1 Like
Hi @AndreP
Thank you for validating the the solution.
I had some concerns about scaling from mock to real dataset. Your feedback is appreciated.
BR
AndreP
June 28, 2023, 11:26am
10
OK I test it on my example cases. Still have to check it with a big load of data. But this needs some days on my side.
1 Like
system
Closed
July 5, 2023, 11:26am
11
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.