Hey Stephane,
Currently working with Decimals in NiFi is like putting a square peg in a round
hole. I haven't tried to do it much but for a simple use-case like yours I
believe there are two options.
1: Use Expression Language and a Regex to move the decimal2: (Not 100% sure
this works) Use the scripting processors to write a script to do the routing
For option 1 I think you can do something like this
"${myAttr:replaceAll("0.(\d)(\d*)", "$1"):lt(1)}. This should "move" the
decimal over one place so that you can check it against the 1. This assumes
there is nothing else in that attribute.For option 2, Matt Burgess would need
to weigh-in.
As for NIFI-1662, it got de-prioritzed in that I got super busy with everything
else I was doing for MiNiFi-0.0.1 and NiFi-1.0.0 (on-going) and it went to the
back-burner. It's something I really want to get in though, along with a few
other changes, because I think they open NiFi up to many new possibilities. I'd
like to do it (decimals) in 1.1.0 since it wouldn't be a breaking change.
Hope that helps,Joe - - - - - - Joseph Percivalllinkedin.com/in/Percivalle:
[email protected]
On Thursday, August 11, 2016 8:16 PM, Stéphane Maarek
<[email protected]> wrote:
Hi,
I have a flow in which I extract an attribute from json using jsonpath. That
attribute happens to be a decimal number (0.123). I wanted to do a simple
operation such as myAttr:lt(0.1) but obviously that won't work. What also won't
work is myAttr:multiply(10):lt(1). I'm kinda stuck and I really need this logic
to be working. What do you advise as a workaround?
Also, I've seen there is a JIRA for this:
https://issues.apache.org/jira/browse/NIFI-1662 but stuff hasn't moved much
since it first appeared. Not sure if it got de-prioritized or something
Congrats on the 1.0.0 beta, it looks great !!
Cheers,Stephane