Welcome! Log In Create A New Profile

Advanced

Last ID in a file...

Posted by DarrenF 
DarrenF
Last ID in a file...
November 11, 2008 02:53AM
Hi guys,

Another basic newbie question:

If a have an auto ID (unique key) in a file, what's the best way to find what the highest/last ID is?

I tried HSeekLast, but what "Sought Value" do you use? I don't want a sought value... I just want the last ID in the file using the ID index - why do you need a sought value? :confused:

Cheers...
Al
Re: Last ID in a file...
November 11, 2008 04:20AM
Hello Darren

The HreadSeekLast will return the last ID of the nominated index so you have to nominate which index it should use. The AutoID feature is not a record number it is a generated number and may be different from the last physical record number.

If you have an index on surname then HreadSeekLast(MyFile,SurnameIndex) will return the alphabetic last name "ZOOLANDER" - maybe

So when you want the last AutoID number used then you must specify its index name
HreadSeekLast(MyFile,AutoIDKeyIndex)

Regards
Al
Carlo Hermus
Re: Last ID in a file...
November 11, 2008 08:08AM
Darren,

Just use Hreadlast(Filename)

it will point directly to the last record in the file.




Edited 1 time(s). Last edit at 11/11/2008 08:08AM by Carlo Hermus.
DarrenF
Re: Last ID in a file...
November 11, 2008 10:58AM
Thanks guys... I'll try your suggestions later... :spos:
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: