[IGN-6488]Unable to write Opt-Dataset to a tag

When the result of a named query is large, it comes back as “Opt-Dataset” and not a “Dataset”.

If I try to take that Opt-Dataset and write it to a memory tag I am told:

TagProviderRpc.write: Argument class not valid.

What if anything is the best way to handle this? convert to a pyDs and then convert back to Ds to force it to be a dataset?

Thanks,

Nick

This does allow the return to be written to a dataset memory tag:

ds = system.db.runNamedQuery(query, params)
pyDs = system.dataset.toPyDataSet(ds)
ds = system.dataset.toDataSet(pyDs)

Nick

The intermediate pydataset step probably isn’t necessary. You could force it into a basic dataset with an import:

from com.inductiveautomation.ignition.common import BasicDataset
ds = BasicDataset(system.db.runNamedQuery(query, params))

That said, you should also be able to pass any dataset into a first party scripting function no problem.
Which particular write function were you using? Also, what’s the Ignition version?

I tried with both of the following:

system.tag.write
system.tag.writeBlocking

The gateway I’m working on is Ignition 8.1.19.

Thanks,

Nick

1 Like

Yeah, I see the problem. I’ve filed an internal ticket; I consider this a bug, but it’ll probably be fairly low priority since it’s easy to work around.

Yeah, not a major issue just the first time I had seen it so wanted to post it.

Thanks for putting the ticket in.

Nick