counting an xtree

Post Reply
galderman
Posts: 9
Joined: Mon Jun 04, 2001 1:00 pm

counting an xtree

Post by galderman »

What's the fastest way to count the total number of entries in an xtree?

<xtree DUMP foobar><count $ret> is easy to write, but seems like overkill when it actually results in a variable with thousands of values.
User avatar
Kai
Site Admin
Posts: 1272
Joined: Tue Apr 25, 2000 1:27 pm

counting an xtree

Post by Kai »

<xtree ROW DUMP foobar></xtree> <$ret = $loop>

This is faster and avoids the mem usage (via ROW) of setting a large return variable. This syntax assumes a Sep. 24 1999 or later Vortex version.
galderman
Posts: 9
Joined: Mon Jun 04, 2001 1:00 pm

counting an xtree

Post by galderman »

aha! many thanks. The memory usage was exactly what I was trying to avoid. I just had a brain fade and forgot about the $loop variable. I started to put my own
incrementing counter inside the <xtree></xtree> loop, but thought there **had** to be a better way.

cheers.
Post Reply