Support Questions

Find answers, ask questions, and share your expertise

How correct convert from Decimal with E to float in Apache NiFi ?

New Contributor

I suppose that my problem is very simple.
I have a problem with correct convert from Decimal to float in NiFi. I have an attribute originalTime with value
When i use UpdateAttributeProcessor and then I write ${original:toNumber()}
I get value like this:
I know that correct format is:
How is method of correct conversion and how properly get .166?


New Contributor

Ok. I found a simple solution to convert Scientific Notation To Decimal Notation.

I used ExecuteScript processor and i writed a simple script in JavaScript .

The code is below:

var flowFile = session.get();
if (flowFile != null) {
        var date = flowFile.getAttribute('date');
        var valueDate= Number(date);
        flowFile = session.putAttribute(flowFile, 'date', valueDate);
session.transfer(flowFile, REL_SUCCESS)
Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.