Open Transaction
Starts a transaction; subsequent record changes are held in the transaction until a Commit Transaction or Revert Transaction script step is performed.
Note Transactions are handled within the originating window. Actions taken in different windows from the window of the originating transaction will be committed automatically outside existing transactions.
See also
Options
-
Skip data entry validation overrides any data entry validation options set for fields and commits the record anyway. This option only skips validation for fields set with the Only during data entry validation option in the Options for Field dialog box; fields set to Always validate will still validate, even if the Skip data entry validation option is selected. See Defining field validation.
-
Override ESS locking conflicts allows clients of ODBC data sources to force-commit changes when optimistic locking otherwise prevents the commit action. ODBC data sources are also referred to as external SQL sources (ESS).
Compatibility
Product | Supported |
FileMaker Pro | Yes |
FileMaker Go | Yes |
FileMaker WebDirect | Yes |
FileMaker Server | Yes |
FileMaker Cloud | Yes |
FileMaker Data API | Yes |
Custom Web Publishing | Yes |
Originated in version
19.6.1
Description
A transaction consists of changes to one or more records in the current window. Changes in a transaction can affect multiple tables in multiple database files. All changes in a transaction are committed together or, if an error occurs, reverted together. A transaction starts with an Open Transaction script step. After you start a transaction, subsequent record changes are held in the transaction until a Commit Transaction or Revert Transaction script step is performed. The steps below can change records stored in the databases schema and can be used as transactional script steps.
-
If the import target is a new table, the table, table occurrence, and layout are deleted if the transaction isn't committed. A transaction isn't committed if the Commit Transaction script step returns an error or the Revert Transaction script step is performed.
-
Editing script steps: Clear, Cut, Paste, Perform Find/Replace, Undo/Redo
-
Insert script steps: Insert Audio/Video, Insert Calculated Result, Insert Current Date, Insert Current Time, Insert Current User Name, Insert File, Insert from Device, Insert from Index, Insert from Last Visited, Insert from URL, Insert PDF, Insert Picture, Insert Text
When you add an Open Transaction script step to a script, the Commit Transaction script step is automatically paired with it.
Transactions:
-
Combine one or more field or table modifications as a single set of changes
-
Commit or revert an entire set of changes
-
Group field or table modifications between the Start Transaction and Commit Transaction script steps
-
Allow you to create a more reliable set of changes
-
Can be automatically reverted using the Revert Transaction script step
-
Succeed (commit) or fail (revert) as a group
-
Succeed when schema rules have been met
-
Automatically revert when schema rules have not been met
-
Can optionally skip validation settings and override automatic reverts when schema rules have not been met. Overriding schema rules can break transactional integrity.
-
Are modified in a local temporary file before the Commit Transaction script step saves the changes to the main file
Transactions automatically commit and ends when:
-
The following script steps change the layout window: New Window, Close Window, or Select Window
-
The following dialog boxes are used: Manage Database, Manage Container, or Manage Data Source
-
The following actions or script steps are performed: Save a Copy as or Re-Login.
-
The file is closed
Transactions automatically revert when:
-
Unresolved schema error exists before beginning a transaction. Transactions are automatically skipped when this occurs
-
A change to a field, which is set to always validate, does not match the field's validation options
-
The Revert Transaction script step is used
-
A script is cancelled
-
The Halt Script script step is used within a transaction
-
A script is cancelled using the Script Debugger
-
There are privilege errors such as no field access, no record access, and no table access
Notes
-
You can't use the Open Transaction script step to start a transaction within another transaction.
-
Nested transactions using the Perform Script script step join originating transactions, but they ignore nested Revert Transaction and Commit Transaction script steps within sub-scripts.
-
The Delete Record action, when used within transactions, deletes a single record at a time.
-
The Truncate Table action can't be reverted.
-
The Import Records action doesn't show a summary when used within transactions.
-
The Revert Transaction script step doesn't revert the Auto Enter Serial Increment value.
-
The Save record changes automatically option in the Layout Setup is ignored during transactions.
-
Changes made by the Execute FileMaker Data API script step are not included in the script's transaction. Any operation completed within this script step, even if enclosed within a transaction, will not be reverted.
Example 1
Opens and commits a transaction.
Open Transaction []
Open Record/Request
Set Field [ Assets::Description ; "descriptive text" ]
Commit Transaction
Example 2
Opens and commits a transaction without data entry validation.
Open Transaction [ Skip data entry validation ]
Open Record/Request
Set Field [ Assets::Description ; "descriptive text" ]
Commit Transaction
Example 3
Opens and commits a transaction without ESS locking protection.
Open Transaction [ Override ESS locking conflicts ]
Open Record/Request
Set Field [ Assets::Description ; "descriptive text" ]
Commit Transaction