- Who: All Users
- What: How to Force an Auto-Enter Text Field Calc to Update
- With: FileMaker 11+ (not sure how far back it goes)
- Why: You don’t want to slow your solution down with an unstored calc, but the auto-enter calc is not updating when you need it to.
When I first started using FileMaker, I wanted to make everything an unstored calculation because things seemed to “just work” as I expected them to. However, it wasn’t long before I realized how badly it affected the performance of my solutions. Once I discovered how the Auto-Enter calcs worked (thanks Matt Petrowsky!), I was able to almost completely stop using unstored calcs and my solutions are so much leaner and faster! That said, I had a few hiccups at first when trying to figure out how to get some of my auto-enter calcs to refresh or update. Here is a quick, easy, and clean way to get ALL of your auto-enter calcs to re-evaluate and hence refresh!
- First you need a field in your local table that you can update. We will call it “Refresh” (i.e.: MyTable::Refresh)
- I like to make the Refresh field a TimeStamp field
- When defining your auto-enter calc, append your refresh field with this simple calculation:
& If (Refresh; “”; “”)
- Notice what happens with the calc above:
- The “If” statement looks for the condition of “Refresh” being updated, if it is updated, then “” is appended. If not, “” is still appended.
- In either case, nothing is actually appended! That means you can have your full auto-enter calc be something like: NameLast & Name First & If (Refresh; “”; “”)
- When you update the “Refresh” field with a new TimeStamp, all Auto-Enter calc fields that contain the little snippet above will re-evaluate but nothing will be appended to the end…leaving you with an updated and refreshed auto-enter calculation for the NameLast & Name First part of the calculation!
Of course, for this to work you need to somehow set the “Refresh” field with a new TimeStamp. You can do this via script, trigger or something else like that, but ultimately this little trick makes it easy to centrally and quickly refresh all your auto-enter calcs!