<<I use to use the "Serial number" options in field option, but if you delete the latest record you won't get the right number anymore.>>
Do you delete a record often enough that it is worth effort?
I'm afraid it happen quite often, and also the people are going to use it wouldn't know how to change the field settings.
It is not possiblebecause if you delete the record then create new record then it will take the next number which is defined in the serial no field. but there is a way to achieve it.Go to Record/Request/Page [Last]Set Next Serial Value [Table1::Invoice ID; Table1::InvoiceID + 1] .
Is this for a multi-user database or single user?
In a single user database, You can related the table to itself in your relationship graph and use: Max(SelfJoinTOname::numberField) + 1 to set the next larger serial number.
This can fail though in multi-user databases.
Thanks Elizas for your reply:
Go to Record/Request/Page [Last]Set Next Serial Value [Table1::Invoice ID; Table1::InvoiceID + 1]
Sorry but I don't understand what I'm supposed to do
"Go to Record/Request/Page" what do you mean, I never used File Maker P before.
I use to use 4Dimension and type myself the few script/function that I new but with File Maker I feel really disoriented.
Thank you PhilModJunk
Yes the database is for a sigle user and your solution seams to be easy but.
I think I understod what you mean by "related the table to itself"
but about the function\\ Max(SelfJoinTOname::numberField) + 1 \\ I don't understand "SelfJoinTOname" is this a function?
if it helps this is the DB structure:
I need to do the scrip for the DB_Invoices::Inv_Number
to relate the database to itself wich field I need to relate and then it will create a new table (is this one a kind of allias?)
many thanks for your patient.
Every box in your relationship graph is a "table occurrence box" (TO). Since I didn't know what your relationship graph looked like, I used a generic name that you would replace with the name of a table occurrence from your graph.
In your case, drag from Code_N to outside the box and then back to the same field. A dialog box pops up asking you to name this "instance" of the table. Name it "InvoiceSelf" or some such. Double Click the line linking these two boxes and change the operator from = to X. You want this relationship to match all records regardless of the actual value in Code_N.
Using the above Table Occurrence name, the expression will look like this:
Max(InvoiceSelf::numberField) + 1
If you're finding the terms, table, table occurrence, data source table confusing, you might check this link for an explanation:
Thank you very much for your help, I didn't get it at first but not it works fine as you suggested.
Many thanks again.