Hello,
I need help to read fields of a dataset tag (for example the component at row 3 and coloumn 7) using function like system.tag.read, to write them into other appropriate single tags.
Many thanks
Claudio
Hello,
I need help to read fields of a dataset tag (for example the component at row 3 and coloumn 7) using function like system.tag.read, to write them into other appropriate single tags.
Many thanks
Claudio
To use a dataset tag field value you will have to read and convert to a pydataset.
val = system.dataset.toPyDataSet(system.tag.read('PathToDataSetTag').value)
print val[3][7]
print val[2][7]
print val[1][7]
I prefer pyDatasets as well, but remember you can access the data directly in a ‘normal’ dataset:
data = system.tag.read('Dataset tag').value
print data.getValueAt(3, 7)
I hardly ever use toPyDataSet(). The getValueAt() method is easy to use in list comprehensions, and it’s basically what happens under the hood if you do convert.
I primarily use it when looping over all the elements of a dataset in a for value in values
construct - it feels much neater
I have just gotten so used to looping datasets that I prefer the pyDataSet format.
Convert it once and then access or loop.
thank you
I have used your suggestion …
thank you all, I have solved using your precious suggestions.
Many thanks
Claudio
11 posts were split to a new topic: PyDataset Performance Questions