# Manipulate props of an object on another view

**URL:** <https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464>\
**Category:** Ignition\
**Tags:** perspective, ignition81, scripting, ignition80\
**Created:** [April 14, 2023, 4:03pm UTC](https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464 "2023-04-14T16:03:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Roberto\_Luis](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@Roberto\_Luis](https://forum.inductiveautomation.com/u/Roberto_Luis)\
**Post date:** [April 14, 2023, 4:03pm UTC](https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464/1 "2023-04-14T16:03:45Z")

</div>

Could someone help me changing a PowerChart's props that is in another view?

Context:  
Screen 1 -\> Has 10 buttons and each one represents a tag. Those 10 buttons open the same pop up (screen 2)  
Screen 2 -\> Just has a PowerChart inside it, and I need to show on graph only those that I've clicked on.

Ex: Click button 1 (PowerChart's content (tag1)), Click button 3 (PowerChart's (tag1 and tag3)) and then sucessively

I've already tried to use message to run a script to append the axis and pen that I need, but when I close the PopUp it seems to deletes the previous axis and pen that I appended, idk.

---

<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:** [April 14, 2023, 4:13pm UTC](https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464/2 "2023-04-14T16:13:26Z")

</div>

You don't want to do this (specifically code screen 1 to know about the contents of screen 2). It's an antipattern that's inherently fragile (what if you decide to add another container to screen 2, or change the name of a component, or whatever?).

Send a message from screen 1 that just indicates which tag was selected.  
Have a message handler on screen 2 that listens for the "a tag was selected" message. In that message handler, (or, by invoking a custom script on your chart) do your axis manipulation.

That way you've "separated concerns" - the list of buttons is only in charge of dictating which tag was selected. The chart is in charge of reacting to a tag being selected.

---

<div class="post-metadata">

**Author:** ![Roberto\_Luis](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@Roberto\_Luis](https://forum.inductiveautomation.com/u/Roberto_Luis)\
**Post date:** [April 14, 2023, 5:23pm UTC](https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464/3 "2023-04-14T17:23:13Z")

</div>

I was doing the following sequence:

- Button -\> Open pop up -\> Send the message with a payload that contais just the tag that I want to add;
- In the PowerChart's screen, I'm using the root the message handler.
- The root uses that tag on a script to it add correctly on the graph. But, it just add after I click again on the button behind the pop up. On the first click it just open the pop-up with no information on the graph.

ps: If I add it using the double click that I mentioned before, close the pop-up and open again with a normal button, all the changes that the double click made is deleted.

Hope it was clear 😰

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [April 14, 2023, 5:27pm UTC](https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464/4 "2023-04-14T17:27:59Z")

</div>

That's because you're sending a message before the handler is listening.  
For the first tag, pass it as a parameter to the popup and add it from there.

You can send a message from the on change script of parameters, but a simple binding should be enough - the powerchart data shouldn't be reset if the parameter doesn't change, which should not happen. You may want to wait for confirmation on that.

---

<div class="post-metadata">

**Author:** ![Roberto\_Luis](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@Roberto\_Luis](https://forum.inductiveautomation.com/u/Roberto_Luis)\
**Post date:** [April 17, 2023, 11:37am UTC](https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464/5 "2023-04-17T11:37:45Z")

</div>

I started to use this on change script as you suggested, it's working. But I don't want to reset the powerchart data, is there a way to do it?

---

<div class="post-metadata">

**Author:** ![Roberto\_Luis](https://avatars.discourse-cdn.com/v4/letter/r/977dab/32.png) [@Roberto\_Luis](https://forum.inductiveautomation.com/u/Roberto_Luis)\
**Post date:** [April 17, 2023, 11:52am UTC](https://forum.inductiveautomation.com/t/manipulate-props-of-an-object-on-another-view/72464/6 "2023-04-17T11:52:56Z")

</div>

After searching about it I got the idea to create it on session custom prop and link it

Then the popup don't reset its data when I close it.

Thanks you all for the support.
