I'm currently on an Ignition 8 Nightly from a few days ago.
I was just about to submit a question about this when it struck me what the issue could be, and I've confirmed it. So a question becomes a bug report!
My setup is like such:
categoryNames
is set directly with a Script Transform which creates an array of strings that are the days of the week.categoryValues
is copied directly as a Property Binding fromcategoryNames
generatedColumns
is another property that is bound to atemplateColumn
property and has a script transform, but takes incategoryValues
within the script transform to use it. It's used as follows:
xAxisValues = self.custom.alarmFrequencyHeatmap.xAxis.categoryValues
for idx, xval in enumerate(xAxisValues):
# Do stuff with idx, xval...
What happens is the whole setup works perfectly within the Designer, but when I go to view it in the browser, I get the following error:
Traceback (most recent call last): File "<transform>", line 15, in transform TypeError: 'NoneType' object is not iterable
However, I narrowed this down to a timing issue where it seems that all the intermediate properties are not being executed before categoryValues
is used in the final generatedColumns
script, so the following will fix it:
sleep(0.01)
xAxisValues = self.custom.alarmFrequencyHeatmap.xAxis.categoryValues
A 10ms delay fixes it. I currently have it set to 20ms, but anything less than 10ms appears to not be enough.
Just figured I'd put this in as a bug. I could just be using things wrong and it's my fault that this is happening, but I figured I'd post about it regardless.
Edit: Of course, I've realized there's a more elegant solution to just use a while
loop to wait for the property to be generated.
while(self.custom.alarmFrequencyHeatmap.xAxis.categoryValues is None):
pass # Wait
xAxisValues = self.custom.alarmFrequencyHeatmap.xAxis.categoryValues
Hopefully this comes in handy for anyone else who has the same issue!