store the calculation results - File Maker

With calculation fields, you often have the option to store the calculation results or leave the calculation as unstored. An unstored calculation will calculate the field only when it’s needed, such as when the field appears on a layout or when the field is referenced within a script.

Why would you want to store a calculation? Because storing a calculation field gives you the option of indexing it, and an indexed field can be searched much more quickly than an unindexed field. So if you are creating a calculation that you expect your users want to perform searches on, you will probably want to make sure that it is stored and indexed.

There are times when you specifically don’t want a field to be stored. If you have fields that reference the Status functions, which is often useful for providing feedback to the user on a layout such as how many records are currently in the found set, then you want to specifically set these fields to be unstored. This is because if they are stored, then they will be calculated the first time they are needed, but they won’t update if the Status function changes. You want such fields to only calculate when they are needed so that when they are needed they have the most correct information.

There are some calculations that you can’t index. If a calculation field references an unstored field (either a calculation or a number, text, date, or time field), a global field, or a related field, you do not have the option to store and index the field. This is simply a limitation of FileMaker.

This presents some problems. Occasionally you need to have a field indexed that is a calculation field that can’t be stored. This can often come up if the field needs to be used as a key field in the right side of a relationship. How do you get around this? Make the field a standard field instead of a calculation and control its contents with scripts. This is more difficult and more trouble, but it can be worth it. But you have to tightly control when the value of the field should change. A stored calculation field will change its value whenever any field it is based on changes. Basically you need to duplicate that behavior, take note of where the data that the field is based on can change, and whenever that is possible, script the system so that it also changes the value of your pseudo calculation field.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

File Maker Topics