What i am trying to do is add errorMessages or eventMessages (Strings) to a collection as they happen (from different rules) while i am away to read them out to me when i come home.
So different rules would need to be able to add to this variable.
An item that could hold this collection would be nice, but i don’t know if they exist.
A dirty workaround would be a String item with some delimiter on which i could split when i need to go over the list or sort it. But i wonder if there would be a cleaner way to do it.
You can create a set of string Items, and a “stack push” rule that copies from each to an ‘older’ one, discarding the oldest as a new message arrives. If you want, you can add timestamp text to the message.
All other rules post to the same Item.
Using the new rule engine, scripted automation, and the helper libraries, I use a Python Queue object stored in a module to hold notification messages.
In Rules DSL you can use Design Pattern: Separation of Behaviors and keep the collection in the one place. The Rule that triggers when you return to read out the messages will need to be in the same .rules file.
Indeed, there is no Collections type Item. You’d have to encode and parse the messages into a single String Item.
Ok thanks. That confirms my “dirty workaround” idea.