Syntax Error on Token

I have been trying to get an icon to become invisible or visible based on whether a property value is between a range within an expression
this is my code

if (({session.custom.winddirect} = ( <= 337.5 && >= 22.5 )), ({this.meta.visible} = 1), ({this.meta.visible} = 0))

the error_configuration im getting is Error_Configuration(“Runtime Exception: syntax error on token: ‘LESS THAN OR EQUAL TO’ (Line 1, Char 38)”)

Additionally, if i replace the less than and greater than value with 0 it gives me a different error saying Error_CycleDetected I am having a hard time figuring out why this does not work.
Would greatly appreciate any advice

The <= operator needs two values. So you need to supply the value you are wanting to be between 337.5 and 22.5

if (({session.custom.winddirect} = ( {someValueHere} <= 337.5 && {someValueHere} >= 22.5 )), ({this.meta.visible} = 1), ({this.meta.visible} = 0))
1 Like

Thank you lrose i think that resolved it but can you tell me what is meant by cycle detected or how i can work around it

I would assume that it would probably mean it is referencing itself. Not sure, where is this binding being used?

1 Like

Im binding the visible property of an icon and im trying to have the result of the if statement turn the visibility = 1 if within the range or else = 0 if it isnt within the range.
Yes i am trying to refer it to itself but i cant think of another way to do it

Thank you lrose i figured it out i just took out the self.meta stuff and replaced it with 1 and 0 and it works, i realise what cycle error is now

Wouldn’t this expression:

{someValue} <= 337.5 && {someValue} >= 22.5

Accomplish what you want?

1 Like

Yes, it has been accomplished i am not fluent in how to structure my scripts, yet but with your help i am one step further. Thank you again for your time.

Be careful with terminology. Expression bindings are not scripts. They don't support statements or assignments. Just operators and functions.

1 Like