Multiple/Nested Templates

Will the notecard handle multiple templates (with each a unique ‘file’ name)? - so that a template can be chosen at ‘run-time’ based on the message being output.

Also, can templates be nested … like an ‘array’ of structures a template could contain an array of templates?

regards, Rich …

Hi @richf,

Yes, you can utilize multiple templates on a single Notecard (and you’re correct that the template to be used is specified by the file parameter in a note.add request).

Templates cannot be nested. I’m curious to know your use case though!

Thanks,
Rob

Hi Rob,

We monitor a “variable” number of devices from 0 to 16 – with each device having the same return data fields. So, if 3 devices are currently ‘on-line’, the message sent to the Notecard from the HOST, will have a ‘pre-amble’ and an array of 3 ‘structures’ (one for each device) – the number of ‘on-line’ devices can change in real-time …

An alternative to ‘nested’ structures would be to define 17 templates … one for each of up to 16 devices and a ‘special’ case of no devices. We would then choose the appropriate template based on the number of devices ‘on-line’.

regards, Rich …