Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Auto increment function for non primary key field
Message
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00572783
Message ID:
00577019
Views:
28
>Oscar,
>
>Actually, the NewID() function is designed to generate values for other fields in addition to the primary key field. All you need to do is:
>
>1. Add a new record to the NewID() table for the field. Name it something other than the table name which you normally use for the primary key (for example "Table_MyField").
>
>2. Set the default value of the field to NewID("Table_MyField"). This guarantees that the value will be generated if someone manually adds a record to the table.
>
>3. Add code to the business object to execute NewID()...possibly in the PreSaveHook() of the business object if you don't want to skip IDs.
>
>Regards,
>Kevin

Thanks Kevin!
Previous
Reply
Map
View

Click here to load this message in the networking platform