Jump to content

Automate serial number by type

This topic is 7404 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I need to have my serial numbers update with a special designation at the beginning of a particular record. I have several categories of video tape that need to be put into a database. We would like the different types of tape to be designated with a certain code at the begining such as DV- for DV tapes and MINI- for MiniDV. I deally the client would like to be able to select the type of media either from a radio button or a pull down menu, at this point the serial numbering system would auto update the beginning designation to reflect the type of media selected.

Link to comment
Share on other sites

I can think of two ways to do this. One is simpler and doesn't require any scripting, but the number portion of each ID is going to be unique. In other words, you'll have ids like DV1, MINI2, MINI3, DV4, etc. If this is satisfactory, then here's what you do.

Create a field called Number_ID and make it a text field with auto-enter serial number. Create another field called Tape_Type. This is the field that the user uses to select the tape type. Create a third field called Type_Type_ID and make it a calculation field with a text result with the calc:

Tape_Type & Number_ID

If you need ids like DV1, MINI1, MINI2, DV2, then you'll need to use a script.

For each possible type, create a global field called such things as Next_DV_ID, Next_MINI_ID, etc. To begin with, set all of these global fields to 1. If you have the options set up as a radio button, it will be easier to do the script. Each individual radio button will have a button over it that runs the script for that radio button option. Here's the script for the DV option:

Set Field [ Tape_Type, "DV" ]

Set Field [ Tape_Type_ID, Tape_Type & Next_DV_ID ]

Set Field [ Next_DV_ID, Next_DV_ID + 1 ]

You'll need a script like this for every option that can be chosen.


Link to comment
Share on other sites

Another possibility would be a self-relation on the tape_type field. After you have chosen the tape type, you can set the tape id with

SetField (Max(relation::id) + 1)

Then you can put the tape_type and the id together in a other field.

Have fun


Link to comment
Share on other sites

This topic is 7404 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Who Viewed the Topic

    1 member has viewed this topic:
  • Create New...

Important Information

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