Scripting display

Hi everyone,

I want to display an element of my banner only when I'm on a specific view.

I know I need to script the visibility of my element with an “if”, but I can't get it to work.

MY CODE:

currentView = self.view.params.viewPath

if currentView == "Ignition 101/Feature Views/Solutions/SYNO":
{this.meta.visible} = true;

else:
{this.meta.visible} = false;

Thanks in advance for your help!

I'm guessing it's perspective ?

Don't use a script. Use an expression binding on either the props.display or meta.visible property of your element. Something like this:

{page.props.primaryView} = "Ignition 101/Feature Views/Solutions/SYNO"

edit:
example with a label in my menu.
Binding on the label's position.display:

image

image

image

3 Likes

Welcome to the forum, Thomas. Please have a read of Wiki - how to post code on this forum.

You should also add the vision or perspective tag to your question title.

Hello,

Thanks for your reply Pascal!

It now works correctly.

(Sorry for posting the code this way, I wasn't aware of it)