Hi Dojo,
I am currently working on a connector where a user can specify elements in a table, then when found it will subscribe to it and update an "Element State" column to determine if the element is active/stopped/paused/deleted etc.
So the flow is user sets element, check if exists, add subscription, and on element state message it updates the table.
Problem is, I don't think I'm receiving the message -columns not receiving update.
I have the following handler:
Called from here:
Is there a better way to do this?
Bonus question: Logs don't work on the handler - this is because the SLProtocol object is not initialized at that point, right?
Hi Alex,
From your screenshots, I believe you are subscribing to the current element alone and not to a "secondary" element that appears to be your goal.
protocol.DataMinerId and protocol.ElementId will return the current element's details however I believe that from your description you should be using details from the row object.
Regarding your bonus question, you should think about that method (and any event handler) as a static method running elsewhere that needs to be as efficient as possible.
Prior to the DMS Monitors that Tom suggested, what we used to do was to do a SetParameter via SLNet with the event data, in your case, element details and state, to a parameter that would trigger a QAction and at that point, you would have access to the SLProtocol object and anything you could need.
But with the DMS Monitors library, all of that is taken care of for you and you will have a smoother experience.
The library also has an extra step that you would otherwise need to handle yourself that is managing the subscription set and cleaning up when your own element stops or gets deleted.
Hi Alex,
I don't immediately see a mistake in your code. But maybe you could try using DMS monitors instead of setting up the subscriptions yourself. With that library it should be easier to setup receiving events when something changes.
https://docs.dataminer.services/develop/devguide/ClassLibrary/ClassLibraryMonitors.html