# How to pass a dataset as a parameter in a report query?

**URL:** <https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351>\
**Category:** Ignition\
**Tags:** reporting\
**Created:** [April 21, 2025, 7:59pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351 "2025-04-21T19:59:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://forum.inductiveautomation.com/u/Troy)\
**Post date:** [April 21, 2025, 7:59pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/1 "2025-04-21T19:59:46Z")

</div>

I am trying to pass a dataset as a parameter to a SQL Query Data Source in a report.  
The dataset has a list of IDs in the 'ID' column.  
The query would be:

```python
SELECT * FROM My_Table
WHERE id IN (?)

```

I tried setting Parameter 1 to `groupConcat(my_dataset, 'ID', ',')` but I think the parameter ends up like this `"000, 001, 002, 003"` instead of `"000", "001", "002", "003"`

Is this possible in the query data source, or do I have to do this in a script data source?

---

<div class="post-metadata">

**Author:** ![Steve\_Laubach](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/steve_laubach/32/60900_2.png) [@Steve\_Laubach](https://forum.inductiveautomation.com/u/Steve_Laubach)\
**Post date:** [April 21, 2025, 8:11pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/2 "2025-04-21T20:11:12Z")

</div>

You can derive reports from a script so most things are possible. For example, you could look up a dataset within a script and output the report data from that.

I think this is the direction you need to go.

> **[Scripting Data Source | Ignition User Manual](https://www.docs.inductiveautomation.com/docs/8.1/ignition-modules/reporting/report-data/scripting-data-source)**
>
> The Script data source allows you to use scripting to add data into a report, or modify existing data. With this data source, you can pull in data from the database and then modify it using a script before pushing it out as a data key for use in the...

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://forum.inductiveautomation.com/u/Troy)\
**Post date:** [April 21, 2025, 8:14pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/3 "2025-04-21T20:14:07Z")

</div>

I'd like to do it in a query because I can give them names in the Data Sources sidebar, my scripts all are named "Script" and its hard to find the right one when I need to change things

---

<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:** [April 21, 2025, 8:19pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/4 "2025-04-21T20:19:14Z")

</div>

Don't use more than one script in a report. Just do everything in a single script. For ease of maintenance, consider having that one script call a project library function to actually do the work.

(A single report data script can add as many data keys as you like.)

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://forum.inductiveautomation.com/u/Troy)\
**Post date:** [April 21, 2025, 9:14pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/5 "2025-04-21T21:14:51Z")

</div>

I have 2 scripts, just to make sure data keys that are defined in 1 or 2 lines don't get buried by ones that need a lot more code.

What is the benefit of moving code to the project library? Wouldn't that make it more difficult to swap between the code, designer, and preview?

---

<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:** [April 21, 2025, 9:19pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/6 "2025-04-21T21:19:55Z")

</div>

No, because you can float your project library script windows to keep them visible and editable.

---

<div class="post-metadata">

**Author:** ![Simon\_Hathout\_Willar](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Simon\_Hathout\_Willar](https://forum.inductiveautomation.com/u/Simon_Hathout_Willar)\
**Post date:** [April 21, 2025, 9:23pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/7 "2025-04-21T21:23:01Z")

</div>

TIL you can float a script by opening it in the designer, and right clicking the tab down at the bottom.

---

<div class="post-metadata">

**Author:** ![Troy](https://avatars.discourse-cdn.com/v4/letter/t/85f322/32.png) [@Troy](https://forum.inductiveautomation.com/u/Troy)\
**Post date:** [April 24, 2025, 6:14pm UTC](https://forum.inductiveautomation.com/t/how-to-pass-a-dataset-as-a-parameter-in-a-report-query/105351/8 "2025-04-24T18:14:43Z")

</div>

Same, I had no idea this was a thing
