Across the top of the specify / manage calculation dialog box is a pull down menu (ignored more times than not) which is used to setup the relationship context for the calculation. The calculation context is basically the same as saying which source table occurrence you are going to use in the calculation and any related values used in the calculation will come based from this source.
WHEN USED FOR A CALCULATION FIELD
By default, the selections in this pull down menu will be related to the source table the field resides in when you pulled up the calculation dialog box. For example, if the calculation field is in the main table, you will see the associated table occurrences for that table. If the calculation field is in the invoice table, you will see all the table occurrences that use that source table.
This listing of table occurrences can be a bit unmanageable if you have a lot of table occurrences in your relationship graph and you are NOT designing via the Anchor / Buoy method.
WHEN USED IN A SCRIPTED CALCULATED VALUE
Scripts are not setup to use one particular table or table occurrence because they often hop between multiple areas as they perform their tasks. As you likely know, there are many script steps that allow you to use a calculated value to branch what they do. When this occurs, the calculation context is just as important as it is in a straight up calculation field. Because of this, for calculation context reasons, the script will rely upon the table occurrence used for the layout in the foremost window when the script step fires.
CALCULATION CONTEXT AND YOUR AVAILABLE RELATIONSHIPS
I did mention before that the selected context is used as the source for any other relationships used in the calculation. I want to finish this up by showing how this comes into play in the campaign module in my InBizness product. I will refer to Anchor / Buoy quite a bit here because this relationship technique helps make calculation context decisions more manageable.
Here you can see that I’m using the CAMPAIGN table occurrence for my calculation. In true Anchor / Buoy style, you can tell it is an anchor because it is in UPPERCASE. You can see the associated table occurrences that I can use in the calculation and have a valid result.
Here are some links to other posts that might be of interest in regards to this topic...
CHAPTER 08: Anchor / Buoy (16)