# Referencing a list of datasets in reporting (7.9.5)

**URL:** <https://forum.inductiveautomation.com/t/referencing-a-list-of-datasets-in-reporting-7-9-5/28720>\
**Category:** Ignition\
**Created:** [October 1, 2019, 11:17pm UTC](https://forum.inductiveautomation.com/t/referencing-a-list-of-datasets-in-reporting-7-9-5/28720 "2019-10-01T23:17:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![max.schmid](https://avatars.discourse-cdn.com/v4/letter/m/49beb7/32.png) [@max.schmid](https://forum.inductiveautomation.com/u/max.schmid)\
**Post date:** [October 1, 2019, 11:17pm UTC](https://forum.inductiveautomation.com/t/referencing-a-list-of-datasets-in-reporting-7-9-5/28720/1 "2019-10-01T23:17:37Z")

</div>

I am trying to dynamically plot an arbitrary (call it fewer than 52) number of pens on an xy chart in a report. I am able to dynamically create and populate the necessary lists, but what is the best way to convert these lists to multiple datasets for each pen to reference?  
I started off with a list of datasets, but I can’t figure out how to reference each individual dataset in the chart. Is this possible? I have the DataKey set to entryDataSet[0], and the Domain and pen Range Keys set to the necessary dataset column ID. The chart does not print “No Data”, so it looks like it is at least seeing something there. FWIW, i am able to obtain the correct data from the list of datasets via scripting, so I know the list of datasets are populated correctly

```auto
	numOfEntriesSet = data['numOfEntries'].getCoreResults()	
	intNumOfEntries = int(numOfEntriesSet.getValueAt(0,0))

	header = ["statorSection", "BlasterID", "avgWeightLoss", "avgPercentWeightLoss", "EntryDateTime", "entryNum"]

	data['entryDataSet'] = []
	filteredData = [[] for _ in range(intNumOfEntries)]

	rawData = data['summaryRawData'].getCoreResults()
	
	for i in range(intNumOfEntries):
		for row in range(rawData.rowCount):
			if rawData.getValueAt(row, "entryNum") == (i+1):
				entryList = []
				entryList.append(rawData.getValueAt(row, "statorSection"))
				entryList.append(rawData.getValueAt(row, "BlasterID"))
				entryList.append(rawData.getValueAt(row, "avgWeightLoss"))
				entryList.append(rawData.getValueAt(row, "avgPercentWeightLoss"))
				entryList.append(rawData.getValueAt(row, "EntryDateTime"))
				entryList.append(int(rawData.getValueAt(row, "entryNum")))
				filteredData[i].append(entryList)

		data['entryDataSet'].append(system.dataset.toDataSet(header, filteredData[i]))

```

As far as the “dynamic” pens themselves, I am planning on going this route due to the chart scripting datasource access limitation prior to 7.9.7:  
[Report Module: Tag Historian Query dynamic tags list](http://forum.inductiveautomation.com/t/report-module-tag-historian-query-dynamic-tags-list/23303)

**EDIT: I was thinking about the dataset structure and how the charts reference them all wrong. what I need is to dynamically add columns for the header and dataset depending on the # of entries I have. This will be simple to print.**
