We never know in advance what time we will be generating the report for.
So we thought there was no way to pre-calculated the results over night.
The rules are: Here are some examples of what we expect when a product is chosen: There is one more key rule for our Rate field and that is the rate must be able to be modified once a default is auto-entered With all of the required rules known, the first attempt at formulating an auto-enter calculation looked as follows: Let ( [Trigger Field = Product ID ; Rate One = Home to Products for Rate Auto Entry:: Rate 1 ; Rate Two = Home to Products for Rate Auto Entry:: Rate 2]; Case (not Is Empty ( Rate One ) ; Rate One ;not Is Empty ( Rate Two ) ; Rate Two ; Self)) Note that auto-enter calculations will trigger and re-evaluate when any field that they reference within the same table context is modified.
We wish for the rate to change whenever the product ID is changed, however the product ID is merely a means to lookup the correct rate, we don't actually make use of the product ID itself in the calculation results.
Sometimes, not often, I accidentally achieve results that look too marvelous to be real. The script recently started taking over 8 hours to run and reaching the expiration limit we have set for it.
Last week I assigned Petr, our internal system developer, the task to optimize one server-side script.
In order to have it trigger the auto-enter calculation we simply need to reference.
This has been done using a Let statement where we set the Product ID field into a trigger variable whose only purpose is to fire the auto-enter calculation into action.
The File Maker Help files describe the "purpose" of evaluate as "Evaluates expression as a calculation", here is an excerpt from the documentation: Evaluates expression as a calculation.
When I tried his optimized script on live data I was honestly surprised. My first thought was there must be something wrong. After further examination I could confirm that it really does what it is supposed to do.
Let me show you what and how Petr actually optimized… We were supposed to implement report of stock inventory at a specified time.
The inimitable Ray Cologon offered the following analysis some time ago.
I came across a re-post of it from Mike Kim in my FMDi SC mail archive.