Ignition dataset tag to python dataset

Hi,
I currently have a memory tag that is a dataset type. I want to convert the dataset within this tag to a python dataset so that I can manipulate the data within a script. I haven’t been able to find any way to do this. I know that I can use the “.toPyDataSet” command but everytime I try this I get this error:

TypeError: toPyDataSet(): 1st arg can’t be coerced to com.inductiveautomation.ignition.common.Dataset

This is occurring after simply trying to pass the tag into the function. Obviously this isn’t right. Any help is appreciated. Thanks.

Could you try posting your code? It’s a little be easier to offer suggestions if we can see what you have thus far.

Based on the error, it sounds like the parameter you’re passing to system.dataset.toPyDataSet isn’t actually the value of the memory tag. Is your code using system.tag.read, and is it referencing the value submember?

memoryDataSet = system.tag.read("myTagPath").value
pyData = system.dataset.toPyDataSet(memoryDataSet)
3 Likes

I’m guessing you’re reading it with system.tag.read()? If so make sure to add .value after, like

pyDS = system.dataset.toPyDataSet(system.tag.read(pathHere).value)

The object returned by system.tag.read is a qualified value, which means it isn’t technically the value you’re looking for yet.

1 Like