Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Id Table Utility - Does one already exist?
Message
From
26/11/2001 16:49:30
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:
00586047
Views:
34
>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

Thanks, Jim. I did start thinking about this in this way and I've decided to modify the dbManageform class (modify a subclass of it) to do add a couple of checks as well:
Ask if Character keys to be incremented are padded left with zeros or spaces or not padded;
Check if the row exists in Id - if default value is 'newid()' add it if missing (this is great for adding new tables or changing existing tables);
Check for multiple entries for the table in case of more than one field asking to be incremented.
Gil Munk


"If a nation expects to be ignorant and free, it expects what never was and never will be." - Thomas Jefferson
Previous
Reply
Map
View

Click here to load this message in the networking platform