Specifying the 'view' paramter in the system.perspective.navigate function causes 'no view' error

Hi all,

I'm currently working on passing a parameter between two pages via the navigation function. In all the examples I've seen the user will specify 'view = "/new-page" ', but if I do this I get the dreaded 'No View Found' error. If I don't specify the 'view' parameter the function works just fine to find the view but none of my parameters will be passed into the next page. I'm not quite sure what I'm missing.

Code for button:

system.perspective.navigate(view = '/updateuserview',  params = {'user': self.getSibling("Main_User_table").custom.user})

URL:

Parameter on desired page:
image

Thank you,

Cam

I wouldn't expect a leading slash to be necessary if you're specifying a view; it should just be the exact path to the view in question. Can you show where you're seeing that in examples?

1 Like

Sure,

This is the post I've been working with to try and pass the parameters:

And specifically the code on this manual page:
https://docs.inductiveautomation.com/display/DOC81/system.perspective.navigate

Even if I remove the '/' from my path I still have the same issue of the 'No View Found' Error

updateUserView is the name of your view, per the 'Primary View' section of the page.
Are you passing view=updateUserView (camel-case), or view=updateuserview (all lowercase)?

I'm passing it the all lowercase one because I thought that was the URL specification

Let's back up.
system.perspective.navigate has three 'modes'.

  1. If you provide a page argument, then you must provide a URL path within the same Perspective project, with or without a leading slash:

    String page - The URL of a Perspective page to navigate to. The path can include an optional leading slash: "new-page" and "/new-page" both result cause the session to navigate to the "new-page" page. See Page URLs.

  2. If you provide a url argument, your web browser will be directed to the supplied URL, which can be any valid URL you can access in your web browser:

    String url - The URL of a web address to navigate to. If the page or view parameters are specified, then this parameter is ignored. [optional]

  3. If you provide a view argument, then you provide the resource path to a view within your same project. So whatever the path is in the project browser to the view you want to navigate to. Case sensitive.

    String view - If specified, will navigate to a specific view. Navigating to a view with this parameter does not change the address in the web browser. Thus the web browser's back button will not be able to return the user to the previous view. If the page parameter is specified, then this parameter is ignored. [optional]

You're opting for the 'view' mode by using system.perspective.navigate(view=X). So you must use the exact path/name of a resource that exists in your project. Or, you can use url=someUrlConfiguration. It's your choice, but you have to be consistent.

1 Like

That explains a lot. I was mismatching my view paths so that's why it couldn't find it. I swapped the view to the camel case name and it works fine and the parameters are being passed correctly too.

Thank you Paul :slight_smile:

1 Like