Page path displayed in Perspective sessions

Hi

For the purposes of debug I want to add a text field at the bottom of each of my views and sub views to quickly allow engineers working on the projects to find the correct page location (Project is very large with multiple views)
I have added the text field that is only visiable while in a "debug" mode.

Using the get page.prop.pageid function

the display result in the designer is correct but in the session is a string of apparently random characters

Using the page.props.path function I receive only a "/"

I presume I'm missing something basic here.

Any help welcome

From the document:
https://docs.inductiveautomation.com/display/DOC81/Pages+in+Perspective

For page ID

Note, that the value of of this property in the Designer will match the name of the active view. However, during a session the value will return a uniquely generated string, such as "2bf737f8".

You could instead use path which will show the page path if you need, though I would guess this is similiar to the URL?

If you want to find the view location (or view name in the project) then add a label with the binding below.

return self.view.id.split('@')[0]

Rather than have a special debug mode I'd be inclined to place a discreet 🛈 icon or a very subtly shaded 10 × 10 label in the corner and configure the binding above on its tooltip text property.

meta.tooltip.enabled : true
meta.tooltip.text : <binding above>
meta.tooltip.delay : 5000

The information is unlikely to be of any use to anyone without access to the project.

As you've likely gleaned from the previous responses, you're mixing behaviors of different scopes/clients as well as requesting information of two entirely different concepts.

The Designer does indeed provide the "path" of the View resource within the Designer, because the Designer has no concept of a "Page". This is why you can't see Docked Views or open Popups in the Designer. But we can't just pump null into the pageId, because even the Designer needs that value to be unique.

Now, what you're really asking for is the path to the View - not the path to the Page. Your running browser session is likely showing / because that's the Page you're on, and it's either using your View resource as the "Primary View" of the Page, or you've done View navigation to hot-swap the Primary View for your View resource.

Hi Transistor

The above method works perfectly to return the page path with folder ect in the session so the location can be found in the designer.

Thanks for the help.

For my sake

self.view.id.split('@')[0]

What is this doing ? Is there any documentation anywhere ?

self.view.id is a component method. It's listed under object traversal.
https://docs.inductiveautomation.com/display/DOC81/Perspective+Component+Methods

When I run self.view.id it returns the view name followed by some apparent junk. e.g., viewname@D. I have no idea why.

  • split() is a Python method that breaks the string into a list using a separator character or pattern (or, if none is specified, it breaks on spaces).
  • The result of the method in the example above would be ["viewname", "D"].
  • split('@')[0] will return the first item in the list, viewname.

It's been awhile since I had to venture into this area, but from what I remember, you're looking behind the curtain at the actual indexing of the View (and components do something similar). You can get a better idea of how this is all used by going to your Gateway, then Status > Connections > Perspective Sessions, select any (non-Designer) session, then dive into the Details of any Page in use by the session.

The letter following the @ designates where the View resides.

For example: Templates/Components/Input/Button@C$0:9:0
Is a View with a path of Templates/Components/Input/Button, in the "Central" (Primary) View. It is the 0th child in some container which is the 9th child at the 0th level.

The "D" designation I believe refers to Designer. Docked Views clarify their side with "L", "T", "B", and "R", and I think Popup is "P".

You're actually also likely to see this indexing in use when a specific component has a script fail during execution.

15:17:47.466 [AWT-EventQueue-0] ERROR com.inductiveautomation.ignition.client.util.gui.ErrorUtil - Error running action 'component.onActionPerformed' on Experimentation/TabulaRasa@D/root/Button:

See the "D" designation for Designer?

5 Likes