I am working on some perspective views with some production data charts (using the free Embr Charts module) which get populated with data from a SQL database. To get this to work, I added a custom property with a query binding which returns a dataset and script transform to interpret and format the data for the charts. Since some of the charts are used on multiple views, I defined functions in gateway scripts which interpret and format the data, which are called by transforms on property bindings.
Iâm having an issue on a couple of my charts where it seems like the transform script is running before the query is complete. At first I was thinking this was an issue with the pie chart from Embr Charts, but after adding some logging I think that isnât the issue. I added some logging via system.perspective.sendMessage so that I can see what is happening from the client (behavior is different/harder to reproduce in designer). I am writing to the log when navigation changes to a different view. I also added a property change script on the property with the query binding and transform which logs currentValue.getQuality(). A section of this log is at the bottom of this post. What I am seeing is that when I navigate to the display titled âDefectsâ (which is having this issue) about 90% of the time, the property change script will run twice. The first time it will say that the quality is bad because 'NoneType' object has no attribute 'getRowCount'. One of the first things that is done in the function called by the transform script is getting the row count from the dataset that the query returns, so it seems like this is running before getting the data from the query. After about 290ms the property change script runs again and logs the quality as good. When this happens, the chart shows a warning icon with the text âComponent Errorâ (tooltip says Cannot read properties of null (reading âlengthâ). The other 10% of the time the property change script only shows up in the log a single time with âGoodâ quality and the chart displays properly.
I tried removing the transform so that the property binding is only running the query. Then I creating a second custom property with an expression structure binding (with âWait On Allâ enabled) pointing to the first property and calling the transform script. I thought this might do essentially the same thing but force the second binding to wait for the dataset to be populated, but it did exactly the same thing.
Am I doing something incorrectly? Is the problem that Iâm calling a function defined in the gateway scripts from a property binding?
01/21 08:25:40.743: Defect chart data quality: Good
01/21 08:25:40.670: Next view: Defects
01/21 08:25:39.077: Next view: Time
01/21 08:25:37.812: Defect chart data quality: Good
01/21 08:25:37.524: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:37.492: Next view: Defects
01/21 08:25:36.058: Next view: Time
01/21 08:25:35.014: Defect chart data quality: Good
01/21 08:25:34.721: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:34.693: Next view: Defects
01/21 08:25:33.243: Next view: Time
01/21 08:25:31.651: Defect chart data quality: Good
01/21 08:25:31.351: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:31.315: Next view: Defects
01/21 08:25:29.531: Next view: Time
01/21 08:25:28.297: Defect chart data quality: Good
01/21 08:25:28.008: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:27.982: Next view: Defects
01/21 08:25:26.034: Next view: Time
01/21 08:25:24.327: Defect chart data quality: Good
01/21 08:25:24.027: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:23.972: Next view: Defects
01/21 08:25:21.744: Next view: Time
01/21 08:25:18.579: Defect chart data quality: Good
01/21 08:25:18.290: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:18.252: Next view: Defects
01/21 08:25:16.355: Next view: Time
01/21 08:25:14.944: Defect chart data quality: Good
01/21 08:25:14.654: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:14.614: Next view: Defects
01/21 08:25:12.910: Next view: Time
01/21 08:25:10.812: Next view: PPM
01/21 08:25:09.069: Next view: Time
01/21 08:25:05.498: Defect chart data quality: Good
01/21 08:25:05.206: Defect chart data quality: Error_ScriptEval("Traceback (most recent call last):
File "<transform>", line 2, in transform
File "<module:BinData>", line 740, in unitDefectsChartsCombined
File "<module:BinData>", line 848, in PieChart_Unit_Defects
AttributeError: 'NoneType' object has no attribute 'getRowCount'
")
01/21 08:25:05.179: Next view: Defects
01/21 08:25:04.246: Next view: Time
01/21 08:25:03.134: Next view: PPM
01/21 08:25:00.487: Next view: Time
01/21 08:24:54.733: Defect chart data quality: Good
01/21 08:24:54.680: Next view: Defects
01/21 08:24:52.494: Next view: Time

