# Dashboard Component Question - Iterating Over Widgets

**URL:** <https://forum.inductiveautomation.com/t/dashboard-component-question-iterating-over-widgets/61188>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 24, 2022, 9:28pm UTC](https://forum.inductiveautomation.com/t/dashboard-component-question-iterating-over-widgets/61188 "2022-06-24T21:28:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicholas\_Wilson](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Nicholas\_Wilson](https://forum.inductiveautomation.com/u/Nicholas_Wilson)\
**Post date:** [June 24, 2022, 9:28pm UTC](https://forum.inductiveautomation.com/t/dashboard-component-question-iterating-over-widgets/61188/1 "2022-06-24T21:28:50Z")

</div>

Hello,

I’m using a Dashboard for a project and have several questions relating to this component:

1. Is it possible to create an event script that runs when a widget is deleted or created by a user when the dashboard is in edit mode?

2. I’m trying to dynamically assign view parameters (such as machine number) to widgets depending on how many existing widgets with the same name. I want to use something akin to this:

```auto
machineNameCount = {}
for widget in activeWidgets:
    machineNameCount[widget.GetName()] = 0
for widget in active Widgets:
    machineNameCount[widget.GetName()] += 1
    widget.SetNumber(machineNameCount[widget.GetName()])

```

Is there a way such as this to iterate over available widgets and widgets and assign view parameters to the widget based on the number of instances (and other properties) of that availableWidget?

Thank you,  
Nick

---

<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:** [June 24, 2022, 10:01pm UTC](https://forum.inductiveautomation.com/t/dashboard-component-question-iterating-over-widgets/61188/2 "2022-06-24T22:01:20Z")

</div>

Nick, you missed the `</>` code formatting button which will preserve indents and apply syntax highlighting. Hit the pencil icon below your original post …
