Page 1 of 1 1
Topic Options
#128954 - 2004-11-03 04:01 PM Problem with 'if' and OR logic
misty Offline
Fresh Scripter

Registered: 2004-10-14
Posts: 31
I can't seem to get the syntax right for this. I'm trying to test if someone is in the group Engr or Truss or Receptionist, and if they are in one of those, to do some condition. Here is what I have but it doesn't work:

IF INGROUP("Engr") OR INGROUP("Truss") OR INGROUP("Receptionist")

Top
#128955 - 2004-11-03 04:12 PM Re: Problem with 'if' and OR logic
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Syntactically and logically correct, but you miss the conditional code plus the endif

Only half kidding here, can you show us a bit more ?

Additionally, have you added your user to one of these groups just to test and haven't refreshed the token cache of KiX (hint: run kix32 with /f) ?

If you did refresh the cache, does anything change if you add the domain name to your ingroup statements ?


Edited by Jochen (2004-11-03 04:13 PM)
_________________________



Top
#128956 - 2004-11-03 04:14 PM Re: Problem with 'if' and OR logic
Cybex Offline
Getting the hang of it
*****

Registered: 2004-07-21
Posts: 81
Loc: Brandon, FL.
IF trys every statement so the or is not needed.
Code:
IF INGROUP("Engr")
EndIf
IF INGROUP("Truss")
EndIf
IF INGROUP("Receptionist")
EndIf




Select finds the first true statement and then stops looking.
Code:
 SELECT
CASE expression
statement1
CASE expression
statement2
ENDSELECT


_________________________
Common sense isn't so common.

Top
#128957 - 2004-11-03 04:21 PM Re: Problem with 'if' and OR logic
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Quote:

IF trys every statement so the or is not needed.
Code:
IF INGROUP("Engr")
EndIf
IF INGROUP("Truss")
EndIf
IF INGROUP("Receptionist")
EndIf







Eh? So you promote writing the conditional code 'thrice'
_________________________



Top
#128958 - 2004-11-03 04:28 PM Re: Problem with 'if' and OR logic
Cybex Offline
Getting the hang of it
*****

Registered: 2004-07-21
Posts: 81
Loc: Brandon, FL.
No I was trying to explain that IF keeps steping through and and case can be used if you have only one possible statement that could be true. I wa s not recommending the use of the code as written.
_________________________
Common sense isn't so common.

Top
#128959 - 2004-11-03 04:50 PM Re: Problem with 'if' and OR logic
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Allrighty then
_________________________



Top
#128960 - 2004-11-03 05:26 PM Re: Problem with 'if' and OR logic
Anonymous
Unregistered


IF INGROUP("Engr") or INGROUP("Truss") or INGROUP("Receptionist")
; Make sure the user can run MATLIST -- they need a .get file and it gets
; created automatically if they don't have one (copied from one that works)
IF NOT EXIST("\\corpsrv\data\batch\paths\@USERID.get")
;cp \\corpsrv\data\batch\paths\jenny.get \\corpsrv\data\batch\paths@USERID.get
ENDIF

; The program was written to use a variable that exists in Novell but not NT, so we set it here
SETM "LINAME=@USERID"
? "LINAME set to @USERID" ; for MATLIST program -- look in %L\DATA\BATCH\PATHS\username.get

; Set up drive mappings here (X will go away eventually)
USE L: \\corpsrv\engr
USE G: \\corpsrv\apps
USE Q: \\corpsrv\data
USE U: \\corpsrv\utils
use X: \\corpsrv\X
ENDIF

I get an error in the kixtart script if I have the IF line setup that way. If I take out everything but INGROUP("Engr") it works fine.

Top
#128961 - 2004-11-03 05:29 PM Re: Problem with 'if' and OR logic
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
What's the error then ? Is there a line number specified ?

_________________________



Top
#128962 - 2004-11-03 05:36 PM Re: Problem with 'if' and OR logic
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
No need to OR it unless you have a very old version of KiX. InGroup supports the passing of multiple group names.
Quote:

InGroup( )

Action: Checks whether the current user is a member of a group.

Syntax: INGROUP ("group name" [<,> "group name 2"], mode)

Parameters: Group name, group name 2, group name X…
Identifies the group(s) in which to check the user's membership. You may pass multiple group names as arguments -or- a single array who's element(s) are the names of one or more groups to test. Note: This function does not currently support passing multiple arrays as arguments.





_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#128963 - 2004-11-03 05:46 PM Re: Problem with 'if' and OR logic
Anonymous
Unregistered


As usual I was making it too difficult!! Thank you!
Top
#128964 - 2004-11-03 05:56 PM Re: Problem with 'if' and OR logic
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Anyway the if line shouldn't have thrown an error in the first place ... as said, it was syntactically correct
_________________________



Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.144 seconds in which 0.112 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org