MATLAB Answers

last_entry_id

14 views (last 30 days)
Jaye Hicks
Jaye Hicks on 12 Oct 2020 at 17:35
Commented: Jaye Hicks on 14 Oct 2020 at 13:49
ThingSpeak auto assigns an unique identifier to each new inbound record for a given channel. Within the record the identifier is named 'last_entry_id.' Each auto assigned id is auto increment by one over the previous id. What is the largest numeric value that last_entry_id will reach? If there is an upper bound, what will happen when it is reached? Will a roll over occur such that last_entry_id is reset to 0 or 1?
Thanks in advance for the information.

  0 Comments

Sign in to comment.

Answers (1)

Christopher Stapels
Christopher Stapels on 14 Oct 2020 at 12:29
Can you describe why you need the last_entry_id?
It is not recommended to be used for the reasons you mention (rollover, finite upper bound.)

  1 Comment

Jaye Hicks
Jaye Hicks on 14 Oct 2020 at 13:49
I have developed custom code to process incoming sensor data. The data is pulled by my code from a thingspeak endpoint. In my design I thought to leverage last_entry_id in three different ways.
First, I read a block of data going back in time slightly further than I need to and then cycle through the data, starting with the oldest, ignoring records until the incoming last_entry_id is larger than the largest last_entry_id that I stored off, in a database, from the last time that I pulled a block of sensor data. Are you suggesting that this is not advised or is some how not viable?
The second and the third ways that my design uses last_entry_id involves detecting gaps. I raise warning / error log messages if I detect a numeric gap either across data pulls or within a block of data from a single pull. Specifically, as I process a new block of pulled sensor data does the first last_entry_id begin at a value that is one more than the value that I stored off (from the previous data pull)? And during the processing of individual records within a single data pull, are there any numbers skipped in the 'increment by one' progression of last_entry_id? Are you suggesting that this is not advised or is some how not viable?

Sign in to comment.

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!