# BM.4519.D system.db.toDataSet wont write data in a dropdown

**URL:** <https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567>\
**Category:** Ignition\
**Created:** [February 23, 2010, 7:26am UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567 "2010-02-23T07:26:39Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 23, 2010, 7:26am UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/1 "2010-02-23T07:26:39Z")

</div>

Using the following code

`pyData = system.dataset.toPyDataSet(system.db.getConnections())
newData = []
headers = ["DataSource"]
for row in pyData:
	newData.append([row[0]])
event.source.parent.getbalhblahblahnewDataSet.data = system.db.toDataSet(headers,newData)`

Give me a stack overflow. It can write to a real dataset no problem though, just the dataset “data” in a dropdown menu.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [February 23, 2010, 5:16pm UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/2 "2010-02-23T17:16:01Z")

</div>

Huh, this works for me. Where did you put this script?

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 23, 2010, 9:08pm UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/3 "2010-02-23T21:08:45Z")

</div>

On the CTG pages Im modifying. The datasources dropdown of the pen edit screen, replacing the old scraping logic. Ill upload the vwin in a bit

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 24, 2010, 9:31pm UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/4 "2010-02-24T21:31:23Z")

</div>

The error occurs on the included files. Might be something easy, I am tired. Other then that error, here are the updated CTG files for Ignition  
[ignition ctg.zip](https://us1.discourse-cdn.com/inductiveautomation/original/1X/7f5a27e6fd18b84057b575bcb718334c19e55f30.zip) (141 KB)

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 26, 2010, 4:55am UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/5 "2010-02-26T04:55:38Z")

</div>

Hey Carl,  
Have you tried the CTG stuff I have attached. Im installing the new build now, Ill let you knwo if it works there.

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [February 26, 2010, 5:41pm UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/6 "2010-02-26T17:41:08Z")

</div>

This problem was due to the script to set the dropdown’s data being on the dropdown’s propertyChange script - so every time the script was run and set the dropdown’s data, it fired a propertyChange, and so on until the stack overflowed.

A better approach would be to bind the dropdown’s data property to a runScript expresison that pulled in the list of datasources.

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 26, 2010, 9:25pm UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/7 "2010-02-26T21:25:01Z")

</div>

I used event.propertyName to check only changes from ListInit. Do you want me to upload the completed files now that they work?

---

<div class="post-metadata">

**Author:** ![Carl.Gould](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/carl.gould/32/7262_2.png) [@Carl.Gould](https://forum.inductiveautomation.com/u/Carl.Gould)\
**Post date:** [February 26, 2010, 9:40pm UTC](https://forum.inductiveautomation.com/t/bm-4519-d-system-db-todataset-wont-write-data-in-a-dropdown/1567/8 "2010-02-26T21:40:17Z")

</div>

Sure, that would be great.
