Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generating Sequential Unique Numbers
Message
De
16/08/2001 05:36:01
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
16/08/2001 05:09:50
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00544550
Message ID:
00544570
Vues:
19
>>>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
>
>Hi Cetin,
> Thanks for your reply. I've tried checking for the procedure that increments the ID number in the solutions.app but I've been unsuccessful. Do you know the name of the procedure? And yes, the ID has to be sequential and unique.
>Thanks, Richard.

Rich,
Form name is NewId.scx
In solution.app treeview it's :
Databases\Tables\Create a unique id value for a field

But as said earlier not sequential. To provide it to be sequential you shouldn't use buffering and do not let deletions (than simply directly use recno()).
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform