That works :) That implies knowing a bit about the scale of numbers, but
that's a decent workaround. It'd be so great if decimals were supported
natively though. Or at least the casting of decimal to int without having
to remove the decimal
i.e (1.2):toNumber() instead of
1.2:toString().substringBefore('.'):toNumber()On Fri, Aug 12, 2016 at 4:59 PM Conrad Crampton <[email protected]> wrote: > HI, > > Can you coerce to a string, take the numbers after the decimal point and > use that? So a similar logic to multiplying by 10 then doing the > comparison. Obviously have to revert back to number to do the actual > comparison though. > > Haven’t tested but something like… > > myAttr:toString():substringAfter(‘.’):toNumber():lt(1) > > Conrad > > > > *From: *Stéphane Maarek <[email protected]> > *Reply-To: *"[email protected]" <[email protected]> > *Date: *Friday, 12 August 2016 at 01:16 > *To: *"[email protected]" <[email protected]> > *Subject: *How to deal with decimals while they're not supported? > > > > 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 > > > > ***This email originated outside SecureData*** > > Click here <https://www.mailcontrol.com/sr/MZbqvYs5QwJvpeaetUwhCQ==> to > report this email as spam. > > > SecureData, combating cyber threats > > ------------------------------ > > The information contained in this message or any of its attachments may be > privileged and confidential and intended for the exclusive use of the > intended recipient. If you are not the intended recipient any disclosure, > reproduction, distribution or other dissemination or use of this > communications is strictly prohibited. The views expressed in this email > are those of the individual and not necessarily of SecureData Europe Ltd. > Any prices quoted are only valid if followed up by a formal written quote. > > SecureData Europe Limited. Registered in England & Wales 04365896. > Registered Address: SecureData House, Hermitage Court, Hermitage Lane, > Maidstone, Kent, ME16 9NT >
