Page 1 of 1 1
Topic Options
#99616 - 2003-03-15 02:11 AM I need a ubound of a object handle
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I'm doing
$Computers = GetObject($ldap)
for each $item in $computers
next

but I need to know how many objects are in $computers first... I want to put a progressbar integral to the for each.

$max=ubound($computers) doesn't work

[ 15. March 2003, 02:12: Message edited by: Radimus ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99617 - 2003-03-15 02:18 AM Re: I need a ubound of a object handle
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
My, you're feeling awfuly "needy" this evening. [Big Grin]

First thought is brute force..
code:
 
$iCnt = 0
For Each $ in $Computers
$iCnt = $iCnt + 1
Next
"Found $iCnt computers..."

But isn't $Computers an ordinary array? Any idea why UBound() won't work?

Gotta go raise my sugar level before I give ya any more brain cells.

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
#99618 - 2003-03-15 02:28 AM Re: I need a ubound of a object handle
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
How about
code:
$Computers = GetObject($ldap)
$count=$computers.Count



[ 15. March 2003, 02:28: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#99619 - 2003-03-15 02:38 AM Re: I need a ubound of a object handle
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I've tried:

$Computers = GetObject($area)
? $computers.count
? ubound($computers)
$max=0 for each $c in $computers $max=$max+1 next

the for each works, but it is kludgy...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#99620 - 2003-03-15 02:46 AM Re: I need a ubound of a object handle
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Yes, the ubound will definitely not work as it's not an array. The .Count should work for anything that has been retrieved via WQL query in synchronus mode. It will not work in semi-synchronous or asynchronous mode. I actually do
code:
$Computers = GetObject($area)
dim $comparray
for each $c in $computers
redim $comparray[ubound($comparray)+1]
$comparray[ubound($comparray)]=$c
next
? ubound($comparray)

This way I end up with an array or objects, e.g. $comparray[0].value (I believe). Check the ReadEventlog() UDF, I'm using it in there.
_________________________
There are two types of vessels, submarines and targets.

Top
#99621 - 2003-03-15 02:54 AM Re: I need a ubound of a object handle
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Anybody good at using ADO and LDAP SQL dialect? Can one "select count from a collection"?

Example SQL dialect:

Select ADsPath, cn FROM 'LDAP://O=Internet/DC=COM/DC=ARCADIABAY/DC=ARCADIADEV' where objectClass='group'
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#99622 - 2003-03-15 03:02 AM Re: I need a ubound of a object handle
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Maybe
code:
Select Count(ADsPath) FROM 'LDAP://O=Internet/DC=COM/DC=ARCADIABAY/DC=ARCADIADEV' where objectClass='group'

?

Just shooting from the hip [Smile]
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.056 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