Get Perspective view path(s) from session PageIds?

system.perspective.getSessionInfo returns the PageIds open on each session, but how can I get the view paths open using these?

Would I need to get a reference to the InternalSession?
When I try to import this with

from com.inductiveautomation.perspective.gateway.session import InternalSession

I get an error:

Caused by: com.inductiveautomation.ignition.common.GenericTransferrableException: ImportError: No module named perspective

I’m calling this from a Perspective button

Curious how you get a list of open views regardless of page IDs.

I think the process would be the same since views are opened by pages

I don’t think Pages have direct insight into the Views in use within, just like Embedded Views don’t have direct insight into the content of the residing View.

This is really what i’m after which is available from the gateway status webpage under Perspective Sessions:

Right, but the route for obtaining that information is not exposed as part of the available scripting options. What’s the use-case?

The use-case is to see exactly how many alarm status tables are being displayed, as we might be having issues with them. But aside from that, it’d also be useful as an analytic tool to see what views operators spend most of their time on

Is there any reason you can’t just track this through a memory/diagnostic tag and increment/decrement the count of ASTs through a component onStartup/onShutdown write? It might not be 100% accurate, but I suspect it would be exactly as accurate as referencing views in open sessions.

i’ve done this in javascript, let me go check to see if it works in perspective too.

I (don’t think) I’ll be able to use javascript since I want to get this from all sessions running. I presume your script will run on a single client?

yeah its on the client, i dont immediately see a way to get it for all sessions

I think it’s certainly possible from the API as it’s available in the gateway webpage; it’s just a matter of someone in the know sharing the secrets :smiley: I ended up doing it manually for 28 connected clients, copying and pasting the stuff into Excel for each client. Very tedious, do not recommend!

yeah it should be accesible somewhere xd
in js it was something like this: client.pages.views
so if you can find the client through the session id…

?PerspectiveSessionMonitor

If you're still looking for a solution on this, I ended up hacking together something that might work

2 Likes