Created 04-21-2016 10:40 PM
Hi
How do you pull in a new attribute added by using UpdateAttribute, such as add a new attribute name as 'label' and value as 'source1', to flow file (say file saved to location by PutFile processor)?
Data Provenance showed new attribute with the right value in Attributes tab, but in Content tab Output Claim view does not show the new attribute at all. Shouldn't it shows there too?
Thanks!
Shannon
Created 04-21-2016 10:41 PM
Hey Shannon,
You would call the new attribute with the expression language so you would type /root/${label}/ the {$VARIABLE} syntax can be used anywhere where expression language is allowed.
Created 04-21-2016 10:41 PM
Hey Shannon,
You would call the new attribute with the expression language so you would type /root/${label}/ the {$VARIABLE} syntax can be used anywhere where expression language is allowed.
Created 04-21-2016 11:10 PM
Hey Chris,
Thanks for the help! A follow up question-- what processor would it take to call the new attribute and add to the flowfile before sending to PutFile? It can't be MergeContent, right? couldn't find anything like union.
Thanks again!
Shannon
Created 04-21-2016 11:14 PM
are you looking to replace the flowfile content with the extracted attribute? Perhaps AttributesToJSON
If you could mark my answer as correct if that solves the first one it closes out this question!
Created 04-21-2016 11:54 PM
Hey Chris,
No - not replace, but add the new attribute to original attributes.
Thanks!
Shannon
Created 04-22-2016 03:47 AM
Architecturally each mmessage is immutable, changing anything in it means re-writing the flow-file contents. To add text to a message like that is tough. Is the message already in JSON format?
Created 04-22-2016 03:56 AM
yes, it is json format already.
update: parse all to attributes then turn them all back to Json together with new attribute solved it.
Thanks a lot for all your help!
Shannon
Created 04-22-2016 06:51 PM
Shannon, try to extract the entire json into an attribute like you do. Then do "attributesToJson" to push it all inot one flow file perhaps?