comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » DataMiner - Number of rows in a table?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
DataMiner - Number of rows in a table? [message #15782] Mon, 14 June 1999 00:00 Go to next message
Calvin King is currently offline  Calvin King
Messages: 3
Registered: June 1999
Junior Member
Fellow IDL Users:

I checked in the 'IDL DataMiner Guide' to see if there is a simple way
to determine the number of rows in a table and I couldn't find any.
Hence, I am using the 'IDLdbRecordset::MoveCursor' function to count the
number of rows as follows:
status = objRS->MoveCursor(/First)
count = 1
status = objRS->MoveCursor(/Next)
WHILE (status EQ 1) DO BEGIN
count = count + 1
status = objRS->MoveCursor(/Next)
ENDWHILE
I am using the value of 'count' from above to initialize an array, and
then reading into this array values from a table as follows:
status = objRS->MoveCursor(/First)
x = FLTARR(count)
y = FLTARR(count)
FOR I = 0, count-1 DO BEGIN
x[i] = objRS->GetField(0)
y[i] = objRS->GetField(1)
status = objRS->MoveCursor(/Next)
ENDFOR

Is there a better way (takes less time) to carry out the above task?
BTW, for my application the value of count is often > 10K.

Thanks for any ideas or suggestions!

Calvin
Email: cking@sandia.gov
Re: DataMiner - Number of rows in a table? [message #15842 is a reply to message #15782] Wed, 16 June 1999 00:00 Go to previous message
Dick Jackson is currently offline  Dick Jackson
Messages: 347
Registered: August 1998
Senior Member
Calvin King wrote:
>
> Fellow IDL Users:
>
> I checked in the 'IDL DataMiner Guide' to see if there is a simple way
> to determine the number of rows in a table and I couldn't find any.

The online help for IDLdbRecordset::CurrentRecord suggests that with
*some* drivers, you can position yourself to the last record with
IDLdbRecordset::MoveCursor, /Last
then call
number = RSobj->CurrentRecord()
to get the record number. Does this work for you?

Cheers,
--
-Dick

Dick Jackson Fanning Software Consulting, Canadian Office
djackson@dfanning.com Calgary, Alberta Voice/Fax: (403) 242-7398
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Re: DataMiner - Number of rows in a table? [message #15845 is a reply to message #15782] Tue, 15 June 1999 00:00 Go to previous message
Andrew Kraus is currently offline  Andrew Kraus
Messages: 7
Registered: May 1999
Junior Member
I have had a similar need and the way I decided to go was to add an COUNT
field to the table.
That way I could go to the last record and pull the value from the COUNT
field. However, I can think of several
applications where this approach is limiting, so it may not be right for
you.

Calvin King <cking@sandia.gov> wrote in article
<3765330E.58DB5435@sandia.gov>...
> Fellow IDL Users:
>
> I checked in the 'IDL DataMiner Guide' to see if there is a simple way
> to determine the number of rows in a table and I couldn't find any.
> Hence, I am using the 'IDLdbRecordset::MoveCursor' function to count the
> number of rows as follows:
> status = objRS->MoveCursor(/First)
> count = 1
> status = objRS->MoveCursor(/Next)
> WHILE (status EQ 1) DO BEGIN
> count = count + 1
> status = objRS->MoveCursor(/Next)
> ENDWHILE
> I am using the value of 'count' from above to initialize an array, and
> then reading into this array values from a table as follows:
> status = objRS->MoveCursor(/First)
> x = FLTARR(count)
> y = FLTARR(count)
> FOR I = 0, count-1 DO BEGIN
> x[i] = objRS->GetField(0)
> y[i] = objRS->GetField(1)
> status = objRS->MoveCursor(/Next)
> ENDFOR
>
> Is there a better way (takes less time) to carry out the above task?
> BTW, for my application the value of count is often > 10K.
>
> Thanks for any ideas or suggestions!
>
> Calvin
> Email: cking@sandia.gov
>
>
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Automatic structure definition..
Next Topic: Re: Importing nested structures?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:49:01 PDT 2025

Total time taken to generate the page: 0.01557 seconds