Question
UnitedHealthcare
US
Last activity: 6 Nov 2018 20:02 EST
LookupTable events
.NET DataTables have events when a row is added, changed, or deleted. Is there any way to get similar events from LookupTables? It seems no events are exposed by LookupTables in Robotics Studio.
-
Like (0)
-
Share this page Facebook Twitter LinkedIn Email Copying... Copied!
Accepted Solution
Pegasystems Inc.
US
You are correct in that the component does not raise these events out-of-the-box. You could however modify the component to do this by creating a type extension (available in versions of 8.0 after 1053 I believe). You would right-click on a LookupTable in the Object Explorer window and select "Create type extension". This would allow you to extend the component to do what you need. I have not tried implementing any events using this method, however I do believe it to be possible. This would require knowledge of C# as this is designed for developers.
UnitedHealthcare
US
Thank you. That sounds like it will work. Is there any documentation or any examples for creating type extensions?
Pegasystems Inc.
US
Not that I could easily locate. I would use TypeExtensions for most things instead of component extensions. Types are more portable whereas as Component extension only applies to that specific instance of that component. For example; when you modify the LookupTable, all of your LookupTables in that project would now have these events versus just the one.
UnitedHealthcare
US
I've used Type Extensions now to add methods to the StringUtils and FileUtils components. I was also able to create new events in LookupTables. However, I can't seem to override or access any of the objects existing methods and properties. For example, I don't see a way to get all of the columns defined in an instance of a LookupTable. I had to create a new method for adding columns and reading columns. At that point, I realized I was redeveloping LookupTables from scratch and might as well create a new component.
Is there a way to access the properties of an objects instance with Type Extensions?
UnitedHealthcare
US
I found the answer in case anyone else is wondering. You can cast the component to the desired type. For LookupTables the code would be:
using OpenSpan.Controls;
LookupTable luTable = (LookupTable)this.Component;
UnitedHealthcare
US
I was able to capture the row added event from LookupTable's. I attached the code. The only way I could get it to work is by creating a new method to "register" the event first. I couldn't get the event handler to work in the extension constructor.
Pegasystems Inc.
US
Nice work Jarrett. How are you using this? Just curious about the use case.
UnitedHealthcare
US
Thanks, Jeff! If setting the RecordAdded event to async works without issue (I haven't gotten that far yet), we're going to use it to trigger events between projects. We tried using activities, but they aren't working well for us since they're queued. We often want to trigger multiple events with structured data at once or close together. Activities give us structure, but we have to wait for each activity to finish before the next one can start.
Pegasystems Inc.
US
I use the Global Dictionary for this. Each item in the Global Dictionary will raise an event when it is changed and that event doesn't queue.