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 3 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 for my email I would like to begin at say message 10000 and then progressively keep moving forward from there.

So I need an easy way to begin there and then have my component keep track of what ones it has already and get the next ones etc.

 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