Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X
We have a gateway in the field that will be sending up events as they happen, and example would be an estop pressed, or a solenoid actuated. With each event there will be sent a start time and a duration. What is the best way to store these events? I would like a general events infotable for each "thing" that holds the name of the event, time, and duration. Should a new row be added as each event occurs, or should I use a stream and just replace the existing row with the most current event?
Solved! Go to Solution.
What I did when facing a similar situation recently was create an infotable type logged property on my thing with a datashape containing the fields I wanted to trap from the event (e.g. maybe for you it is event name, event duration/value, event timestamp... if the value stream timestamp is somehow not appropo). That would give you an ongoing history of events you could query from the value stream (and perhaps purge over time ultimately too).
I then subscribed to data changes on that property and generated whatever property updates and events I want for performing more specific actions on particular types of event names that are received.
What I did when facing a similar situation recently was create an infotable type logged property on my thing with a datashape containing the fields I wanted to trap from the event (e.g. maybe for you it is event name, event duration/value, event timestamp... if the value stream timestamp is somehow not appropo). That would give you an ongoing history of events you could query from the value stream (and perhaps purge over time ultimately too).
I then subscribed to data changes on that property and generated whatever property updates and events I want for performing more specific actions on particular types of event names that are received.