Note: This is an alternative solution to the Auto-Enter problem described in the Replace Field Contents Option: [X] Don't Perform auto-enter idea. I suggest reading that entry first (particularly also the first two comments) to understand the background of the problem.
Idea
Developers need more control over the calculation of auto-enter fields, particularly the ability to turn auto enter off when setting fields in scripts.
- AutoEnter logic is usually primarily designed to intelligently manage data consistency during user input.
- At other times, for example when importing data, the AutoEnter logic is counter-productive and thus the Import Record script step has the option "Don't calculate AutoEnter fields".
The lack of the ability to control this within scripts currently leads to ugly workarounds:
- adding branches in the auto enter calculation (and using auto enter instead of lookup fields)
- exporting + reimporting data
- rewriting your database with only script-controlled data mnagement
See the Replace Field Contents Option: [X] Don't Perform auto-enter idea for a critique of these workarounds.
The proposal here:
A new script step "Set Auto-Enter [ Off / On ]" to make it possible to set fields without recalculating dependent auto-Enter & lookup fields.
For example
# Set fields in bulk without triggering recalculations...
Set Auto-Enter[ Off ]
Set Field [ A ; 1 ]
Set Field [ B ; 1 ]
Set Field [ C ; 1 ]
Set Field [ D ; 1 ]
# ...then cause Field F to be calculated ONCE (F = A + B + C + D + E)
Set Auto-Enter[ On ]
Set Field [ E ; 1 ]
Commit Record [ ]
It should work in the following way:
- The Set Auto-Enter[ OFF ] command disables recalculating Auto-Enter until turned back ON - or until automatically disabled at the end of the script.
- It can work with any contents (Set Field, Replace Field Contents, New/Duplicate Record, Import Records, ...)
Benefits
- Performance: Developers can tune scripts to remove redundant recalculations.
- Data consistency: Developers have ability to 'correct' fields as needed (See Replace Field Contents Option: [X] Don't Perform auto-enter)
- Increased productivity
Benefit of Set Auto-Enter[ Off ] compared to the current trend of scripting data content
- Synergy
- It leverages & improves FileMakers fantastic field dependency logic, instead of dumping it.
- You can keep your AutoEnter AND your Lookup fields!
- No need to build complicated branches into your AutoEnter calculations
- Simplicity
- It does not mix data model and view levels.
- No more Layout-based script triggers and associated headaches! ☺
- Maintainable and scalable
- Easy: It is far easier to understand + learn
Benefit of Set Auto-Enter[ Off ] compared to Replace Field Contents Option: [X] Don't Perform auto-enter idea:
- No existing command needs to be changed
- It is much more flexible for use WITHIN or ACROSS records + scripts.
Use Cases