# How To Determine The Primary View In Use

**URL:** <https://forum.inductiveautomation.com/t/how-to-determine-the-primary-view-in-use/27042>\
**Category:** Ignition Early Access\
**Tags:** ignition80, perspective\
**Created:** [July 31, 2019, 2:18pm UTC](https://forum.inductiveautomation.com/t/how-to-determine-the-primary-view-in-use/27042 "2019-07-31T14:18:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jramirez3](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jramirez3](https://forum.inductiveautomation.com/u/jramirez3)\
**Post date:** [July 31, 2019, 2:18pm UTC](https://forum.inductiveautomation.com/t/how-to-determine-the-primary-view-in-use/27042/1 "2019-07-31T14:18:34Z")

</div>

How can I find out if a particular view is open? There isn’t a function to call like isViewOpen(viewName) and returns true or false depending if that view is open. I need something to do that. I have a button on a dock and it needs to different actions depending on what view is being shown.

---

<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:** [July 31, 2019, 2:25pm UTC](https://forum.inductiveautomation.com/t/how-to-determine-the-primary-view-in-use/27042/2 "2019-07-31T14:25:23Z")

</div>

There are several ways to do this, but branching logic which is dependent on current View would be better handled by placing the logic into the displayed View. Ignoring my advice and getting back to your question, the following property reference will get you the path of the Page’s Primary View.

`page.props.primaryView`

If you want only the name of the Primary View, use `page.props.primaryView.split('/')[-1]`

NOTE: This will provide `null` within the Designer since there is no Page within the Designer.

---

<div class="post-metadata">

**Author:** ![jramirez3](https://avatars.discourse-cdn.com/v4/letter/j/a183cd/32.png) [@jramirez3](https://forum.inductiveautomation.com/u/jramirez3)\
**Post date:** [July 31, 2019, 2:55pm UTC](https://forum.inductiveautomation.com/t/how-to-determine-the-primary-view-in-use/27042/3 "2019-07-31T14:55:57Z")

</div>

Thank you, that worked well.

---

<div class="post-metadata">

**Author:** ![mleonard](https://avatars.discourse-cdn.com/v4/letter/m/a87d85/32.png) [@mleonard](https://forum.inductiveautomation.com/u/mleonard)\
**Post date:** [April 16, 2020, 11:06pm UTC](https://forum.inductiveautomation.com/t/how-to-determine-the-primary-view-in-use/27042/4 "2020-04-16T23:06:53Z")

</div>

> [@cmallonee](#):
>
> .split('/')[-1]

I'm trying to use this "page.props.primaryView.split('/')[-1]" in my configure transform for a property binding for the text of a label in a docked view to display the primary view as the screen title. If i simply use the property for the primary view, I get the folder/primaryview. I want to strip the primary view off of this by using the split('/)[-1] but can't get the designer to like any way I put the script in. Any help would be appreciated. Thanks

---

<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:** [April 16, 2020, 11:46pm UTC](https://forum.inductiveautomation.com/t/how-to-determine-the-primary-view-in-use/27042/5 "2020-04-16T23:46:48Z")

</div>

@mleonard:

> [@cmallonee](#):
>
> NOTE: This will provide `null` within the Designer since there is no Page within the Designer.
