# How to convert QueryResults to Dataset?

**URL:** <https://forum.inductiveautomation.com/t/how-to-convert-queryresults-to-dataset/35774>\
**Category:** Ignition\
**Created:** [June 17, 2020, 8:01pm UTC](https://forum.inductiveautomation.com/t/how-to-convert-queryresults-to-dataset/35774 "2020-06-17T20:01:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [June 17, 2020, 8:01pm UTC](https://forum.inductiveautomation.com/t/how-to-convert-queryresults-to-dataset/35774/1 "2020-06-17T20:01:07Z")

</div>

I have a need to convert a reports Tag Historian Query results to a dataset. Could anyone tell me how to achieve this?

Here’s a mockup of the report data source:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/7/73a60e0d9eb134655dfbafc5a020c5aa28ae243c.png)

I want to use the data from the 1st data source in the Script without having to re-query the database.  
When I log the type of the the results from the Tag Historian Query I get type _com.inductiveautomation.reporting.common.api.QueryResults_

Thanks

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 17, 2020, 8:09pm UTC](https://forum.inductiveautomation.com/t/how-to-convert-queryresults-to-dataset/35774/2 "2020-06-17T20:09:37Z")

</div>

`com.inductiveautomation.reporting.common.api.QueryResults#getCoreResults` returns a Dataset - just call `data["tag_history"].getCoreResults()`.

---

<div class="post-metadata">

**Author:** ![code\_skin](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@code\_skin](https://forum.inductiveautomation.com/u/code_skin)\
**Post date:** [June 17, 2020, 8:12pm UTC](https://forum.inductiveautomation.com/t/how-to-convert-queryresults-to-dataset/35774/3 "2020-06-17T20:12:38Z")

</div>

Thanks @paul-griffith.  
I just found the reference in the docs for that.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/8/8435b49072272acc8cfa6bf62926eb7d0c951acd.png)
