How To Determine The Primary View In Use

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.

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.


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.

Thank you, that worked well.

1 Like

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