onPropertyChange script help - get root container

Hello,

I feel like this should be a relatively straightforward issue, but I am having a lot of trouble finding the correct way to do this.

I am trying to make an existing window a bit more dynamic. For a bit of context, this window is used for calculating percent of the time that we have run above specific speeds. Right now, those speeds are stored in a dataset as a custom property of the root container (1x3 dataset, "Ranges"). These speeds also appear visually on the interface as labels. I want to change these to numeric inputs, so that a user can edit them, the "Ranges" property is updated, and when the "compute" button is hit, everything references the user-input speeds instead of the current default ranges.

Two problems arise: Actually access the root container custom property within the event handler script, and edit a single value of the dataset.

I started with the first problem, and I feel silly, since I can't seem to find how to do this. I started with event.source.parent.ranges, since I thought that the "parent" of this component was the root container. But this doesn't seem to work. I also tried event.source.getRootContainer().ranges, but I don't think I'm using getRootContainer() properly. Browsing forums and documentation hasn't given the answer yet, and I feel I'm missing something obvious.

Any help would be greatly appreciated.

Once I figure out how to correctly reference the custom property, my next step is modifying one specific cell of the dataset - any reference to the appropriate documentation would also be quite helpful.

Thanks in advance!

1 Like

For problem 1:

I would recommend using the property selector in your change scripts -

Now just pick what you need and it will make the path for you -

1 Like

Ah, I totally forgot that was a thing! I have been doing other things than ignition lately, and that slipped my mind.

I also was able to solve the other issue by building the dataset in python using system.dataset.toDataSet and inputting the appropriate values.

Thanks!

3 Likes