What is the type of the tag represented by datasetPath
?
Adapt your code a bit if you’re not sure:
dataTag = system.tag.readBlocking([datasetPath])[0].value
print type(dataTag)
dataIn = system.dataset.toPyDataSet(dataTag)
What is the type of the tag represented by datasetPath
?
Adapt your code a bit if you’re not sure:
dataTag = system.tag.readBlocking([datasetPath])[0].value
print type(dataTag)
dataIn = system.dataset.toPyDataSet(dataTag)
It is a memory tag. Is that what you mean? (Sorry, I cannot get print outputs to show up in my console for some reason.)
No, I mean what Data Type is the tag.
I’m assuming it is a dataset since that is the way your attempting to use it.
I ran a quick test to get the class and it should be com.inductiveautomation.ignition.common.BasicDataset
I believe that BasicDataset
should have all of the functions you’re trying to use, so just nix the conversion.
datasetPath = event.source.parent.TagPath
# Read the dataset tag.
dataIn = system.tag.readBlocking([datasetPath])[0].value
#Get column names..
headers = dataIn.getColumnNames()
# Get tag paths as a list
tagList = dataIn.getColumnAsList(headers.index("InterlockedTag"))
Except for the iterations used later. There really was a reason.
Thank you everyone for all the help!!! I got it working after changing some of the tag path stuff.
#datasetPath = system.tag.write(Root_Container/TagPath/Interlock)
datasetPath = '[default]' + event.source.parent.TagPath + '/Interlock'
#system.gui.messageBox(datasetPath)
# Read the dataset tag. Convert to PyDataSet for easier iteration.
dataIn = system.dataset.toPyDataSet(system.tag.readBlocking([datasetPath])[0].value)
#Get column names. Coerce it to a list to use the same names in the new dataset.
headers = list(dataIn.getColumnNames())
# Get tag paths as a list
tagList = dataIn.getColumnAsList(headers.index('InterlockedTag'))