Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Support Questions

Find answers, ask questions, and share your expertise
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!

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.