Is there a better way > Auto Enter Serial Number in FMPro 9?

Is there a better way > Auto Enter Serial Number in FMPro 9?

am 29.09.2007 20:26:52 von EJay Corvette

I've been searching for a couple days now for the solution to
resetting the "Record Number" in my database. The Record Number is a
Serial Number and should increment by 1.

The problem I'm having is whenever a record is deleted (usually the
last record entered), my numbering is off, and I have to manually
reset the Serial Number before someone inadvertantly starts a new
record.

For example, if my records are 09, 10, 11, 12, and record 12 is
deleted, the Serial Number will then install 13 as the next available
record number.

I was able to locate this simple looking enough script from the web:

Enter Browse Mode []
Allow User Abort [Off]
Show All Records
Unsort Records
Go to Record/Request/Page [Last]
Set Next Serial Value [Client Records::Record No + 1]

The problem is, I can't get it to work. Anybody out there have a
solution?

Thanks in advance!

Re: Is there a better way > Auto Enter Serial Number in FMPro 9?

am 29.09.2007 23:36:06 von bill

In article <1191090412.467589.171720@r29g2000hsg.googlegroups.com>,
EJay Corvette wrote:

> I've been searching for a couple days now for the solution to
> resetting the "Record Number" in my database. The Record Number is a
> Serial Number and should increment by 1.
>
> The problem I'm having is whenever a record is deleted (usually the
> last record entered), my numbering is off, and I have to manually
> reset the Serial Number before someone inadvertantly starts a new
> record.
>
> For example, if my records are 09, 10, 11, 12, and record 12 is
> deleted, the Serial Number will then install 13 as the next available
> record number.
>
> I was able to locate this simple looking enough script from the web:
>
> Enter Browse Mode []
> Allow User Abort [Off]
> Show All Records
> Unsort Records
> Go to Record/Request/Page [Last]
> Set Next Serial Value [Client Records::Record No + 1]
>
> The problem is, I can't get it to work. Anybody out there have a
> solution?
>
> Thanks in advance!

First, why do you want to do this?

If you are using the serial number as a key field in relationship, it is
a very bad idea to do anything other than let the database automatically
assign the serial number with no intervention to change the sequence.
What is important for this purpose is that the serial number of each
record be unique, and that it not change. Gaps in the numbers are of
absolutely no consequence. Running a script to change the next serial
value could produce an error so that you get duplicate serial numbers,
which would destroy the uniqueness of any relationship based on that.

So apparently you have some other reason for doing this. If we knew the
reason that might help.

If you simply want to know the sequence number of a record in the
current sort in the current found set, the function
Get(RecordNumber) will do the trick.

If you really want to do what you say, then I suggest that rather then
Unsort, you sort by the record number, ascending, then go to the last
record and assign the next serial value. That will pretty positively
assure you get the next value assigned right so as to avoid duplicates.

--
For email, change to
Bill Collins

Re: Is there a better way > Auto Enter Serial Number in FMPro 9?

am 29.09.2007 23:45:31 von d-42

On Sep 29, 11:26 am, EJay Corvette wrote:
> I've been searching for a couple days now for the solution to
> resetting the "Record Number" in my database. The Record Number is a
> Serial Number and should increment by 1.
>
> The problem I'm having is whenever a record is deleted (usually the
> last record entered), my numbering is off, and I have to manually
> reset the Serial Number before someone inadvertantly starts a new
> record.
>
> For example, if my records are 09, 10, 11, 12, and record 12 is
> deleted, the Serial Number will then install 13 as the next available
> record number.
>
> I was able to locate this simple looking enough script from the web:
>
> Enter Browse Mode []
> Allow User Abort [Off]
> Show All Records
> Unsort Records
> Go to Record/Request/Page [Last]
> Set Next Serial Value [Client Records::Record No + 1]
>
> The problem is, I can't get it to work. Anybody out there have a
> solution?

Well, the allow user abort is superfluous. The rest of the script
looks fine; except that it appears that you haven't specified which
field to set next serial value. You've told it what to set it *to*,
but not what to set.

The bigger question is -why- are you doing this? The need to reset
serial numbers, except after an import, is usually a design error.
There are cases where its justified. But for the most part, we only
require that serial numbers be unique, not sequential with no gaps in
the numbers.

An exception, for example, might be invoice numbers, where you don't
want gaps, but in that case its usually better not to be able to
delete records at all, period. If a record is created that you don't
want, mark it as void. Or alternatively, don't assign it an invoice
number until you are sure you want to keep it. (Assign it an order
number or reference number until your sure its a keeper.)

-cheers,
Dave

Re: Is there a better way > Auto Enter Serial Number in FMPro 9?

am 30.09.2007 21:00:36 von Grip

On Sep 29, 11:45 pm, d-42 wrote:
> On Sep 29, 11:26 am, EJay Corvette wrote:
>
>
>
> > I've been searching for a couple days now for the solution to
> > resetting the "Record Number" in my database. The Record Number is a
> > Serial Number and should increment by 1.
>
> > The problem I'm having is whenever a record is deleted (usually the
> > last record entered), my numbering is off, and I have to manually
> > reset the Serial Number before someone inadvertantly starts a new
> > record.
>
> > For example, if my records are 09, 10, 11, 12, and record 12 is
> > deleted, the Serial Number will then install 13 as the next available
> > record number.
>
> > I was able to locate this simple looking enough script from the web:
>
> > Enter Browse Mode []
> > Allow User Abort [Off]
> > Show All Records
> > Unsort Records
> > Go to Record/Request/Page [Last]
> > Set Next Serial Value [Client Records::Record No + 1]
>
> > The problem is, I can't get it to work. Anybody out there have a
> > solution?
>
> Well, the allow user abort is superfluous. The rest of the script
> looks fine; except that it appears that you haven't specified which
> field to set next serial value. You've told it what to set it *to*,
> but not what to set.
>
> The bigger question is -why- are you doing this? The need to reset
> serial numbers, except after an import, is usually a design error.
> There are cases where its justified. But for the most part, we only
> require that serial numbers be unique, not sequential with no gaps in
> the numbers.
>
> An exception, for example, might be invoice numbers, where you don't
> want gaps, but in that case its usually better not to be able to
> delete records at all, period. If a record is created that you don't
> want, mark it as void. Or alternatively, don't assign it an invoice
> number until you are sure you want to keep it. (Assign it an order
> number or reference number until your sure its a keeper.)
>
> -cheers,
> Dave

