[Bug-802]Passing an object within instances on a Flex Repeater

I am having difficulty passing an object as part of an instance. Is this allowed?

I think the object is passing okay but it seems to be modified by the passing method. Contained with the object is a dataset and when I try to use getValueAt() on it it returns that this is not an attribute. Something about this reminds me of a unicode issue. @PGriffith any insight?

Do you have any screenshots/code samples? I’m having a hard time picturing what you’re doing.

When I went to copy some images to show you I got a hint as to what is going on. The problem is occurring as I am setting up the instances. I use the following abbreviated script to create the instances.

rowData ={"Num":n+1,"Step":procName,"procID":procID,"Edit":False,"recipeDesignData":self.view.custom.recipeData,"recipeData":self.view.params.recipeData}
self.props.instances = data

self.view.custom.recipeData and self.view.params.recipeData are objects and within them are datasets. For some reason the datasets within self.view.params.recipeData are coming over as arrays instead of as datasets.

Which version? This might be a bug fixed in 8.0.17/8.1.0 RC3.


Is there a work around for now?

@PGriffith Datasets seem to break Perspective in surprising ways. See http://forum.inductiveautomation.com/t/browsercore64-gone-wild/32523. Should I stay away from datasets and convert to arrays?

I would say that generally, things in Perspective are going to ‘expect’ arrays and objects directly. We attempt to expand datasets to arrays ‘inline’, in a way that’s transparent to users - but it is an extra translation step that, by being implicit, has a bit of magic to it. I don’t think there’s any reason to prefer datasets over arrays, so I would use arrays all the time.

Actually, I’ll amend the last a bit - if you’re sending hundreds or thousands of rows, datasets are probably going to perform a bit better, because there won’t be as much for the property system to synchronize back and forth - it’s all one ‘atomic’ update.

I really don’t want to convert over to arrays since all my scripts are built around working with datasets. I just need the Flex Repeater to handle it properly which it is not doing currently.

We already have an open ticket to address this and pass DataSets as an encoded value correctly. It’s in development now.

1 Like

This was supposed to be fixed with the 8.1.2 release. Was it? I have not tested it yet since I expect Bug-1083 and this bug may be interrelated.

Correct. Bug #802 dealt specifically with Accordions and Flex Repeaters, whereas bug #1083 was opened as a separate issue to resolve the same issue in Popups. Users should no longer experience incorrect property encoding while using Flex Repeaters or Accordions in 8.1.2 or newer, although users who are encountering this issue in Popups will still encounter the improper encoding until such a point as 1083 is fixed. No ETA on #1083.

Thank you for the clarification. I never had an issue with popups and datasets until I upgraded from 8.0.16 to 8.1.2 Did this bug get introduced by the fix to the Accordions and Flex Repeaters?

The 1083 issue is not marked as a regression issue (which is why it hasn’t been rushed), and there is a note that the problem seems to boil down to supplying datasets from tags where the following results in the issue:

system.perspective.openPopup('A','PopupView', params={'paramName':system.tag.readBlocking(['[default]New Tag'])[0].value})

But this next piece would not (notice the lack of .value for the tag):

system.perspective.openPopup('A','PopupView', params={'paramName':system.tag.readBlocking(['[default]New Tag'])[0]})

Perhaps you were in the second use-case.

Very useful information, let me investigate. Thanks.

Nope. This is not a tag read but rather a property that is a dataset that is being passed.

system.perspective.openPopup('batchData','Dashboards/Popups/BatchData',params = {'ds':self.view.custom.batchDataComment},title='Batch/Step Data')

Please note, I am passing the entire dataset.

But where is batchDataComment being obtained from? If it’s a plain DataSet instead of the QualifiedValue, I would think that would cause it. Again, It’s not immediately clear, and I can only glean so much from the issue as it’s written.

I am buidling the dataset on the fly with this script that reads another dataset:

	pyVal = system.dataset.toPyDataSet(currentValue.value)
	retData = []
	#if there are user comments, append them to the current data
	for row in pyVal:
		if len(row["userComment"]) > 0:
			retData.append(["User Comment",row["userComment"]])
	#return as dataset and reformat		
	dsAppend = system.dataset.toDataSet(["property","value"],retData)
	ds = system.dataset.appendDataset(self.custom.batchData,dsAppend)
	self.custom.batchDataComment = ds