Jump to content
Sign in to follow this  
Jarvis

Resetting Serial Numbers

Recommended Posts

I have an automatic numbering field that uses the serial number option.

I would like the user to be able to reset this serial number to (1) without having to access the DEFINE FIELDS dialog box.

Is there a script I can produce to do this?

Thanks!

Share this post


Link to post
Share on other sites

You could use the Replace function.

Place your cursor in the serial number field, then go to Menu - Records - Replace (Cmd = on a Mac)

It can also be script to a button.

BTW, hope these numbers have no effect on relationships, etc.

HTH

Lee

smile.gif

Share this post


Link to post
Share on other sites

also...make sure you SORT before you repleacing anything...if you records are sorted to some previous need those serials migh be of...so:

1

4

7

8

if you repleace it with 1---1000 they will carry:

1

2

3

4

5

6.....

which, as Lee said can trigger a LOT of truble and especially if you relations depend on it.

All the best!

Share this post


Link to post
Share on other sites

There is a script step, Set Next Serial Value. Point it to your serial number field, and put 1 in for the calculation.

You have to be aware that resetting the serial number, while leaving the numbers for existing records, does not make a lot of sense usually.

Any relationships based on it will fail, because you're going to have duplicates.

That script step is usually used after deleting all records, to begin again fresh. Or after importing data into a clone, to update a file.

In the later case it's usually used like this (my field is "SeriaID", the original file is "Data.fp5"):

Set Next Serial Value ["SerialID", "GetNextSerialValue ("Data.fp5", "SerialID")"]

Lee's method of using Replace could "reserialize" all the numbers, for existing found records (should be all in this case).

What exactly are you trying to do with this?

Share this post


Link to post
Share on other sites

Well,

Besides Lee's last commentary about relationship, I must say I always wondered why we would ever let the user set these kind of things....and when we would have to use this script step apart when developping the db !

Share this post


Link to post
Share on other sites

Hi Ugo,

I'm for locking them users out completely, it sure would save us a lot problems and make our jobs a lot easier.

smile.gif

Oh, oh, just remember that won't work, frown.gif after all, that's why they pay us the BIG BUCKS. Besides, I guess they do need to have limited access to enter things such as names, addresses, phone numbers, etc.

So, if they want a serial number that they can control, then give them one. ONLY, just make sure it has nothing to do with how the files work.

smile.gif

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.