# Property change script Error

**URL:** <https://forum.inductiveautomation.com/t/property-change-script-error/90634>\
**Category:** Ignition\
**Tags:** scripting, ignition81, perspective\
**Created:** [May 20, 2024, 7:13pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634 "2024-05-20T19:13:34Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 20, 2024, 7:13pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/1 "2024-05-20T19:13:34Z")

</div>

Hi everyone,  
I am making a table with a custom property change script that runs a query on a trigger. It works, but everytime it fires I get an error popping up.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/ded1bd759d709ec58a3a1b3c8d0826d6ec6ee1a3.png)

```python
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if previousValue.value != currentValue.value:
		TableData = system.db.runNamedQuery(self.view.params.NamedQueryName)
		self.getSibling("Table").props.data = TableData

```

Error:

Traceback (most recent call last): File "", line 2, in valueChanged AttributeError: 'NoneType' object has no attribute 'value'

Any ideas? the script works, it just gives this error..

---

<div class="post-metadata">

**Author:** ![bschroeder](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bschroeder/32/13260_2.png) [@bschroeder](https://forum.inductiveautomation.com/u/bschroeder)\
**Post date:** [May 20, 2024, 7:18pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/2 "2024-05-20T19:18:29Z")

</div>

The first time it runs, previousValue will be null. So try:

```python
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
	if previousValue and (previousValue.value != currentValue.value):
		TableData = system.db.runNamedQuery(self.view.params.NamedQueryName)
		self.getSibling("Table").props.data = TableData

```

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 21, 2024, 8:37pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/4 "2024-05-21T20:37:20Z")

</div>

> [@Kevin\_Flener](#):
>
> I believe

No, they are objects. `QualifiedValue` objects, to be specific.

> **[Perspective Property Change Scripts | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/perspective/scripting-in-perspective/perspective-property-change-scripts#property-change-arguments)**
>
> With Perspective, individual component properties can have a property change script. When a change script is set up on a property, it will run when the property changes its value. Multiple different properties on the same component can each have...

---

<div class="post-metadata">

**Author:** ![Ryan\_Deardorff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ryan_deardorff/32/63815_2.png) [@Ryan\_Deardorff](https://forum.inductiveautomation.com/u/Ryan_Deardorff)\
**Post date:** [May 21, 2024, 10:57pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/6 "2024-05-21T22:57:55Z")

</div>

.value does work, as the parameters are still QualifiedValue objects, and yes, fetching the value is necessary if that's what you need to reference, just as .quality is what you'd reference if the quality of the value is what you're after.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 22, 2024, 12:36am UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/7 "2024-05-22T00:36:21Z")

</div>

> [@Kevin\_Flener](#):
>
> I don't think the ".value" portion of the script works

Did you even read the documentation I linked? Within three paragraphs of the anchor I pointed at is the contradiction to your repeated wrong statements.

> [@Kevin\_Flener](#):
>
> I'm very early in my learning process.

No excuse for _repeating_ mistakes pointed out to you. And all the more reason to read relevant material put in front of you.

> [@Kevin\_Flener](#):
>
> I assumed it was a parameter.

What makes you think python function arguments have to be simple values and cannot be objects?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [May 22, 2024, 1:28pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/9 "2024-05-22T13:28:35Z")

</div>

> [@Kevin\_Flener](#):
>
> No need to be so hostile and aggressive.

You pretty aggressively reposted incorrect technical information **after being corrected** once. My comment was tailored to ensure any new visitor to this topic would be motivated to also read the linked documentation instead of taking your word for fact.

The recipient of any rebuke often thinks it is hostile or aggressive. The rebuke was necessary (IMO) considering the impact on lurkers and future visitors.

> [@Kevin\_Flener](#):
>
> Again, mistake on my part.

Thank you for recognizing this, now. Would you have gone back to figure it out without my rebuke? (Rhetorical question. No need to reply here, and I'm done with this topic.)

---

<div class="post-metadata">

**Author:** ![Kevin\_Flener](https://avatars.discourse-cdn.com/v4/letter/k/74df32/32.png) [@Kevin\_Flener](https://forum.inductiveautomation.com/u/Kevin_Flener)\
**Post date:** [May 22, 2024, 3:11pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/10 "2024-05-22T15:11:26Z")

</div>

@Ryan_Deardorff Sorry my comments led us off scope.

Did @bschroeder 's response work to remove the error you're seeing?

---

<div class="post-metadata">

**Author:** ![Luke\_Smith1](https://avatars.discourse-cdn.com/v4/letter/l/c89c15/32.png) [@Luke\_Smith1](https://forum.inductiveautomation.com/u/Luke_Smith1)\
**Post date:** [May 24, 2024, 1:16pm UTC](https://forum.inductiveautomation.com/t/property-change-script-error/90634/11 "2024-05-24T13:16:42Z")

</div>

@bschroeder was right! Sorry I didn't mark it as a solution before mom and dad started fighting. Thanks for the help everyone!
