Using Ignition 7.9.9 and SQL Server 2016.
I have a non-polling custom dataset property defined by a SQL Binding as follows -
DECLARE @AnalysisTestNumbers tyAnalysisTestNumbers_H;
INSERT INTO @AnalysisTestNumbers SELECT * FROM {[Client]Schema}.{Root Container.SomeProduct.Table};
SELECT *, Product = {Root Container.SomeProduct.Product},
{[Client]User/id} as [userId], 0 as [userId_changed]
FROM [dbo].[fnGetAnalysisNumbers] (@AnalysisTestNumbers)
WHERE [ID] > 0
Order By [ID];
Looking at the dataset manually in Designer I see what I expect - the current value of the client tag userId
Now, when a save button is pressed I noticed that many times userId was becoming None for some reason and I couldn’t tell why. But it appears as None even if I check it immediately before doing any operations -
if event.source.componentEnabled:
componentName = event.source.parent.name
TableToUpdate = system.tag.read('[Client]Schema').value + '.[' + event.source.parent.Table + ']'
ReadData = event.source.parent.ReadData
print "Before doing anything"
# Check - did I accidentally delete userID?
for i in range(ReadData.rowCount):
print "userId for Read row %i is %s"%(i, str(ReadData.getValueAt(i, 'userId')))
WriteData = app.SQL_Ops.createWriteData(event.source.parent.parent.getComponent(componentName), event.source.parent.ReadData)
print "created write data, checking userId again"
for i in range(ReadData.rowCount):
print "userId for Read row %i is %s"%(i, str(ReadData.getValueAt(i, 'userId')))
for i in range(WriteData.rowCount):
print "userId for Write row %i is %s"%(i, str(ReadData.getValueAt(i, 'userId')))
event.source.WriteData = WriteData
This prints out the following which confuses me even more - only one row has the userId -
Before creating write data
userId for Read row 0 is 19
userId for Read row 1 is None
userId for Read row 2 is None
userId for Read row 3 is None
userId for Read row 4 is None
userId for Read row 5 is None
userId for Read row 6 is None
userId for Read row 7 is None
created write data
userId for Read row 0 is 19
userId for Read row 1 is None
userId for Read row 2 is None
userId for Read row 3 is None
userId for Read row 4 is None
userId for Read row 5 is None
userId for Read row 6 is None
userId for Read row 7 is None
userId for Write row 0 is 19
userId for Write row 1 is None
userId for Write row 2 is None
userId for Write row 3 is None
userId for Write row 4 is None
userId for Write row 5 is None
userId for Write row 6 is None
userId for Write row 7 is None
both pre doing anything to ReadData and after (I don’t manipulate ReadData at all in my function, only make a copy of it to create WriteData, which is then modified based on things on the screen).
I assign the WriteData I make back to my custom property to look at it and I see the following -
So it IS there in my writeData, but for some reason, getValueAt(row, ‘userId’), many times, will produce a None
for me, but sometimes it does not like in this instance the first row had the correct value. This seems to be inconsistant for me as well - sometimes its only the third row, etc.
Any idea how this could be and how to fix it?