Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

toNumber() function NOT returning a number

avatar
Expert Contributor

When attempting to insert a timestamp in milliseconds into a flowfile using the UpdateRecord processor, the timestamp comes out expressed as a string (first image) despite the fact that I've explicitly cast it as a number (second image).   How can I get this expressed as a number like it is supposed to?

 

Screenshot 2023-02-08 at 15.15.13.png

 

Screenshot 2023-02-08 at 16.36.53.png

 

 

1 ACCEPTED SOLUTION

avatar
Expert Contributor

I resorted to using an Avro schema with the RecordsetWriter in order to coerce the values into numbers.  So even though the documentation says toNumber's return type is "Number", it doesn't get expressed that way.  But the schema fixes it so its all good.

View solution in original post

1 REPLY 1

avatar
Expert Contributor

I resorted to using an Avro schema with the RecordsetWriter in order to coerce the values into numbers.  So even though the documentation says toNumber's return type is "Number", it doesn't get expressed that way.  But the schema fixes it so its all good.