# Easy Chart Saving to Multiple Datasets

**URL:** <https://forum.inductiveautomation.com/t/easy-chart-saving-to-multiple-datasets/19987>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [October 5, 2018, 3:53am UTC](https://forum.inductiveautomation.com/t/easy-chart-saving-to-multiple-datasets/19987 "2018-10-05T03:53:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![0sm0](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/0sm0/32/15228_2.png) [@0sm0](https://forum.inductiveautomation.com/u/0sm0)\
**Post date:** [October 5, 2018, 3:53am UTC](https://forum.inductiveautomation.com/t/easy-chart-saving-to-multiple-datasets/19987/1 "2018-10-05T03:53:19Z")

</div>

Hi Guys,

Using V7.9.9  
Easy Chart with DB pens  
using either built in Save button or exportDatasets() yields same results.

Not sure if its just something I am doing but I have found that when saving Datasets to Excel from an Easy Chart it will normally add all pens in a sub plot in a single dataset. perfect…

However if I add a Where Clause to a pen it creates a separate dataset for that pen. Giving you multiple sheets in the excel workbook. Not so perfect…

If anyone may have a work around… much appreciated. 🙂

Cheers

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [October 5, 2018, 12:30pm UTC](https://forum.inductiveautomation.com/t/easy-chart-saving-to-multiple-datasets/19987/2 "2018-10-05T12:30:57Z")

</div>

Unfortunately, pens can only be consolidated into a single query if the datasource, table, timestamp column, and where clause are identical. Each separate query yields a separate result dataset. The chart doesn’t modify any of the datasets it gets, it just draws each pen out of whatever dataset it has.

You could dig under the hood and extract all of the data and script your own join across all datasets to yield a new one. You’ll have to deal with the fact that timestamps may not match up perfectly across all queries, requiring either intimate knowledge of the process to reasonably compute appropriate t\_stamps, or insert all timestamps, leaving nulls in the dataset. Not a trivial task.

---

<div class="post-metadata">

**Author:** ![0sm0](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/0sm0/32/15228_2.png) [@0sm0](https://forum.inductiveautomation.com/u/0sm0)\
**Post date:** [October 8, 2018, 1:21am UTC](https://forum.inductiveautomation.com/t/easy-chart-saving-to-multiple-datasets/19987/3 "2018-10-08T01:21:43Z")

</div>

Thanks Phil

Makes perfect sense. 👍

Cheers
