# Binding a Drop Down List from Custom Object in root Container in Perspective

**URL:** <https://forum.inductiveautomation.com/t/binding-a-drop-down-list-from-custom-object-in-root-container-in-perspective/67881>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [December 21, 2022, 3:11pm UTC](https://forum.inductiveautomation.com/t/binding-a-drop-down-list-from-custom-object-in-root-container-in-perspective/67881 "2022-12-21T15:11:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![soundwavesct](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@soundwavesct](https://forum.inductiveautomation.com/u/soundwavesct)\
**Post date:** [December 21, 2022, 3:11pm UTC](https://forum.inductiveautomation.com/t/binding-a-drop-down-list-from-custom-object-in-root-container-in-perspective/67881/1 "2022-12-21T15:11:03Z")

</div>

I am calling a REST API to populate a dataset that is stored in the root container of my Perspective Page (Custom property named response).  
I want to bind my drop down list (value and label) based on this data with is in a json format.

I can easily connect to a single entry but am not sure how to bind to the data list.  
For Example I can use property binding to do something like this.

```auto
parent.custom.response[0].name

```

But obviously I only get one entry, removing the index doesn't work.

Not sure if I need to Transform the json response into a dataset, and if so how to do it.

I will also need to filter the entries and am not sure where best to do that.  
Thanks in advance,  
Brandon

---

<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:** [December 21, 2022, 4:42pm UTC](https://forum.inductiveautomation.com/t/binding-a-drop-down-list-from-custom-object-in-root-container-in-perspective/67881/2 "2022-12-21T16:42:42Z")

</div>

I think a property binding followed by a script transform would be the way to go.

The property binding should point directly to the 'root' of the object, so in this case `parent.custom.response`.

Your script doesn't have to return a dataset, just a properly structured array of items. If you want filtering at the same time, it's easy to do. Something like:

```python
output = []
for row in value:
	if "abc" in row.name:
		output.append({
			"value": row.value,
			"label": row.name,
		})

return output

```

Where the `if` statement is doing the filtering, and each object added to the `output` list has the required `value` and `label` keys.

---

<div class="post-metadata">

**Author:** ![soundwavesct](https://avatars.discourse-cdn.com/v4/letter/s/d6d6ee/32.png) [@soundwavesct](https://forum.inductiveautomation.com/u/soundwavesct)\
**Post date:** [December 21, 2022, 6:20pm UTC](https://forum.inductiveautomation.com/t/binding-a-drop-down-list-from-custom-object-in-root-container-in-perspective/67881/3 "2022-12-21T18:20:54Z")

</div>

Thanks, worked like a charm and a 2 for 1 solution. Glad I asked both questions.
