Executing your script may be the best approach as it can store the value instead of calculating it every time you bring up a layout displaying either an unstored calculation field or a summary field.
But if you want the earliest date out of a set of records matching additional criteria, you have three basic approaches:
- A relationship that matches only to records with that specified criteria so that the min function can return the earliest date in that set of records. This approach requires setting up sufficient match fields to match to the records you want to evaluate with the Min function.
- Use ExecuteSQL with join and/or where clauses that extract that date from that same set of records.
- Or do what you currently do and perform a find for the records.
Note that all three methods can be used in a script instead of in an unstored calculation.
Thank you, Phil. Seems I wasn't too far off then. SQL is a little beyond by scope but I will possibly explore ways to create a relationship between 2 table occurrences that only deals with a specific event type.
The main problem I have with executing the script is that I need to switch to a different layout to enter find mode, and return to a layout with a tab object that switches to the default tab (not the tab containing the event dates) and the whole experience is not very slick.
Lots to think about and work on. Thanks again.
Yes, but keep in mind that a script with option 1 might be no more than a set field step or possibly a few set field steps (to set up the needed match field values) plus the one set field step to calculate and store the current value.
Name your tab objects (each tab) and set to a $$variable before you do anything else. Then on return to layout use:
Go to Object // use the $$variable you set as the object name
Brilliant! Thank you. I didn't realize you could name the individual tabs.