# Looping through a perspective view and putting parameters in a list

**URL:** <https://forum.inductiveautomation.com/t/looping-through-a-perspective-view-and-putting-parameters-in-a-list/56486>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [February 23, 2022, 10:53pm UTC](https://forum.inductiveautomation.com/t/looping-through-a-perspective-view-and-putting-parameters-in-a-list/56486 "2022-02-23T22:53:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Safi\_Sanna](https://avatars.discourse-cdn.com/v4/letter/s/c68b51/32.png) [@Safi\_Sanna](https://forum.inductiveautomation.com/u/Safi_Sanna)\
**Post date:** [February 23, 2022, 10:53pm UTC](https://forum.inductiveautomation.com/t/looping-through-a-perspective-view-and-putting-parameters-in-a-list/56486/1 "2022-02-23T22:53:31Z")

</div>

Im trying to loop through perspective view and return a dictionary of parameters. Whats the best way to do it?  
Here is my pseudo code

parameterList = {}  
for param in view.custom.items():  
parameterList.insert({str(param [0]):param [1]})

---

<div class="post-metadata">

**Author:** ![nminchin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/nminchin/32/6911_2.png) [@nminchin](https://forum.inductiveautomation.com/u/nminchin)\
**Post date:** [February 23, 2022, 10:57pm UTC](https://forum.inductiveautomation.com/t/looping-through-a-perspective-view-and-putting-parameters-in-a-list/56486/2 "2022-02-23T22:57:26Z")

</div>

`paramList = {key: self.custom[key] for key in self.custom}`

---

<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:** [February 23, 2022, 11:02pm UTC](https://forum.inductiveautomation.com/t/looping-through-a-perspective-view-and-putting-parameters-in-a-list/56486/3 "2022-02-23T23:02:40Z")

</div>

As long as we’re golfing…  
`return {k: v for k, v in self.custom.items()}`

Or, duh,  
`return dict(self.custom.items())`

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 23, 2022, 11:49pm UTC](https://forum.inductiveautomation.com/t/looping-through-a-perspective-view-and-putting-parameters-in-a-list/56486/4 "2022-02-23T23:49:10Z")

</div>

Tip: use the `</>` code formatting button to preserve indentation and apply syntax highlighting.  
You can edit your question to fix it.
