# How to change perspective component value from tag event

**URL:** <https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446>\
**Category:** Ignition\
**Created:** [November 24, 2021, 7:29pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446 "2021-11-24T19:29:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![ihtus\_ihtus](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ihtus\_ihtus](https://forum.inductiveautomation.com/u/ihtus_ihtus)\
**Post date:** [November 24, 2021, 7:29pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/1 "2021-11-24T19:29:33Z")

</div>

How is it possible to change perspective component value from tag event  
For example: I want to change 'text' of 'Label\_0' when the value of tag 'TAG1' changes.

I tried this, but I guess the calling syntax

> self.getSibling("Label\_0")

is incorrect.

Tag Event Script / Value Events / Value Changed:

```auto
def valueChanged(tag, tagPath, previousValue, currentValue, initialChange, missedEvents):
    #....
    self.getSibling("Label_0").props.text = currentValue.value

```

EDIT: yes I know it's possible to do binding from component to tag.. but need specifically from tag =\> comoponent... and this example was simplified

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d96d696d9ef5b4beae2907af78f906c62bf70873.png)

---

<div class="post-metadata">

**Author:** ![bkarabinchak.psi](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bkarabinchak.psi/32/83567_2.png) [@bkarabinchak.psi](https://forum.inductiveautomation.com/u/bkarabinchak.psi)\
**Post date:** [November 24, 2021, 7:47pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/2 "2021-11-24T19:47:34Z")

</div>

Think about it in the reverse way. Don’t have your tag write to the text component, have your text component read your tag value.

In your components text field, bind to the tag value to display the tag data.

---

<div class="post-metadata">

**Author:** ![ihtus\_ihtus](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ihtus\_ihtus](https://forum.inductiveautomation.com/u/ihtus_ihtus)\
**Post date:** [November 24, 2021, 7:52pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/3 "2021-11-24T19:52:17Z")

</div>

thanks for the suggestion, I am aware about binding… but I need to have it exactly as I described… from tag to label…because of the nature of the task. And this is a simplified example.

---

<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:** [November 24, 2021, 8:06pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/4 "2021-11-24T20:06:29Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/a/dabcd3af653c33920546a6cbc4dc12eb53f0d1af.png)  
If you use the property selector tool to choose your label, does it give you the same `self.getSibling("Label_0")` path, or something different?

---

<div class="post-metadata">

**Author:** ![ihtus\_ihtus](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ihtus\_ihtus](https://forum.inductiveautomation.com/u/ihtus_ihtus)\
**Post date:** [November 24, 2021, 8:22pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/5 "2021-11-24T20:22:11Z")

</div>

PGriffith, if I would try to browse to the needed component value from another component =\> yes, I get same syntax. See screenshot

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0dace6bd30c87f94389fd57058ff07291568645b.png)

But I am looking for a way to access component value from withing Tag Event Script.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/9/d96d696d9ef5b4beae2907af78f906c62bf70873.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 24, 2021, 8:30pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/6 "2021-11-24T20:30:15Z")

</div>

There is no correct syntax. Tags are global. By themselves, they have no knowledge of what clients/pages/views are open, and no access to the components within them. So, within the tag, your only option is to send a broadcast message to all Perspective sessions, expecting a session message handler to re-broadcast it where you need.

Conversely, your session/page/view can bind the tag to a property (not necessarily directly to the label text), and a propertyChange action can then dispatch it within the context/scope where it is bound.

You need to flip the paradigm in your head.

---

<div class="post-metadata">

**Author:** ![ihtus\_ihtus](https://avatars.discourse-cdn.com/v4/letter/i/ecccb3/32.png) [@ihtus\_ihtus](https://forum.inductiveautomation.com/u/ihtus_ihtus)\
**Post date:** [November 25, 2021, 12:14pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/7 "2021-11-25T12:14:27Z")

</div>

> [@pturmel](#):
>
> So, within the tag, your only option is to send a broadcast message to all Perspective sessions, expecting a session message handler to re-broadcast it where you need.

Thanks! Can you please share an example of code on how to send a broadcast message to all Perspective sessions?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [November 25, 2021, 3:05pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/8 "2021-11-25T15:05:45Z")

</div>

I don’t have an example because I would never do this. _ **It is the wrong approach.** _

IMNSHO.

---

<div class="post-metadata">

**Author:** ![Pico\_Sankari](https://avatars.discourse-cdn.com/v4/letter/p/aeb1de/32.png) [@Pico\_Sankari](https://forum.inductiveautomation.com/u/Pico_Sankari)\
**Post date:** [June 5, 2024, 11:11pm UTC](https://forum.inductiveautomation.com/t/how-to-change-perspective-component-value-from-tag-event/53446/9 "2024-06-05T23:11:33Z")

</div>

Was just trying to do this. If you need the tag to dictate the component changing, you can bind a custom property on the component to the tag then use a change script on the custom property to make your changes.
