Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Id Table Utility - Does one already exist?
Message
From
26/11/2001 15:56:40
 
 
To
26/11/2001 15:35:11
Gil Munk
The Scarborough Group, Inc.
Baltimore, Maryland, United States
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00585561
Message ID:
00585990
Views:
29
>>>Fellow Mere Mortals
>>>
>>>Does anyone out there already have a utility that will cycle thru Id.dbf and for each entry, open the table, order it by it's Primary Key, go to the bottom, get that value, increment it by 1 and then update id.dbf?
>>>
>>>I hate reventing the wheel. Does anyone know if the Stonefield SDT does this?
>>>
>>>Thanks In Advance,
>>
>>Gil,
>>
>>Why would you want to do that? The newid stored procedure does pretty much the same thing, and the id table always stores the next ID to be used. Also, as Kevin pointed out, the id table doesn't alway have to store the primary key value for a table.
>
>James,
>
>I have applications at client's and occasionally I have to correct a problem created by a bug in my software or from them trying to fix things themselves by doing selective restores or any of other possible scenerios where the Id table gets out of sync with the table id's. Have a 'reset' for the ID table would solve the problem and keep the error message 'a record with this information exists...' away.

What I would do is loop through each cursor in your dataenvironment, pull out the primary key, and then run a select on it:

Select max(&lcPrimaryKeyfield) from (lcAlais) into cursor reset

Grab that value, do a seek on the corresponding keyname in the id table and increment the value by 1, depending on what type of primary key it is. You could even grab the increment procedure from the id table and increment it that way. Most ID's are base10 with integer values, which makes things easier if you know that will always be the case. Hope that helps.

Jim
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform