[IGN-14447]Export Excel from Power table

Before migrate to version 8.3 I was exporting the power table data with no issues

After migration it doesn’t work

I am using this code

Now I get this error


Traceback (most recent call last):
File "event:actionPerformed", line 8, in
java.lang.ArrayStoreException: 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.3.2 (b2025120210)
Java: Azul Systems, Inc. 17.0.16


Help welcome.

thanks

This is a (minor) bug caused by the automatic wrapping of datasets as "PyDatasets", which makes them act as sequences and fall down a different code path in functions such as exportExcel that accept both single elements and lists.

The fix is extremely simple; change:
system.dataset.exportExcel(fName, 1, tablet1)
to:
system.dataset.exportExcel(fName, 1, [tablet1])

To explicitly pass a list of datasets into the function.

We're planning to address this and related issues (e.g. with toExcel) in an upcoming 8.3 release, but it's not the highest priority since the workaround is so easy.


That aside, I'll make an obligatory mention that you should avoid Python/Jython's stdlib datetime and prefer to use functions from the system.date package, for your sake down the road for maintenance. It's not a big deal for simple string formatting operations as you have here, but for any complicated date math you want to avoid datetime.

EDIT:
There's the original, knew this felt familiar:

6 Likes

that works, thank you.

2 Likes