Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleCreate a custom number field called 'NextId' and set it to the value 1 in your card.

See Custom Fields

Expand
titleThe COUNT library solves this problem by giving a convenient interface to GET/SET a custom field value

Remember Custom Fields the values for these are stored on disc in JSON. This means we can load and save them programmatically.

This is what this library does.

Image Added

Expand
titlelocal NextId = COUNTget("NextId") is how we fetch the data

This is how we get the data from a custom field called NextId.

Code Block
local NextId = COUNTget("NextId") 

...

Expand
titleIt means we can see the NextId in the card view of the component - and we can set it too!
Image Added

Expand
titleThis is a complete little program to increment a custom number field
Code Block
require "COUNT.COUNT"

function main(Data)
   --Poll the component every 52 seconds
   component.setTimer{delay=50002000}
   local NextId = COUNTget("NextId")
   NextId = NextId+1
   COUNTset('NextId', NextId)
end
Expand
titleThe COUNT library solves this problem by giving a convenient interface to GET/SET a custom field value

Remember Custom Fields the values for these are stored on disc in JSON. This means we can load and save them programmatically.

This is how this library works.

This is a very useful pattern for lots of ‘feeder’ interfaces.