# Script datasource in reporting module only returns first row

**URL:** <https://forum.inductiveautomation.com/t/script-datasource-in-reporting-module-only-returns-first-row/63087>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [August 17, 2022, 4:58am UTC](https://forum.inductiveautomation.com/t/script-datasource-in-reporting-module-only-returns-first-row/63087 "2022-08-17T04:58:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![amy.sudibyo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amy.sudibyo/32/38659_2.png) [@amy.sudibyo](https://forum.inductiveautomation.com/u/amy.sudibyo)\
**Post date:** [August 17, 2022, 4:58am UTC](https://forum.inductiveautomation.com/t/script-datasource-in-reporting-module-only-returns-first-row/63087/1 "2022-08-17T04:58:07Z")

</div>

```auto
	newList = []
	rowData = []
	for i in range(4):
		newList.append(i)
		rowData.append([i])
	
	header = ['Numbers']
	ds = system.dataset.toDataSet(header,rowData)
	
	data['testKey'] = newList

```

We are building a number of reports with script data source as we are getting data from Sepasoft MES modules. Currently having issues getting any script data source to work correctly. In the description of the updateData function it says the data argument takes values that can be sequences, scalar values or datasets, but the report preview only seems to display the first line.

We have tried with both a list and a dataset and neither result seems to work.  
It seems odd that in each case the value is printed four times, so it is obviously aware of the length of the list/dataset.

Perhaps there’s something we’re doing wrong in the design section?

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0dde1abd28fcdb75316bfcb16e5d0e4d16850561.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/5/35a4251b2a93de1a522f58fbab709438511c7db4.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/d/bd83718d4017112f8bfb0c052fa78dfa2d0438e4.png)

---

<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:** [August 17, 2022, 11:13am UTC](https://forum.inductiveautomation.com/t/script-datasource-in-reporting-module-only-returns-first-row/63087/2 "2022-08-17T11:13:18Z")

</div>

Use the dataset. In the table design, for the header, put static text. In the details section, use a field with key `@Numbers@`. Do not include `@testKey@` there.

---

<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:** [August 17, 2022, 2:58pm UTC](https://forum.inductiveautomation.com/t/script-datasource-in-reporting-module-only-returns-first-row/63087/3 "2022-08-17T14:58:28Z")

</div>

Make sure that the table itself has it’s data key set to `@testKey@`, as well.

---

<div class="post-metadata">

**Author:** ![amy.sudibyo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/amy.sudibyo/32/38659_2.png) [@amy.sudibyo](https://forum.inductiveautomation.com/u/amy.sudibyo)\
**Post date:** [August 19, 2022, 12:30am UTC](https://forum.inductiveautomation.com/t/script-datasource-in-reporting-module-only-returns-first-row/63087/4 "2022-08-19T00:30:57Z")

</div>

Thank you, this worked
