Page 1 of 1 1
Topic Options
#143316 - 2005-07-10 12:15 PM setting logon hours for a group
briannz556 Offline
Getting the hang of it

Registered: 2002-05-03
Posts: 64
Loc: new zealand
Hi There
I'm putting together a kixform that sets allow/deny logon hours for a group of students in AD.

I need to be able to cycle through 25 checkboxes on a kixform and action a function call whenever a checkbox is ticked. The boxes are named $CheckBox1 to $CheckBox25. Is it possible to convert a string into a variable name? If so, how?

For example, it would be nice to be able to do:

Code:

for $day = 1 to 5
for $period = 1 to 5
if somefunction('$$' + 'CheckBox' + Val(5*$day + $period - 5) +'.value') <> ''
action()
endif
next
next



But I'm not sure if "somefunction" exists or even if this is possible?

Can someone offer any ideas?

Cheers

Top
#143317 - 2005-07-10 03:35 PM Re: setting logon hours for a group
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Somefunction is something you'd write yourself, thus you should know whether it exists.

Edited by sealeopard (2005-07-10 04:43 PM)
_________________________
There are two types of vessels, submarines and targets.

Top
#143318 - 2005-07-10 04:23 PM Re: setting logon hours for a group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I don't get it. Regardless of which checkbox is checked, your psuedo-code would perform the same action since there is only one action in the loop. That, and correct me if I am wrong, but I don't think checkbox has a value property.

What I think you need to do is to check the checkbox.checked property on each one and perform the specific action accordingly.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#143319 - 2005-07-10 04:27 PM Re: setting logon hours for a group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
BTW, you can build dynamic $CheckBoxX.checked code constructs using Execute() but as I mentioned above, I don't see the point in it since at some stage in the code you will have to enumerate them individually anyway.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#143320 - 2005-07-10 04:43 PM Re: setting logon hours for a group
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Adn you should always use
Code:

$rc=setoption('NoVarsInStrings','ON')


as it makes coding KiXforms scripts a lot easier.
_________________________
There are two types of vessels, submarines and targets.

Top
#143321 - 2005-07-10 05:28 PM Re: setting logon hours for a group
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
check out the Execute() Function

For example (not tested at all)
Code:

for $j = 1 to 25
$ = Execute("$$checked = $$Checkbox" + $j + ".Checked")
if $checked
? "Checkbox" + $j + " is checked"
else
? "Checkbox" + $j + " is not checked"
endif
next


Top
#143322 - 2005-07-10 05:45 PM Re: setting logon hours for a group
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Hmmm...
NoVarsInStrings non-compliant...

How far is Pittsburgh from Boston?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#143323 - 2005-07-10 06:20 PM Re: setting logon hours for a group
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
a safe distance away
Top
#143324 - 2005-07-10 08:12 PM Re: setting logon hours for a group
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just change:
$ = Execute("$$checked = $$Checkbox" + $j + ".Checked")

to:
$ = Execute("$"+"checked = $"+"Checkbox" + $j + ".Checked")

and it is compliant.
actually, I think kixtart acts wrong there.
even though no vars in strings is turned on, double dollar should be translated to single, just like manual says.
_________________________
!

download KiXnet

Top
#143325 - 2005-07-11 12:45 AM Re: setting logon hours for a group
briannz556 Offline
Getting the hang of it

Registered: 2002-05-03
Posts: 64
Loc: new zealand
Thanks for that Maciep (and Lonkero for correction). Just what i didn't know and works as required.

As to Les's comment, I was trying to show what the construct was that i wanted NOT the exact use for the construct. Sorry if it fazed you.

Appreciate all the excellent thoughts.

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 557 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.06 seconds in which 0.025 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