Perspective Property Change Script Broken in Ignition 8.1.47

I've noticed that a perspective property change script that used to work in Ignition 8.1.45 is no longer working in release 8.1.47.

The issue can be replicated by creating a brand new project.

Main View

Single button that has an onActionPerformed event to open a popup

Popup View

Single toggle with it's enabled property binding to tag myBoolean, and the following change script:

def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if previousValue is not None and previousValue.value and not currentValue.value:
		system.perspective.closePopup("popup0")

The result is that the popup always closes immediately when clicking the button, due to the property change script firing inside the popup, even though the toggle enabled value has not changed from true to false. On Ignition version 8.1.45 this did NOT occur.

I note that if I move the tag binding and property change script to the toggle selected property (rather than the enabled property), the popup does not always close.

I suspect this is related to the following change in the Ignition 8.1.47 release notes - but it's not clear to me if the change in behaviour I am experiencing is deliberate, or how to change my script appropriately.

Perspective - Fixed an issue where the previousValue in a Property Change Script would evaluate to None instead of the actual previous value.

Hello, It seems your script is missing something. Like you are not comparing correctly. Here is something very similar that works for me when I look at the change of a Bool from 0 to 1. The action falls below the last if and is indented.
image

@woodsb02 is using booleans in comparisons correctly, and more efficiently than your alternative.

If you are using equals or not equals with a boolean value, instead of using the boolean directly, or directly with not, you are making your code more fragile and less performant.

Learn something new every day. I will have to give that a try. Some of these are from a 7.9 Version that we have carried over to 8.1.44. Thanks for the heads up @pturmel

My general statement is true for all versions of Ignition and all versions of jython and python.

You might also want to group all your conditions together, if there's no alternative path.
3 levels of conditions seems excessive.

For anyone experiencing this issue - Inductive Automation support have confirmed this relates to the change I referenced in the 8.1.47 release.

Due to this change, the variables in my script are evaluating as follows when the Perspective view first opens (before the bindings have first read from their tags):

  • previousValue is not None is True
  • previousValue.value is True with a quality of Good_Unspecified
  • currentValue.value is False with a quality of Good

A workaround is to set the property as persistent - which ensures the property is initialised to the value configured in Designer when the view was saved. I believe this sets the previousValue.value to the persisted value saved in Designer.

I still believe this is not the desired/expected behaviour when persistent isn't selected - hence why I referred to the above as a workaround rather than a fix.