#207376 - 2013-05-29 12:19 PM
Weird Issue
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
I'm trying to do a simple If statement, but kix seems to validate this all the time, here's the Example:
If NOT InGroup("Some group") OR @WKSTA="PCNAME"
? "Condition met"
Else
? "Condition not met"
EndIf
Now the InGroup evaluates fine, but you can change PCNAME to anything you want, and it'll always evaluate to "Condition met"
|
|
Top
|
|
|
|
#207381 - 2013-05-29 04:11 PM
Re: Weird Issue
[Re: Allen]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
Nope. I need "NOT InGroup"
|
|
Top
|
|
|
|
#207385 - 2013-05-30 11:55 AM
Re: Weird Issue
[Re: Arend_]
|
Arend_
MM club member
   
Registered: 2005-01-17
Posts: 1896
Loc: Hilversum, The Netherlands
|
I am mistaken Lonk, your solution DOES work. Thanks!
|
|
Top
|
|
|
|
#207391 - 2013-06-04 12:31 PM
Re: Weird Issue
[Re: Arend_]
|
BradV
Seasoned Scripter
  
Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
|
Are you sure? It's been a long time since I had my logic class, but your original code looks correct to me. If I understand your statement, you need the condition to be true if the user is not a member of a particular group or if the workstation name is a given name.
So simple truth table:
In Group PCNAME=
0 0
0 1
1 0
1 1
If we NOT the In Group and then or the results:
Not In Group PCNAME= OR
1 0 1
1 1 1
0 0 0
0 1 1
Which is what Allen pointed out. If the person is not in the group, the condition is met. If the person is in the group and the workstation name is the given pcname, the condition is met. If the person is in the group and the workstation name is not the given pcanme, the condition is not met. That seems exactly correct.
Looking at Lonk's code would give (remember we are first OR'ing the values and then NOT'ing the OR'd value):
In Group PCNAME= OR NOT
0 0 0 1
0 1 1 0
1 0 1 0
1 1 1 0
Which says the condition is only met when the person is not in the group and the workstation name is not pcname.
Did I miss something?
|
|
Top
|
|
|
|
#207393 - 2013-06-04 02:48 PM
Re: Weird Issue
[Re: BradV]
|
Henriques
Fresh Scripter
Registered: 2007-09-13
Posts: 43
|
To me it's like this If NOT InGroup("Some group") OR @WKSTA="PCNAME" ? "Condition met" Else ? "Condition not met" EndIf
the or statement is of a higher order so what happens is this If NOT ( InGroup("Some group") OR @WKSTA="PCNAME" ) What you want is possibly If ( NOT InGroup("Some group") ) OR ( @WKSTA="PCNAME" )
|
|
Top
|
|
|
|
#207394 - 2013-06-04 04:25 PM
Re: Weird Issue
[Re: Henriques]
|
BradV
Seasoned Scripter
  
Registered: 2006-08-16
Posts: 687
Loc: Maryland, USA
|
Yes, If ( NOT InGroup("Some group") ) OR ( @WKSTA="PCNAME" ) is how I was interpreting it.
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Henriques)
and 2516 anonymous users online.
|
|
|