previousValue from change Scripts Issue

so I am trying to pull the previous value from a change script but I unable to use the methods or properties associated with QualifiedValues datatype I can see if I:
prevV = previousValue system.perspective.print(prevV)
it returns QV[[Lcom.inductiveautomation.ignition.common.model.values.QualifiedValue;@5db0174b, Good, Thu Oct 24 12:49:52 EDT 2024]

But if i try to reference or use any of the qualified values methods it gives me this
AttributeError("'NoneType' object has no attribute 'getValue'",)

This is the code that throws the error
prevV = previousValue.getValue() system.perspective.print(prevV)

any ideas on why this would be happening?

Are you checking the initialChange flag? There's no previous value at all when that flag is true.

Are these available when you are doing a change script on a component?
I have a change script on an array of objects, sorry should have clarified earlier

I know they are available on tag changes, but I cannot see/find where you pass the flag for component property change scripts.

Interesting. I hadn't noticed that there's no initialChange flag. But previousValue being null on first change makes sense. You should check for that:

	if previousValue is None:
		# handle first update
	else:
		# handle change

Okay that makes sense, I have a property that is binded to a sql query and data being pulled is default data in my databse so it should never be null.

After testing aswell your theory was correct, on the first change i get the error but the second change it returns the data.

should I have this configured differently for my use case?

You haven't explained your use-case, so I don't know.

oh sorry, so I have a tables components that renders data depending what on what data is being passed, I also want the option for the user to change the data via change script. So I use an embedded view and referenced my table component. The data param for the embedded view I bind to an sql query(this is also where the change script is)

so the data will theoretically never be null initially

I would make the property non-persistent so it always does start with a null.

Okay I will try that, thank you for the suggestion