Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×
The Claris Museum: The Vault of FileMaker Antiquities at Claris Engage 2025! ×

Auto Serial Number depending on number of records.


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

Recommended Posts

  • Newbies
Posted

I have two databases. 1.client address book which has a customer ID which is a auto serial number field.

2.Is a contract database.I have defined the relationship between the two databases using the customer ID.

Every time I enter a new record I want another field to generate a "Contract Number" According to how many contracts are there for that customer. Can anyone please help?

Posted

This can be done by a script starting in db1 "client address book". I assume you have a field in db2 "contract" "Contract Number". I assume the relationship is named "Contact"

In both db's add a calculated number field "Constant" = 34567 or any othe number that you like. Make a relationship in db2 to db1 using "Constant" as the key fields. Call it "Client".

In db1 add the following fields Last Contract Number a calculated number = Last (Contact::) Contract Number), gcustomer ID a global field of the same type as customer ID and gContact Number a global number field.

In db1 write a script to create a related record:

Set field [gcustomer ID, cusomer ID]

Set field [gContact Number, Last Contact Number + 1]

Perform script "New record" in db2.

In db2 write the "New Record" script

Create new record

Set field [customer ID, Client::gcustomer ID]

Set field [Contact Number, Client::gContact Number]

You then can enter data into this record.

You may want to add a script & button to go to db1.

This topic is 7368 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.