Is there a way to compare to strings in an expression language?
I just want to compare my local ip in the system network tag to specific ip in string format and enable/disable a button in vision based on the result.
The docs should be pretty clear that it’s a simple comparison using =
.
<your_ip> = "10.10.10.10"
No special function is needed.
In Perspective, the comparison would be done like this (although keep in mind that you might get a machine name instead of the IP):
Thanks for your input But I am using vision 8.0.15
I tried this with an expression tag like this
if ( {[System]Client/Network/IPAddress.Value} = “10.156.54.238” ,1,0)
seems like could not compare strings
You can just use {[System]Client/Network/IPAddress} = "10.156.54.238"
or ! =
Yeah, I tried this too without the if condition but the error is the same as the second attachment above.
with an error message as below
[false, Bad_NotFound, Fri Mar 12 17:04:54 IST 2021 (1615548894049)]
The problem isn’t string comparison. You are trying to use a tag that doesn’t exist in gateway context in an expression tag.
Adding to Phil’s comment, you need to make your expression tag in ‘Vision Client Tags’
Thanks, pturmel and Jordan !
Now able to compare after creating this expression in the client tag.