Page 1 of 1 1
Topic Options
#76969 - 2003-10-02 03:01 PM Help with @WDAYNO and INGROUP
DarthBuck Offline
Fresh Scripter

Registered: 2002-10-20
Posts: 7
Here is what I want to do. On Monday I want to copy files from people that belong to NT group A, on Tuesday I want to copy files from people in NT group B, and so on....

This doesn't work, but maybe someone can provide some insight on how to make it work.

-------------------------
$1 = GROUPA
$2 = GROUPB
$3 = GROUPC

IF INGROUP ("$(@WDAYNO)")
[Do stuff]
ENDIF
---------------------------

Basicly I'm trying to write this efficiantly and not use a bunch of nested IF statements.

D.
p8oust7eh+

Top
#76970 - 2003-10-02 03:08 PM Re: Help with @WDAYNO and INGROUP
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
code:
$groups='','GroupA','GroupB','GroupC'
if @WKDAYNO<ubound($groups)
? 'Copy files for '+$groups(@WKDAYNO)
endif

_________________________
There are two types of vessels, submarines and targets.

Top
#76971 - 2003-10-02 03:08 PM Re: Help with @WDAYNO and INGROUP
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Use an array, they're really not that scary.

code:
$asGroupPerDay="Group1","Group2"...,"GroupLast"
If InGroup($asGroupPerDay[@WDAYNO-1])
...Do your funky thing...
EndIf


Top
#76972 - 2003-10-02 03:08 PM Re: Help with @WDAYNO and INGROUP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
If you have groups created with people in them such as:

WeekDayGroup1..WeekDayGroup7

Then:
code:
IF INGROUP ("WeekDayGroup" + @WDAYNO)
[Do stuff]
ENDIF

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#76973 - 2003-10-02 03:10 PM Re: Help with @WDAYNO and INGROUP
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
I'd second the array solution, but if it scares you too much you could do it as well like this :

break on

$1 = GROUPA
$2 = GROUPB
$3 = GROUPC

$_ = execute("$$TodaysGroup=$$@wdayno")

if ingroup($TodaysGroup)
;do stuff
endif
_________________________



Top
#76974 - 2003-10-02 03:10 PM Re: Help with @WDAYNO and INGROUP
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Yeah, it's slow-traffic time at KORG again, and the KiXcoders are hunting down posts they can answer [Wink] Three posts at the same time with two different solutions. Howard's solution is the most scalable as it requires no script modification when new groups should be assigned to specific backup cycles.
_________________________
There are two types of vessels, submarines and targets.

Top
#76975 - 2003-10-06 01:42 PM Re: Help with @WDAYNO and INGROUP
DarthBuck Offline
Fresh Scripter

Registered: 2002-10-20
Posts: 7
Thanks all for the replys. Howard's script would be perfect if I was able to add NT groups. It would also eliminate the need to ask the next question.

Here is what I'm going with:

code:
$groupArray = "GroupA","GroupB"..."GroupH"
IF INGROUP ($groupArray[@wdayno-1])
[do stuff]
ENDIF

My problem is that I have 8 goups and only 5 days people login. Any suggestions on how to combine 4 goups into 1 for the INGROUP?

D.

Top
#76976 - 2003-10-06 01:52 PM Re: Help with @WDAYNO and INGROUP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Dim $Group[7]
$Group[0] = ""
$Group[1] = "Group1","Group2","Group3","Group4"
$Group[2] = "Group5"
$Group[3] = "Group6"
$Group[4] = "Group7"
$Group[5] = "Group8"
$Group[6] = ""
$Group[7] = ""

for $weekday=1 to 7
if vartype($Group[$weekday]) = 8192
for each $Grp in $Group[$weekday]
if INGROUP($Grp)
Do Something...
endif
next
else
if INGROUP($Group[$weekday])
Do Something...
endif
endif
next


[ 06. October 2003, 19:51: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#76977 - 2003-10-06 05:41 PM Re: Help with @WDAYNO and INGROUP
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

In above post foreach should be of course for each.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

Top
#76978 - 2003-10-06 07:52 PM Re: Help with @WDAYNO and INGROUP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Corrected the "foreach" to "for each"
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#76979 - 2003-10-07 04:26 PM Re: Help with @WDAYNO and INGROUP
DarthBuck Offline
Fresh Scripter

Registered: 2002-10-20
Posts: 7
Thanks Howard. I had to make one little change though. The

code:
 for $weekday=1 to 7

loop did the stuff every day. Here is what I ended up with:

code:
 
Dim $Group[7]
$Group[0] = ""
$Group[1] = "Group1","Group2","Group3","Group4"
$Group[2] = "Group5"
$Group[3] = "Group6"
$Group[4] = "Group7"
$Group[5] = "Group8"
$Group[6] = ""
$Group[7] = ""


$weekday = @WDAYNO
if vartype($Group[$weekday]) = 8192
for each $Grp in $Group[$weekday]
if INGROUP($Grp)
Do Something...
endif
next
else
if INGROUP($Group[$weekday])
Do Something...
endif
endif



Thanks again to all.

Top
#76980 - 2003-10-07 05:01 PM Re: Help with @WDAYNO and INGROUP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Glad to hear that it worked for you. Incidentally, the loop was necessary in the prototype code to test since I did not plan on waiting a week for the results. [Wink]

[ 07. October 2003, 17:02: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
Page 1 of 1 1


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

Who's Online
1 registered (mole) and 1300 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.049 seconds in which 0.018 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