Re: DataMiner - Number of rows in a table? [message #15845 is a reply to message #15782] |
Tue, 15 June 1999 00:00  |
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
>
>
|
|
|