# Open View when Tag Changed

**URL:** <https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [June 22, 2024, 6:07pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252 "2024-06-22T18:07:51Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 22, 2024, 6:07pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/1 "2024-06-22T18:07:51Z")

</div>

Hello everyone.

If anyone could help me.  
I want to open views/windows on Perspective when any tag (boolean) has change its value from OPC Tags. I was trying on tag editor window with the scripts of this forum but i cant do it.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/b/2baa56efb32d74e85438ce5322b36791d316b118.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/8/98117656194667f3660e985900bfcc8b903443b2.png)

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [June 23, 2024, 1:16am UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/2 "2024-06-23T01:16:19Z")

</div>

There are many posts already, perhaps this one will be helpful, [Show a popup in perspective on all clients if a value changes](https://forum.inductiveautomation.com/t/show-a-popup-in-perspective-on-all-clients-if-a-value-changes/61133)

By the way, you don't have any script.

---

<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 23, 2024, 12:39pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/3 "2024-06-23T12:39:21Z")

</div>

This seems to be a copy of your posts on [System.perspective.navigate doesn't work on session custom property tag change script - #6 by Francisco\_Ochoa](https://forum.inductiveautomation.com/t/system-perspective-navigate-doesnt-work-on-session-custom-property-tag-change-script/78348/6) which already has a couple of answers.

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 24, 2024, 2:54pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/4 "2024-06-24T14:54:05Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/613931073a8bd8834008c7cf1829183db89833b0.png)

---

<div class="post-metadata">

**Author:** ![jlandwerlen](https://avatars.discourse-cdn.com/v4/letter/j/bc8723/32.png) [@jlandwerlen](https://forum.inductiveautomation.com/u/jlandwerlen)\
**Post date:** [June 24, 2024, 4:07pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/5 "2024-06-24T16:07:10Z")

</div>

Do you have a question?

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 24, 2024, 5:13pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/6 "2024-06-24T17:13:19Z")

</div>

yeah i cant get it , open view with tag change , i was trying with this option

with session custom

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/c/ecc06a69902c0ee78d574216900f5893089fa386.png)  
and this change script  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/7/37ef763cffff9db726162133c534e00eaa6fbc93.png)

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 22, 2024, 1:31am UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/9 "2024-06-22T01:31:37Z")

</div>

can you help me with a same problem?

i want to open VIEW when a tag change value(boolean) but i cant do it , i tried with any examples of here but doesnt work

---

<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 22, 2024, 1:56am UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/10 "2024-06-22T01:56:52Z")

</div>

Welcome to the forum, Francisco.  
For anyone to help you, you need to show,

1. What you did. (Post formatted code - see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831) - and post a nicely cropped screenshot if you think that will be helpful.)
2. What did you expect to happen?
3. What happened? (Error messages, etc.)

Otherwise everyone is just guessing.

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 22, 2024, 1:58am UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/11 "2024-06-22T01:58:07Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/6/e66c41145ffee47614ab6c44541f383bf9054796.png)

---

<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 22, 2024, 2:46am UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/12 "2024-06-22T02:46:35Z")

</div>

Tags are outside your project. Tags know nothing about your project. Tags don't know if your project is open or not. Tags know nothing about session properties in your project.

Try this:

- Create a session custom property on your project.
- Create a tag binding on that custom property.
- Create an onChange event on that custom property. Put your navigation script in there.

---

<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:** [June 22, 2024, 3:04am UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/13 "2024-06-22T03:04:41Z")

</div>

That, and you got your indentation wrong, as the red squiggle is trying to tell you.

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 22, 2024, 6:20pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/14 "2024-06-22T18:20:16Z")

</div>

the last point onChange event should be write on Expression??

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

im new on Perspective module the interface is totally different with Vision

---

<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 22, 2024, 7:16pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/15 "2024-06-22T19:16:58Z")

</div>

> [@Transistor](#):
>
> 1. Create a session custom property on your project. **Done**.
> 2. Create a tag binding on that custom property. **Done**
> 3. Create an onChange event on that custom property. Put your navigation script in there.

> The last point onChange event should be write on Expression?

No.

- Right-click on `session.custom.openview`.
- Select **Add Change Script**.
- Add your code there.

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 24, 2024, 2:52pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/16 "2024-06-24T14:52:37Z")

</div>

Good morning Transistor.

i put the code but i have a syntax error.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/613931073a8bd8834008c7cf1829183db89833b0.png)

---

<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:** [June 24, 2024, 2:57pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/17 "2024-06-24T14:57:56Z")

</div>

Make sure that you are consistently using one tab character to indent, not any mixture of tabs and spaces. You can right click in the script editing area and select 'Appearance' -\> 'Show Whitespace' to see the invisible indentation characters.

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 24, 2024, 3:03pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/18 "2024-06-24T15:03:54Z")

</div>

> [@System.perspective.navigate doesn't work on session custom property tag change script](https://forum.inductiveautomation.com/t/system-perspective-navigate-doesnt-work-on-session-custom-property-tag-change-script/78348/2):
>
> ```python
> if currentValue.value > 2:
> for page in self.pages:
> system.perspective.navigate(page="/", sessionId=self.id, pageId=page.id)
> 
> ```

i dont have syntax error but the code doesnt run

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/6/36f50d56e2ff1e2f82e425463b833901840a6fba.png)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/b/7b6dfe73884c032fc10894d983de5bcb7f1ea69f.png)

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

---

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [June 24, 2024, 3:08pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/19 "2024-06-24T15:08:35Z")

</div>

> [@System.perspective.navigate doesn't work on session custom property tag change script](https://forum.inductiveautomation.com/t/system-perspective-navigate-doesnt-work-on-session-custom-property-tag-change-script/78348/2):
>
> You might also be able to do something like this:

_might_. Looks like you can't.

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 24, 2024, 3:14pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/20 "2024-06-24T15:14:05Z")

</div>

> [@System.perspective.navigate doesn't work on session custom property tag change script](https://forum.inductiveautomation.com/t/system-perspective-navigate-doesnt-work-on-session-custom-property-tag-change-script/78348/5):
>
> ```python
> if currentValue.value > 2:
> all_sessions = system.perspective.getSessionInfo()
> for user_session in all_sessions:
> if user_session.id == session.props.id:
> page_ids = user_session.pageIds
> for page_id in page_ids:
> system.perspective.navigate(page="/", sessionId=user_session.id, pageId=page_id)
> 
> ```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/f/7f3a29cebd952c71ed4cd813d92d669b9be183be.png)  
im tried with the other code

show this

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/5/d51a56c81ea975284171d77f7f1094520a1fb2fe.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/3/9/39ae2d257553702cb78c2f3df175b42a39ae118a.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:** [June 24, 2024, 3:22pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/21 "2024-06-24T15:22:19Z")

</div>

Your `for` loop isn't indented to be part of the `def`.

---

<div class="post-metadata">

**Author:** ![Francisco\_Ochoa](https://avatars.discourse-cdn.com/v4/letter/f/e495f1/32.png) [@Francisco\_Ochoa](https://forum.inductiveautomation.com/u/Francisco_Ochoa)\
**Post date:** [June 24, 2024, 3:36pm UTC](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252/22 "2024-06-24T15:36:44Z")

</div>

i move it but its the same error

[Next page](https://forum.inductiveautomation.com/t/open-view-when-tag-changed/92252.md?page=2)