What are the circumstances in which you use Allow User Abort?

G

Re: Is there a better way > Auto Enter Serial Number in FMPro 9?

am 30.09.2007 22:23:34 von bill

In article <1191178836.479672.283070@d55g2000hsg.googlegroups.com>,
Grip wrote:

> On Sep 29, 11:45 pm, d-42 wrote:
> > On Sep 29, 11:26 am, EJay Corvette wrote:
> >
> >
> >
> > > I've been searching for a couple days now for the solution to
> > > resetting the "Record Number" in my database. The Record Number is a
> > > Serial Number and should increment by 1.
> >
> > > The problem I'm having is whenever a record is deleted (usually the
> > > last record entered), my numbering is off, and I have to manually
> > > reset the Serial Number before someone inadvertantly starts a new
> > > record.
> >
> > > For example, if my records are 09, 10, 11, 12, and record 12 is
> > > deleted, the Serial Number will then install 13 as the next available
> > > record number.
> >
> > > I was able to locate this simple looking enough script from the web:
> >
> > > Enter Browse Mode []
> > > Allow User Abort [Off]
> > > Show All Records
> > > Unsort Records
> > > Go to Record/Request/Page [Last]
> > > Set Next Serial Value [Client Records::Record No + 1]
> >
> > > The problem is, I can't get it to work. Anybody out there have a
> > > solution?
> >
> > Well, the allow user abort is superfluous. The rest of the script
> > looks fine; except that it appears that you haven't specified which
> > field to set next serial value. You've told it what to set it *to*,
> > but not what to set.
> >
> > The bigger question is -why- are you doing this? The need to reset
> > serial numbers, except after an import, is usually a design error.
> > There are cases where its justified. But for the most part, we only
> > require that serial numbers be unique, not sequential with no gaps in
> > the numbers.
> >
> > An exception, for example, might be invoice numbers, where you don't
> > want gaps, but in that case its usually better not to be able to
> > delete records at all, period. If a record is created that you don't
> > want, mark it as void. Or alternatively, don't assign it an invoice
> > number until you are sure you want to keep it. (Assign it an order
> > number or reference number until your sure its a keeper.)
> >
> > -cheers,
> > Dave
>
> What are the circumstances in which you use Allow User Abort?
>
> G

Often considered good practice in a database designed for use by
database customers. Helps to prevent the customer from interrupting a
script and thus ending up in some place not familiar to the him/her and
from which he/she does not know how to get back where he/she started.

--
For email, change to
Bill Collins

Re: Is there a better way > Auto Enter Serial Number in FMPro 9?

am 30.09.2007 22:39:28 von d-42

On Sep 30, 12:00 pm, Grip wrote:
> On Sep 29, 11:45 pm, d-42 wrote:
>
>
>
> > On Sep 29, 11:26 am, EJay Corvette wrote:
>
> > > I've been searching for a couple days now for the solution to
> > > resetting the "Record Number" in my database. The Record Number is a
> > > Serial Number and should increment by 1.
>
> > > The problem I'm having is whenever a record is deleted (usually the
> > > last record entered), my numbering is off, and I have to manually
> > > reset the Serial Number before someone inadvertantly starts a new
> > > record.
>
> > > For example, if my records are 09, 10, 11, 12, and record 12 is
> > > deleted, the Serial Number will then install 13 as the next available
> > > record number.
>
> > > I was able to locate this simple looking enough script from the web:
>
> > > Enter Browse Mode []
> > > Allow User Abort [Off]
> > > Show All Records
> > > Unsort Records
> > > Go to Record/Request/Page [Last]
> > > Set Next Serial Value [Client Records::Record No + 1]
>
> > > The problem is, I can't get it to work. Anybody out there have a
> > > solution?
>
> > Well, the allow user abort is superfluous. The rest of the script
> > looks fine; except that it appears that you haven't specified which
> > field to set next serial value. You've told it what to set it *to*,
> > but not what to set.
>
> > The bigger question is -why- are you doing this? The need to reset
> > serial numbers, except after an import, is usually a design error.
> > There are cases where its justified. But for the most part, we only
> > require that serial numbers be unique, not sequential with no gaps in
> > the numbers.
>
> > An exception, for example, might be invoice numbers, where you don't
> > want gaps, but in that case its usually better not to be able to
> > delete records at all, period. If a record is created that you don't
> > want, mark it as void. Or alternatively, don't assign it an invoice
> > number until you are sure you want to keep it. (Assign it an order
> > number or reference number until your sure its a keeper.)
>
> > -cheers,
> > Dave
>
> What are the circumstances in which you use Allow User Abort?

Most of the time Allow User Abort should be off. You don't normally
want users to abort your script in mid-execution.

Typically you'd only want to allow abort if the script is going to
take a long time to run, and you want to give users an out, or during
design/testing/debugging, when you don't want to to have to wait for a
script to finish, or worse, get yourself into an infinite loop.

I said the step was superfluous because it wasn't relevant to the
issue at hand.

-dave