# Move component group to position based on boolean custom property

**URL:** <https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309>\
**Category:** Ignition\
**Tags:** scripting, vision\
**Created:** [February 24, 2023, 7:44pm UTC](https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309 "2023-02-24T19:44:31Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lance\_Mills](https://avatars.discourse-cdn.com/v4/letter/l/8edcca/32.png) [@Lance\_Mills](https://forum.inductiveautomation.com/u/Lance_Mills)\
**Post date:** [February 24, 2023, 7:44pm UTC](https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309/1 "2023-02-24T19:44:31Z")

</div>

Hi there,

I'm trying to get a group of components to move to a new position once a custom property UVActuate is True, and then return to the original position when UVActuate becomes false.

The issue I'm having is that using the a group of components have no attribute propertyName. So this script is being called continuously for every event.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/8/f8886d317ac13ead8f1bf6950e81dfb715cbf133.png)

My work around is to use function decorator to run the translate function once.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/4/14b2f6454bc9e84db86668c410da8ed9f9570345.png)

I've tested my script and it executes once in a loop, but that doesn't make a difference in the runtime since it looks like the script is reinitialized each time an event happens.

There's probably a better implementation or method I should be using. Any suggestions or comments would be appreciated.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c264fd2cf429039e2cfd4cb7a2479e7fd14fac56.png)

---

<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 24, 2023, 7:49pm UTC](https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309/2 "2023-02-24T19:49:56Z")

</div>

That event fired whenever any of the props on that component change. You need to check what property changed first

```auto
if event.propertyName == 'UVActuate':
   ....

```

For first init, use the `componentRunning` prop

```auto
if event.propertyName == 'componentRunning':
   ....

```

---

<div class="post-metadata">

**Author:** ![Lance\_Mills](https://avatars.discourse-cdn.com/v4/letter/l/8edcca/32.png) [@Lance\_Mills](https://forum.inductiveautomation.com/u/Lance_Mills)\
**Post date:** [February 24, 2023, 7:51pm UTC](https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309/3 "2023-02-24T19:51:55Z")

</div>

I get an error when I try to use event.source.propertyName for a group as mentioned above.

---

<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 24, 2023, 7:52pm UTC](https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309/4 "2023-02-24T19:52:23Z")

</div>

That's because you added `.source`. propertyName exists as part of the event object

---

<div class="post-metadata">

**Author:** ![Lance\_Mills](https://avatars.discourse-cdn.com/v4/letter/l/8edcca/32.png) [@Lance\_Mills](https://forum.inductiveautomation.com/u/Lance_Mills)\
**Post date:** [February 24, 2023, 7:52pm UTC](https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309/5 "2023-02-24T19:52:39Z")

</div>

ahhh. I'll give that a shot.

---

<div class="post-metadata">

**Author:** ![Lance\_Mills](https://avatars.discourse-cdn.com/v4/letter/l/8edcca/32.png) [@Lance\_Mills](https://forum.inductiveautomation.com/u/Lance_Mills)\
**Post date:** [February 24, 2023, 7:58pm UTC](https://forum.inductiveautomation.com/t/move-component-group-to-position-based-on-boolean-custom-property/70309/6 "2023-02-24T19:58:56Z")

</div>

That did the trick, thank you!
