ExportExcel and pyDataSet

I just found out that ExportExcel do not work with pyDataset.

At some point, NamedQueries began to output a pyDataSet instead of a dataset. Since that moment, we need to convert the output of a named query to a simple dataset before calling the ExportExcel function.

I let this here in case it could help someone else.

1 Like

I was under the impression that this was being refactored in v8.3 to make all Datasets implicitly PyDatasets, and vice versa. So may be moot before too long.

What does "does not work" mean, and what's happening?

Since a long time ago, early in the 8.0 lifecycle, PyDataSet was changed to directly implement the Dataset Java interface, so any Java code that expects a Dataset can transparently accept a pydataset.

In 8.3, as Phil mentioned, there is no need to explicitly wrap in PyDataSet - any time you interact with a dataset via scripting, you'll be able to use all of the pydataset methods and all of the underlying dataset methods, with no need to explicitly wrap or unwrap.

Here is what I mean...

A named query retreive a dataset. This dataset can be show correctly in a power table in Vision.

The error occur when I call system.dataset.exportExcel. I get this exception:

java.lang.ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object to the type of the destination array, com.inductiveautomation.ignition.common.Dataset

caused by ArrayStoreException: arraycopy: element type mismatch: can not cast one of the elements of java.lang.Object to the type of the destination array, com.inductiveautomation.ignition.common.Dataset

Ignition v8.1.39 (b2024040909)

This was working good in Ignition 8.1.33.

To solve the issue, I add a line to convert the pyDataset to a simple dataset
ds = system.dataset.toDataSet(ds)

It's working good with this line.

I hope it clarify.,