Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generating Sequential Unique Numbers
Message
From
16/08/2001 04:03:28
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
16/08/2001 02:47:56
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00544550
Message ID:
00544560
Views:
20
>Hi all,
> I have a textbox in a form (it's the first on the form) and I want to populate it with sequential numbers which should be unique whenever someones makes an entry. DOes anyway know how I should go about this? A prg maybe? And another question ....... can the form be used by more than one person? If so what are the properties of the table that I should check?
>Thanks all in advance.
>
>Cheers, Rich.

Richard,
Sequential is a must ? Otherwise check nextid in solution.app. Basically what it does is to keep tablename and nextid in an ids table. Whenever you want to add a new record you call a stored procedures function that returns you nextid and increments it there for a given table. It's thus unique but might not be sequential because with table buffering say a user gets 5 but doesn't save record, thus 5 is not in records. It's just for supplying values that has no meaning to end user but serves as a PK value.

Multiuser is not a few lines of reply case but just to keep it simple for entry level :
add :
set multilocks on
set exclusive off
to form.load.
Just by doing this you're in a way gone multiuser.
Buffering is up to you and what's suggested is at least using an optimistic row buffering (3) for tables.
If you create a wizard form (using wizards is not suggested but as a starter to understand) it takes care of it for you.
You can test how it would do by running 2 instances of VFP on same machine. Run the same form or app to mimic a multiuser system on a network (not a true mimic but almost).

For a detailed guide read 'Programming for shared access" section on online help.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform