Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generate Primary Key
Message
From
03/12/2003 12:22:18
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
02/12/2003 23:16:02
General information
Forum:
Visual FoxPro
Category:
The Mere Mortals Framework
Miscellaneous
Thread ID:
00855292
Message ID:
00855496
Views:
15
>Hi,
>I would like to use primary key as document no. like invoice no, po no. and etc. Could you please give me some ideas what customization should be done kbizobj, dataenvironment and ccursor? Should I have two dataenvironment/ccursor in one kbizobj? Any advises?
>
>I want the PK to be fetched on any new record, but NOT increase the value. It should only increase the value during save.
>
>Thank you

Note: I don't work with MM.

The problem here is that two users might get the same key value, since they are adding records at the same time.

What I did (with Visual Extend) is to leave it blank when creating the record. When saving the record, I replace the value, calling the function which does increment the key value.

You can explain the users that you can't have the number before saving, since you don't know who will save first - or whether they will save at all.

The record saving should be within a transaction, so that you can undo changes to your table of sequential numbers.

HTH,

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform