# Create a complex dataset for building child tables in a report table via python

**URL:** <https://forum.inductiveautomation.com/t/create-a-complex-dataset-for-building-child-tables-in-a-report-table-via-python/75716>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [June 29, 2023, 3:00pm UTC](https://forum.inductiveautomation.com/t/create-a-complex-dataset-for-building-child-tables-in-a-report-table-via-python/75716 "2023-06-29T15:00:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cdunn.home](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@cdunn.home](https://forum.inductiveautomation.com/u/cdunn.home)\
**Post date:** [June 29, 2023, 3:00pm UTC](https://forum.inductiveautomation.com/t/create-a-complex-dataset-for-building-child-tables-in-a-report-table-via-python/75716/1 "2023-06-29T15:00:12Z")

</div>

I am working on a report for shutdown cause identification. The underlying code works and I can determine the cause of the shutdown based on a few values in tag historian and alarms in the journal. The problem is that I want to use child tables [[Table Grouping - Child Table Video at Inductive University](https://inductiveuniversity.com/videos/table-grouping-child-table/7.9)] ([Table Grouping - Child Table Video at Inductive University](https://inductiveuniversity.com/videos/table-grouping-child-table/7.9)) in the report to display all alarms occuring within +3/-1 seconds of a shutdown, but I cannot seem to get the child tables functional.

The documentation ([Table Groups - Ignition User Manual 8.1 - Ignition Documentation](https://docs.inductiveautomation.com/display/DOC81/Table+Groups#TableGroups-ChildTables)) says:

> Creating child tables requires having a complex dataset. Go to the [Nested Queries](https://docs.inductiveautomation.com/display/DOC81/Nested+Queries) page and complete the Equipment Downtime example at the bottom if you want to use the same datasets for this example.

My data is spread between the tag historian and the alarm journal, and so requires a bit of formatting, which requires scripting, but I cannot seem to create a complex dataset through scripting. I can create a dataset with a column of datasets, but that isn't treated as a 'complex dataset' in the report designer's key browser. The dataset column is just not treated as a dataset.

If anyone knows how to do this, I would appreciate knowing, too! 🙂

- Ignition 8.1.26

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [June 29, 2023, 3:22pm UTC](https://forum.inductiveautomation.com/t/create-a-complex-dataset-for-building-child-tables-in-a-report-table-via-python/75716/2 "2023-06-29T15:22:37Z")

</div>

You should find this thread interesting. Essentially use the DatasetBuilder class to construct your dataset.

> [@Report with Scripted Nested Data](https://forum.inductiveautomation.com/t/report-with-scripted-nested-data/11801/21):
>
> Not sure what’s going wrong. Consider using The [DatasetBuilder](http://files.inductiveautomation.com/sdk/javadoc/ignition80/8.0.10/com/inductiveautomation/ignition/common/util/DatasetBuilder.html) class to construct your datasets with explicit data types. system.dataset.toDataSet implicitly sets types with the first row.

---

<div class="post-metadata">

**Author:** ![cdunn.home](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@cdunn.home](https://forum.inductiveautomation.com/u/cdunn.home)\
**Post date:** [June 29, 2023, 3:34pm UTC](https://forum.inductiveautomation.com/t/create-a-complex-dataset-for-building-child-tables-in-a-report-table-via-python/75716/3 "2023-06-29T15:34:33Z")

</div>

I don't know how I didn't find that when I was searching!? LOL!

I'm going to try it...

---

<div class="post-metadata">

**Author:** ![cdunn.home](https://avatars.discourse-cdn.com/v4/letter/c/45deac/32.png) [@cdunn.home](https://forum.inductiveautomation.com/u/cdunn.home)\
**Post date:** [June 29, 2023, 4:05pm UTC](https://forum.inductiveautomation.com/t/create-a-complex-dataset-for-building-child-tables-in-a-report-table-via-python/75716/4 "2023-06-29T16:05:00Z")

</div>

Worked perfectly! Thank you!

And special thanks to @pturmel for the original code!
