Property change script Error

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.

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..

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

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
1 Like

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

2 Likes

.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.

1 Like

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.

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

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

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.

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.)

@Ryan_Deardorff Sorry my comments led us off scope.

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

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

3 Likes