Sequential Part Number Generator...with a twist

Pickering, John (NORBORD) PICKERIJ@norbord.com
Fri, 18 Feb 2000 14:41:54 -0500


Chris

You don't indicate your platform or file system but the approach is pretty
much the same in any case. You need to make a choice - get the next
sequential number in procedure code associated with the field which needs to
be unique and update the counter then and there - or - generate the number
in either the preupdate or update procedures.

Neither approach is ideal. If you do it with code around the field statement
then you'll have a hard time backing out without leaving gaps in your
numbering sequence. Perhaps you can tell your users to 'get used to it'! If
you leave assigning the number until the user updates then you can't show
the user the generated number other than by info statements or some such.
And to be really sure you'd need to -gasp- modify the update procedure
instead of using the preupdate. And the second method will be ugly if I
understand your requirement is for an *optional* number.

Of course if you have some rdbms that supports stored procedures you could
just let the database do the work.

Good luck!

John Pickering
Toronto

-----Original Message-----
From: Chris Gassett
To: Powerhouse Forum (E-mail)
Sent: 02/18/2000 12:00 PM
Subject: Sequential Part Number Generator...with a twist

The users would like a sequentially generated field.  The field is split
into two sections  XXXXX-XXX (Ex.   000012, 000013-001, 000014,
000014-001,
etc.)  and is handled with three variables.  The first 5 characters is
the
field that is generated sequentially.  In entry mode the user would hit
the
enter key and the next number would be generated automatically and the
cursor would move to the last three digits and the dash in between would
be
displayed or the user can enter up to 5 digits of a previous record to
append to the end of it with three additional characters.  The user has
the
option to enter up to three characters or hit the enter key.  If the
enter
key is pressed without entering data the dash disappears and the second
field is left blank.  My problem is if two people are accesssing this
screen
at one time two or more users can grab the same sequentially generated
number.  What I need to do is do commit the record after the second
field of
three characters is passed.  If anyone knows of something remotely close
to
what I am attempting to do I would greatly appreciate the feedback.
Thanks,
Chris
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
This list is closed, thus to post to the list, you must be a subscriber.