Dataset Cannot Be Null Error when window is first opened

Ignition 8.0.5

I get the following error 6 to 10 times when I open a window the first time after launching the Vision project:

Traceback (most recent call last):
File “event:propertyChange”, line 5, in
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Dataset can not be null

Ignition v8.0.5 (b2019101516)
Java: Azul Systems, Inc. 11.0.4

If I move to another window in the project and then come back, the error does not happen. Also, it won’t happen when I run the script in designer. Also it seems to function perfectly except for the errors.

The script is short:

1 event.source.parent.getComponent(‘MES Analysis Controller’).refresh()
2 # Get the dataset from the MES Controller and make a dataset called “data”
3 data = event.source.parent.getComponent(“MES Analysis Controller”).data
5 formattedData = system.dataset.formatDates(data, “H:m”)
6 table = event.source.parent.getComponent(‘table’)
7 = formattedData

I’ve run this in designer by triggering with pushbuttons and printing the datasets to the console, but it’s never null when I do that.

I feel like I’m missing something really obvious here. Does anyone see anything obviously wrong?


First of all, using this in a property change event, you need to filter out the property change you want to act on. Since you are getting the error 6 to 10 times, that is the number of properties that are changing, therefore your script is running once for each property. Narrow it down to the exact case you want then see if your error returns,

if event.propertyName == 'data':
  do script...

dkhayes, thanks for your reply. I totally missed that and that seems to have solved the issue.

Thank you!!!

I spoke too soon…I still get the error.

Is there something different about running the project that would explain why I can’t reproduce this in Designer?

I have no idea about the MES controller or how it works, but I would check permissions on the project. It may have to do with the Legacy Database Access permissions or something related to that. The permissions are under project properties->Client->Permissions

It sounds like your script is running before MES Analysis is populated. You could add if data != None on line 4 and indent lines 5-7 under that so they only run if data is not None.

Why not…

data = event.source.parent.getComponent(“MES Analysis Controller”).data
if event.propertyName == 'data' and data != None:
  do script...

Looks like I was too slow.

Perhaps there’s a better way. The MES Analysis Controller has an afterUpdate extension function that fires once the data has been refreshed. Running a script from that function would seem to be more logical and will more reliably give you non-null data.


Just for the record I would have this script below, so the data isn’t assigned on every single property change event

if event.propertyName == 'data':
  data = event.source.parent.getComponent('MES Analysis Controller').data
  if data:
    do script...

Be careful! None behaves oddly in comparisons. Best to rely on the implicit conversion of objects to True, like so:

if event.propertyName == 'data':
  data = event.source.parent.getComponent("MES Analysis Controller").data
  if data:
    do script...

And watch out for those curly quotes you copied…


Phil, that did the trick!

I still don’t understand why I don’t see the error in Designer, but that fixed it.

Thank you all so much.

Thanks for the insight Phil!