Hello Ralph,
A common way to replace the contents of a FlowFile with specific text is to use 
the ReplaceText processor. The default search query will match the entire 
content and replace it with whatever your replacement value is. So if you set 
the replacement value (complete with expression language usage) to the query 
you want the FlowFile content will become the query.
In order to do that you need to have the ID from the JSON message as a FlowFile 
attribute. You will need to use ExtractText [1] to get the ID out of the 
content. If the JSON tag is unique (found via regex), you could forgo the 
EvaluateJSONPath processor and just use the ExtractText processor.  [1] 
https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.ExtractText/index.html
Hope that helps,Joe- - - - - - Joseph Percivalllinkedin.com/in/Percivalle: 
[email protected]
 

    On Wednesday, January 13, 2016 3:16 PM, "Perko, Ralph J" 
<[email protected]> wrote:
 

  Hi 
I want to use the PutSQL processor to execute an insert statement. The use case 
is straightforward.  I need to pull an id attribute from a JSON message and 
write it to a database.  I am using EvaluateJSONPath to grab the id but I’m 
hung up on how to then pass the SQL statement as the content.  I could put the 
SQL statement in a file to be loaded as content but I am wondering if there is 
a way to do this inline with the flow? Ideally I would have the content of the 
FlowFile be the SQL and pass in the id as a SQL parameter as mentioned in the 
documentation.  
Thanks for your help,Ralph


  

Reply via email to