Ewon TechForum
Providing technical solutions to technical requests


Multiple IF ViewON script
ziozetti Offline
Member
#1
I've a problem with ViewON script: some elements in my synoptic have to be coloured in blue if script value is 1.

This script with 2 IF works (copied and pasted code directly from ViewON window):

Code:
IF tagA@ = 1 AND tagB@ = 1 THEN
    viewon! = "1"
ELSE
viewon! = "0"
ENDIF
END

It works also with OR instead of AND.



I can't manage this other script to work: I've 3 IF but I don't know how to nest them.

Code:
IF tagA@ = 1 AND tagB@ = 1 THEN
    viewon! = "1"
ELSE
IF tagA@ = 1 AND tagC@ = 1 THEN
    viewon! = "1"
ELSE
viewon! = "0"
ENDIF
ENDIF
END

I took this forum thread as an example: https://forum.hms-networks.com/t/scripti...won/6244/6
Could you please help me?
Reply

simon Offline
eWON Support
#2
Hi,

Even though it is strange that it does not work, I would not do it this way.

I would rather suggest you use the viewon (java) script for that.

First you create a viewon tag (here named "blueflag") in your view.

.png   1.png (Size: 107,62 KB / Downloads: 14)

Then, you select the view, add a javascript section and use this script :

.png   2.png (Size: 78,51 KB / Downloads: 18)


Code:
var tagA = getEwonTagVal('tagA');
var tagB =getEwonTagVal('tagB');
var tagC =getEwonTagVal('tagC');

if(tagA == 1 && tagB == 1)
  setViewOnTagVal('blueflag', 1);
else
{
    if (tagA == 1 && tagC == 1)
         setViewOnTagVal('blueflag', 1);
    else
         setViewOnTagVal('blueflag', 0);
}
Finally, you use the viewon tag in any of your "blue" object animations
Simon
Reply

ziozetti Offline
Member
#3
Thank you Simon, I never tried java script because... I never "studied" java syntiax nor commands!

I'll try it and I'll be back with a feedback. Smile
Reply



Possibly Related Threads…
8 hours ago
Last Post: Baplu Sam
Today, 01:47 AM
Last Post: AngelaT
19-03-2020, 10:09 AM
Last Post: simon
  Viewon authentication Started by oliviersav
1 Replies - 194 Views
30-01-2020, 01:48 PM
Last Post: simon
  Viewon Started by insyncs
8 Replies - 1.077 Views
22-11-2019, 08:48 PM
Last Post: bryancit
13-11-2019, 03:44 PM
Last Post: Valentin59
  Viewon questions Started by insyncs
7 Replies - 741 Views
30-10-2019, 08:54 PM
Last Post: insyncs
30-10-2019, 10:50 AM
Last Post: LewisH304
15-07-2019, 01:03 PM
Last Post: jswenker
  Compteur ViewOn Started by alimemmi
0 Replies - 399 Views
05-07-2019, 04:41 PM
Last Post: alimemmi



Users browsing this thread:
1 Guest(s)



Theme © Ewon 2019 - Forum software by © MyBB - Cookie policy