Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Often times in interfaces we have this use case.

 We have a datasource which we can query with sequential IDs

For instance in email protocols like the IMAP protocol will give each email a unique sequential ID.

 We need to have a convenient way to set the ID we want to begin from but we need to keep on incrementing it

So we can decide where to take the feed from.

For instance I might not want to get my emails all the way back to the origin of time.

 The 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.

 local NextId = COUNTget("NextMailId") is how we fetch the data

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

 COUNTset("NextMailId", NextId) is how we set it.

So this saves the new value of the custom field in the custom field value file.

 It means we can see the NextMailId in the card view of the component - and we can set it too!

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

  • No labels