Passing Tag Path into Page From Horizontal Menu

I have a view that I have configured that accepts a tag path to indirectly animate graphics and I’m trying to configure a page to use this as a primary view and still pass the path through. Is there a way to pass a tag path into the URL? I can pass numbers and string values but it looks to fall apart with the ‘/’ that are present in a tag path. Is there some way to do this that I’m missing?

Page URL is set up as /level3/:path where the path gets replaced with a tag path.

Try using urllib.quote_plus() to encode path when generating the URL.

1 Like

That did it. Thanks!

1 Like

Did you open the page through scripting or the Event Configuration and set up the information with urllib.quote_plus() in the Set Page area? I can’t seem to get this to work as a configured event.

I opened it through scripting and passed the path into the url. I’m using the system.perspective.navigate() function and building the URL that I pass into it. The tag path has to go through the urllib.quiote_plus() before being added to the URL to work. I will note that spaces have to be replaced as well if you have any in the path.

1 Like

Just for reference here is the whole script.

import urllib
path = self.view.params.path
path = path.replace(’ ', ‘%20’)
path = urllib.quote_plus(path)
name = self.view.custom.name
url = ‘/level3/SDC/’ + name + ‘/’ + path
system.perspective.navigate(page = url)

2 Likes