# Dynamic Text Label

**URL:** <https://forum.inductiveautomation.com/t/dynamic-text-label/45355>\
**Category:** Ignition\
**Created:** [April 7, 2021, 6:21pm UTC](https://forum.inductiveautomation.com/t/dynamic-text-label/45355 "2021-04-07T18:21:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![luis.duarte](https://avatars.discourse-cdn.com/v4/letter/l/90ced4/32.png) [@luis.duarte](https://forum.inductiveautomation.com/u/luis.duarte)\
**Post date:** [April 7, 2021, 6:21pm UTC](https://forum.inductiveautomation.com/t/dynamic-text-label/45355/1 "2021-04-07T18:21:19Z")

</div>

Hello,

I have a docked window with a text label. I would like to dynamically change the text property on the label depending on what window is opened.

Any suggestions on how to do this.

For Example

If Control Window is selected, then display label text = “Control Window”  
If Plant Overview is selected, then display label text = “Plant Overview”

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [April 7, 2021, 9:51pm UTC](https://forum.inductiveautomation.com/t/dynamic-text-label/45355/2 "2021-04-07T21:51:55Z")

</div>

It may not be the best way, but you can create a client timer script that writes the active window name to a client tag. Then bind the labels text property to that client tag.  
To test it I created the “activeWindow” client tag, and set this script to run once a second:

system.tag.write("[client]activeWindow",system.nav.getCurrentWindow())

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [April 7, 2021, 10:16pm UTC](https://forum.inductiveautomation.com/t/dynamic-text-label/45355/3 "2021-04-07T22:16:03Z")

</div>

I just thought of another way. If you are using a tab strip navigation, you could add the script from my last message to the property change event instead of doing the timer client script.

---

<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:** [April 8, 2021, 9:26am UTC](https://forum.inductiveautomation.com/t/dynamic-text-label/45355/4 "2021-04-08T09:26:47Z")

</div>

Are you using vision or perspective? For Vision you can use the system tag `[system]Client/User/CurrentWindow`  
Perspective is a different story. I’ve solved this by calling a function on startup of all my main views which writes to a session prop. It would be nice if there was a session prop for this already, but at the moment we’re out of luck.

Edit: I thought you might have been able to get this from the `system.perspective.getSessionInfo()` function, however the pageIds that are returned are hexadecimal ids rather than actual view paths, so this isn’t useable for this. Interestingly though, the pageIds are the names of the Views for the Designer session, but they don’t include the path to the View, so even that’s not very useful for this.

---

<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 8, 2021, 10:56am UTC](https://forum.inductiveautomation.com/t/dynamic-text-label/45355/5 "2021-04-08T10:56:40Z")

</div>

Just like @nminchin, we’re using a session custom prop `currentView` that stores exactly what its name says. This makes a lot of things much simpler.
