Extending the Dataset class?

Hi. I was wondering if it is possible to extend the Dataset class just to add some methods I’d like to use throughout my application. It looks like the datatype of a table’s Data property is actually a BasicDataset, which I am assuming is an extended version of Dataset.

I’ve tried extending the class myself, and saving my extended BasicDataset (let’s call it CustomDataSet) to the table’s .data property but ran into serialization errors when saving. I figured that was a good point in time to stop screwing around and ask here instead.


No, you’re not going to be able to do this.

Your best bet is to add those methods you want to use to a global scripting module and access them that way.

It’s not possible with jython, but it is possible with the module SDK. Specifically, if your module jar supplies an implementation of Dataset that is also serializable, you’ll be able to assign it to components and all will be well. The challenge is that every point in Ignition that supplies a dataset is going to deliver a BasicDataset, not your CustomDataset. So every access where you might want to use the extra methods needs to check if they’re available, conditionally rewrap the dataset in your custom version, then proceed.

I’m doing something similar in a private module (custom Dataset implementation), and serialization works just fine. The key in my usecase is that the client is getting these custom datasets via RPC from the gateway, where my module is wrapping the database queries itself. (I’m not actually trying to expose new dataset functionality to jython scripting – it’s an implementation side effect.)