Jump to content
Server Maintenance This Week. ×

User input to start a serial number field


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

Recommended Posts

I am trying to make a few templates that I can cut and paste into new databases. What I have done is creat a NOTES table, where it has a few fields to personalize the global fields in the solution. Is there a way to have the user (or me) input into a field the starting number in an auto filled, serialized field without having to go into the properties of the difined field? For example, I would like to fill in a field in NOTES named Starting Serial Number, and have the field Computer.Info::ID NUMBER start serializing based on the value of NOTES::Starting Serial Number

Does that make any sense?

Thank you in advance for any help with this!

Link to comment
Share on other sites

The only way I know of in v6 of FMP to update the serial number option without defining fields is to use the Replace Contents... menu command. Using this you can check the option to update the field's serial number option after inputting the serial number information of your choosing.

The same should hold true for v7.

If this option is not what you are looking for and there is no way in v7 of filemaker to update the next serial number option from a script command you do still have another option:

The best way to approach this is to create what I call a control table.

Example:

Create a table called "CONTROL" with a calculation field:

field name "cLINK"

field contents: "1"

Create the same a field in your NOTES table.

Next create a field in the CONTROL table:

field name: NextSerial

field type: (number)

Next create a relationship between the 2 tables so that you can get to the NextSerial field.

When you create a new record, make sure you use a script to do it so that you can use the following:

Script Example:

New Record/Request

SetField(ID NUMBER , RelationshipName::NextSerial)

SetField(RelationshipName::NextSerial , RelationshipName::NextSerial +1)

If you want to make your serial number fixed length (example: "00000001" or "A00000001") use field type: "text" instead so that leading zeros will not be automatically stripped off. In addition you will need to be a little more creative with how you update your next serial number.

In the following example, I want my serial format to have the letter "A" at the beginning and to always have 8 numeric digits for the number, for a total of 9 characters in length. To update the NextSerial field so that it increments by 1 and still retain the format that I want, I need to use the following example:

SetField(RelationshipName::NextSerial ,

"A" & right("00000000" & texttonumber(RelationshipName::NextSerial),8) +1

)

I think everything I have mentioned in this example exists in FMP v7.

Link to comment
Share on other sites

This topic is 7031 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
×
×
  • Create New...

Important Information

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