# Get Easy Charts DB Pens at runtime

**URL:** <https://forum.inductiveautomation.com/t/get-easy-charts-db-pens-at-runtime/7113>\
**Category:** General Discussion\
**Created:** [August 21, 2013, 6:56pm UTC](https://forum.inductiveautomation.com/t/get-easy-charts-db-pens-at-runtime/7113 "2013-08-21T18:56:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![emca222](https://avatars.discourse-cdn.com/v4/letter/e/a4c791/32.png) [@emca222](https://forum.inductiveautomation.com/u/emca222)\
**Post date:** [August 21, 2013, 6:56pm UTC](https://forum.inductiveautomation.com/t/get-easy-charts-db-pens-at-runtime/7113/1 "2013-08-21T18:56:14Z")

</div>

I am trying to get the names off an Easy Charts DB Pens at runtime I am passing the DB Pens Dataset and the dropdown list I want to populate to my script, from the dialog box I can see that both arguments are passed to the script OK. When I try to retrieve values from the dataset (last line of code) it causes an exception. How should I retrieve the values from the DB Pens dataset.

def fillList(dropDown, dbPens):  
import system  
penList = []  
header = [“values”, “NAME”]  
system.gui.messageBox("DB Pens value: " + dbPens.toString() + "\nDropdown: " + dropDown.toString())  
idx = 0  
for row in range(dbPens.rowCount):  
name = dbPens.getValueAt(row, “NAME”)

---

<div class="post-metadata">

**Author:** ![adamaustin](https://avatars.discourse-cdn.com/v4/letter/a/5f8ce5/32.png) [@adamaustin](https://forum.inductiveautomation.com/u/adamaustin)\
**Post date:** [August 22, 2013, 9:37pm UTC](https://forum.inductiveautomation.com/t/get-easy-charts-db-pens-at-runtime/7113/2 "2013-08-22T21:37:13Z")

</div>

Try this:

```auto
def fillList(dropDown, dbPens):
	import system 
	penList = [] 
	header = ["values", "NAME"]
	system.gui.messageBox("DB Pens value: " + dbPens.toString() + "\nDropdown: " + dropDown.toString()) 
	idx = 0
	for row in system.dataset.toPyDataSet(dbPens):
		penList.append([row["NAME"], row["NAME"])
		dropDown.data = system.dataset.toDataSet(header, penList)

```

---

<div class="post-metadata">

**Author:** ![emca222](https://avatars.discourse-cdn.com/v4/letter/e/a4c791/32.png) [@emca222](https://forum.inductiveautomation.com/u/emca222)\
**Post date:** [August 23, 2013, 5:41pm UTC](https://forum.inductiveautomation.com/t/get-easy-charts-db-pens-at-runtime/7113/3 "2013-08-23T17:41:29Z")

</div>

Thanks adamaustin  
That worked for me I didn’t include all the code I had tried converting dpPens to pyDataSet but still couldn’t iterate through it.
