Set Next Serial Value
Purpose 
Resets the next serial value in an auto-entry serial number field.
Format 
Set Next Serial Value [<table::field>; <value or formula>]
Options 
 •
Select Specify target field or click Specify to specify the serial number field on which the script step will operate. The field you specify must be defined as an auto-entry serial number field.
 •
Calculated result: Click Specify to enter the next serial value or create a calculation to determine the next serial value.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server scheduled script 
Yes 
FileMaker Go 
Yes 
Custom Web Publishing 
Yes 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
Allows you to use the Manage Scripts feature to update the value. You can define this script step to use any calculation expression to determine the next serial value of a field that has been defined as an auto-entry serial number field. The calculation always evaluates to a text result.
For example, you might want to reset the next serial value after you do one of the following:
 •
 •
Notes
 •
 •
Example 1 
Calculates the number of the next available invoice ID, using the Max function to return the highest value in the Invoice ID field. If an invoice ID contains non-numeric data, then the calculation would need to be more sophisticated to maintain the numeric and non-numeric data.
Set Next Serial Value [Invoices::Invoice ID; Max ( Invoices::Invoice ID ) + 1]
Example 2 
Sets the next serial number value in the Invoice ID field options after importing records. Useful if Perform auto-enter options while importing is not selected in order to preserve dates and other auto-entered values.
Import Records [Add; Mac Roman]
Set Next Serial Value [Invoices::Invoice ID; Get ( TotalRecordCount ) + 1]
Example 3 
Prompts the user to input the next serial value.
Show Custom Dialog ["Set the next serial number value"; Invoices::Next Serial Value]
If [Get ( LastMessageChoice ) = 1]
Set Next Serial Value [Invoices::Invoice ID; Invoices::Next Serial Value]
End If
Related topics 
Import Records script step
Defining calculation fields
Script steps reference (alphabetical list)
Script steps reference (category list)