I'm trying to understand how to use the QueryRecord value that I have calculated from a flowfile with SQL.
I have a flowfile with, for example, 4 flat records and I want to calculate a SUM() of worked hours from each record. I make it work so I now have a summarized value of hours as output in a separate relationship, but how can I add this value to the original flowfile? As a new attribute or other way?
To me the flowfile and the calculated value are split in two separate flowfiles with almost nothing holding them together.
I must be missing something?
Thanks for any help or hints...
SELECT SUM("hours") FROM FLOWFILE
Flowfile data for the new relationship that I want to add to the original flowfile:
You can use "ConvertAvroToJSON" and then the "EvaluateJsonPath" Processor and add there the Property like "workingHours" and as Value you set your JsonKey like $.hours
With this you add it to the attribute of your FlowFile.
Thanks, but I have no problem writing the calculation code. It's the new relationship that gets the summarized value I can't really handle in a good way. It's becoming a new flowfile and I loose the connection to the original flowfile.