Client tag value not coming through in Dataset when asked for specifically in script?

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
image

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 -
image

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?

I added some print statements inside my createWriteData function right after I copy the ReadData using WriteData = BasicDataset(ReadData), I refreshed the custom property dataset, tried my save button again and this time I see

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 19
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
in making write data function
userId value for row 0 inside function is 19
userId value for row 1 inside function is None
userId value for row 2 inside function is None
userId value for row 3 inside function is 19
userId value for row 4 inside function is None
userId value for row 5 inside function is None
userId value for row 6 inside function is None
userId value for row 7 inside function 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 19
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 19
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

So this time only two rows have it somehow and the rest somehow don’t . I don’t understand how this could be. Perhaps a bug in this version putting client tags as part of the SELECT query, or getting those values back out? For what its worth {[Client]User/id} is of type int4.

I started testing this in the client and all rows would have a 19, I saved my window and reopened it, and now in designer too, it seems like every row does have the userId. No idea why the prior inconsistency, but now it seems to be working right.