4
votes

Can you update attribute using replace text of an attribute's value?

I have an attribute - ${a} which has a place holder called "PLACEHOLDER". How do I replace each occurrence of the word "PLACEHOLDER" in attribute ${a} with the value of attribute ${b}?

I have tried using replace text processor - using both Regex Replace and Literal Replace replacement strategies without any luck. See below my example. 1. Generate flow file. Generate Flowfile

  1. Replace text attempt 1 - literal replace strategy enter image description here

  2. Replace text attempt 2 - regex replace strategy enter image description here

None works as attribute value is unchanged.

enter image description here

How can I achieve this? If not this processor, which one please? How? Thanks in advance!

1

1 Answers

9
votes

Haha...Such a bummer. Found the answer. Should have kept digging through the documentation i guess. Use update attribute processor then set attribute to ${a:replace('PLACEHOLDER', ${b})} Hope this helps someone who's not searched documentation properly like me in future :-)