Skip to main content
ChuckE
Gold ⭐️
February 8, 2023
Solved

toNumber() function NOT returning a number

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

 

 

ChuckE
ChuckEAnswer
Gold ⭐️
February 9, 2023

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.

1 reply

ChuckE
ChuckEAuthorAnswer
Gold ⭐️
February 9, 2023

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.

Translate