nifi-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bryan Bende <>
Subject Re: Arithmetic operations using the UpdateRecord processor
Date Thu, 30 Nov 2017 16:53:26 GMT

Unfortunately record path currently does not have arithmetic
operations. You can see all of the available operations in the record
path guide [1].

However, I think you can still handle this specific scenario with two
consecutive UpdateRecord processors...

In the first one, use the record path replacement strategy, and just
copy the value of field1 to field2 by specifying a property like
/field2 = /field1

In the second, use the literal replacement strategy and specify a
property like /field2 = ${field.value:multiply(2)}

This is taking advantage of the fact that the literal replacement
strategy provides access to, field.value, and field.type.

It would definitely be more ideal to do it in one pass over the data,
so feel free to open a JIRA to add some arithmetic operations to
record path.




On Thu, Nov 30, 2017 at 11:38 AM, Vance Courtney
<> wrote:
> Is there a way to perform arithmetic operations using the UpdateRecord
> processor? I would like to update field1 with the results of multiplying the
> value of field2 by two.  I tried using
> replaceRegex( /results, '.*', /value*2) but get an unexpected token "*".  I
> figured it's due to the Replacement Value Strategy "Record Path Value"
> evaluating the contents as a string value. When using the literal path I am
> not sure of a way to reference another record path.  Any information would
> be much appreciated.
> --
> Very Respectfully,
> Vance Courtney
> Cell: (361) 596-3555
> OnyxPoint Systems Engineer

View raw message